Re: Class cast exception while using Data Frames

2018-03-27 Thread Nikhil Goyal
You can run this on spark shell *CODE:* case class InstanceData(service: String, metric: String, zone: String, source: String, time: Long, value: Double ) val seq = sc.parallelize(Seq( InstanceData("serviceA", "metricA", "zoneA", "sourceA", 1000L, 1.0),

Re: Class cast exception while using Data Frames

2018-03-27 Thread Shmuel Blitz
Hi Nikhil, Can you please put a code snippet that reproduces the issue? Shmuel On Tue, Mar 27, 2018 at 12:55 AM, Nikhil Goyal wrote: > |-- myMap: map (nullable = true) > ||-- key: struct > ||-- value: double (valueContainsNull = true) > |||-- _1:

Re: Class cast exception while using Data Frames

2018-03-26 Thread Nikhil Goyal
|-- myMap: map (nullable = true) ||-- key: struct ||-- value: double (valueContainsNull = true) |||-- _1: string (nullable = true) |||-- _2: string (nullable = true) |-- count: long (nullable = true) On Mon, Mar 26, 2018 at 1:41 PM, Gauthier Feuillen

Re: Class cast exception while using Data Frames

2018-03-26 Thread Gauthier Feuillen
Can you give the output of “printSchema” ? > On 26 Mar 2018, at 22:39, Nikhil Goyal wrote: > > Hi guys, > > I have a Map[(String, String), Double] as one of my columns. Using > input.getAs[Map[(String, String), Double]](0) > throws exception: Caused by:

Class cast exception while using Data Frames

2018-03-26 Thread Nikhil Goyal
Hi guys, I have a Map[(String, String), Double] as one of my columns. Using input.getAs[Map[(String, String), Double]](0) throws exception: Caused by: java.lang.ClassCastException: org.apache.spark.sql.catalyst.expressions.GenericRowWithSchema cannot be cast to scala.Tuple2 Even the schema