Re: How to convert dataframe to a nested StructType schema

2015-09-17 Thread Hao Wang
Thanks, Terry. This is exactly what I need :) Hao On Tue, Sep 15, 2015 at 8:47 PM, Terry Hole wrote: > Hao, > > For spark 1.4.1, you can try this: > val rowrdd = df.rdd.map(r => Row(Row(r(3)), Row(r(0), r(1), r(2 > val newDF = sqlContext.createDataFrame(rowrdd, yourNewSchema) > > Thanks! >

Re: How to convert dataframe to a nested StructType schema

2015-09-15 Thread Terry Hole
Hao, For spark 1.4.1, you can try this: val rowrdd = df.rdd.map(r => Row(Row(r(3)), Row(r(0), r(1), r(2 val newDF = sqlContext.createDataFrame(rowrdd, yourNewSchema) Thanks! - Terry On Wed, Sep 16, 2015 at 2:10 AM, Hao Wang wrote: > Hi, > > I created a dataframe with 4 string columns (cit