2015-08-21 3:17 GMT-07:00 smagadi :
> teenagers .toJSON gives the json but it does not preserve the parent ids
>
> meaning if the input was {"name":"Yin",
> "address":{"city":"Columbus","state":"Ohio"},"age":20}
>
> val x= sqlContext.sql("SELECT name, address.city, address.state ,age FROM
> people
ame, address.city, address.state ,age FROM
people where age>19 and age <=30 ").toJSON
x.collect().foreach(println)
This returns back , missing address.
{"name":"Yin","city":"Columbus","state":"Ohio","age":20}
Is this a bug ?
val teenagers = sqlContext.sql("SELECT name FROM people WHERE age >= 13 AND
age <= 19")
I need teenagers to be a JSON object rather a simple row .How can we get
that done ?
--
View this message in context:
http://apache-spark-user-list.1001560.n3.nabble.com/SPARK-sql-Need-JSON