Spark SQL Language Injection

Answered

I like the use of SQL Language Injection, but when I started using for Spark SQL it doesn't work out so well.

For example its common to use it as follows:

sqlContext.sql("""
|select
|lister_id,
|listing_id
|from
|events e
|where verb='post' and direct_object_type='listing'
""".stripMargin)

Intellij raises error on "|"

Also it doesn't understand the nested sql syntax:

sqlContext.sql("""
|select
|e.actor.id as lister_id,
|e.direct_object.id as listing_id
|from
|events e
|where verb='post' and e.direct_object.type='listing'
""".stripMargin)

 

Do we have any language injection plugin for spark sql ? couldn't find them online

0
2 comments

There is an issue currently with handling the pipe character in injected fragment. Please vote/follow these requests:

https://youtrack.jetbrains.com/issue/SCL-11709https://youtrack.jetbrains.com/issue/SCL-11710

0

Thanks Andrey, added vote. any guidance for nested structure support ?

0

Please sign in to leave a comment.