spark-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Ayoub Benali <benali.ayoub.i...@gmail.com>
Subject Re: SQL JSON array operations
Date Thu, 15 Jan 2015 17:13:18 GMT
You could try yo use hive context which bring HiveQL, it would allow you to
query nested structures using "LATERAL VIEW explode..."
On Jan 15, 2015 4:03 PM, "jvuillermet" <jeremy.vuillermet@gmail.com> wrote:

> let's say my json file lines looks like this
>
> {"user": "baz", "tags" : ["foo", "bar"] }
> ....
>
> sqlContext.jsonFile("data.json")
> ...
> How could I query for user with "bar" tags using SQL
>
> sqlContext.sql("select user from users where tags ?contains? 'bar' ")
>
> I could simplify the request and use the returned RDD to filter on tags but
> I'm exploring an app where users can write their SQL queries
>
>
>
>
> --
> View this message in context:
> http://apache-spark-user-list.1001560.n3.nabble.com/SQL-JSON-array-operations-tp21164.html
> Sent from the Apache Spark User List mailing list archive at Nabble.com.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@spark.apache.org
> For additional commands, e-mail: user-help@spark.apache.org
>
>

Mime
View raw message