use df.selectExpr to evaluate complex expression (instead of just column
names).
On Thu, May 5, 2016 at 11:53 AM, Xinh Huynh wrote:
> Hi,
>
> I am having trouble accessing an array element in JSON data with a
> dataframe. Here is the schema:
>
> val json1 = """{"f1":"1", "f1a":[{"f2":"2"}] } }""
Hi,
I am having trouble accessing an array element in JSON data with a
dataframe. Here is the schema:
val json1 = """{"f1":"1", "f1a":[{"f2":"2"}] } }"""
val rdd1 = sc.parallelize(List(json1))
val df1 = sqlContext.read.json(rdd1)
df1.printSchema()
root |-- f1: string (nullable = true) |-- f1a: a