Hello,

Given the following example customers.json file:
{
"name": "Sherlock Holmes",
"customerNumber": 12345,
"address": {
"street": "221b Baker Street",
"city": "London",
"zipcode": "NW1 6XE",
"country": "United Kingdom"
}
},
{
"name": "Big Bird",
"customerNumber": 10001,
"address": {
"street": "123 Sesame Street",
"city": "Hensonville",
"zipcode": "56789",
"country": "United States"
}
}

And loading it with the following Scala code:
val sqlCtx = new org.apache.spark.sql.SQLContext(sc)
val customers = sqlCtx.jsonFile("hdfs:///customers.json")

How would I perform a select on the elements under the address?  I tried
the following and a number of variations without success:

customers.select('address.city).collect()

I know I can do this using the SQL syntax, but I'm interested in how to do
this using the LINQ syntax.

Thank you for your help.

Cheers,
Brett

Reply via email to