Re: How to implement zipWithIndex as a UDF?

2015-10-28 Thread Benyi Wang
Thanks Michael. I should make my question more clear. This is the data type: StructType(Seq( StructField("uid", LongType), StructField("infos", ArrayType( StructType(Seq( StructType("cid", LongType), StructType("cnt", LongType) )) )) )) I want to explode

How to implement zipWithIndex as a UDF?

2015-10-23 Thread Benyi Wang
If I have two columns StructType(Seq( StructField("id", LongType), StructField("phones", ArrayType(StringType I want to add index for “phones” before I explode it. Can this be implemented as GenericUDF? I tried DataFrame.explode. It worked for simple types like string, but I could not

Re: How to implement zipWithIndex as a UDF?

2015-10-23 Thread Michael Armbrust
The user facing type mapping is documented here: http://spark.apache.org/docs/latest/sql-programming-guide.html#data-types On Fri, Oct 23, 2015 at 12:10 PM, Benyi Wang wrote: > If I have two columns > > StructType(Seq( > StructField("id", LongType), >