Re: attempting to map Dataset[Row]

2017-02-27 Thread Yan Facai
Hi, Fletcher. case class can help construct complex structure. and also, RDD, StructType and StructureField are helpful if you need. However, the code is a little confusing, source.map{ row => { val key = row(0) val buff = new ArrayBuffer[Row]() buff += row (key,buff)

Re: attempting to map Dataset[Row]

2017-02-26 Thread Stephen Fletcher
sorry here's the whole code val source = spark.read.format("parquet").load("/emrdata/sources/very_large_ds") implicit val mapEncoder = org.apache.spark.sql.Encoders.kryo[(Any,ArrayBuffer[Row])] source.map{ row => { val key = row(0) val buff = new ArrayBuffer[Row]() buff += row

attempting to map Dataset[Row]

2017-02-26 Thread Stephen Fletcher
I'm attempting to perform a map on a Dataset[Row] but getting an error on decode when attempting to pass a custom encoder. My code looks similar to the following: val source = spark.read.format("parquet").load("/emrdata/sources/very_large_ds") source.map{ row => { val key = row(0)