[ https://issues.apache.org/jira/browse/SPARK-21905?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
bluejoe updated SPARK-21905: ---------------------------- Description: {code:java} val schema = StructType(List( StructField("name", DataTypes.StringType, true), StructField("location", new PointUDT, true))) val rowRdd = sqlContext.sparkContext.parallelize(Seq("bluejoe", "alex"), 4).map({ x: String ⇒ Row.fromSeq(Seq(x, Point(100, 100))) }); val dataFrame = sqlContext.createDataFrame(rowRdd, schema) dataFrame.createOrReplaceTempView("person"); sqlContext.sql("SELECT * FROM person").foreach(println(_)); {code} the last statement throws exception: {code:java} Caused by: java.lang.ClassCastException: org.apache.spark.sql.catalyst.expressions.GenericRow cannot be cast to org.apache.spark.sql.catalyst.InternalRow at org.apache.spark.sql.catalyst.expressions.GeneratedClass$SpecificUnsafeProjection.evalIfFalseExpr1$(Unknown Source) at org.apache.spark.sql.catalyst.expressions.GeneratedClass$SpecificUnsafeProjection.apply(Unknown Source) at org.apache.spark.sql.catalyst.encoders.ExpressionEncoder.toRow(ExpressionEncoder.scala:287) ... 18 more {code} was: {code:java} val schema = StructType(List( StructField("name", DataTypes.StringType, true), StructField("location", new PointUDT, true))) val rowRdd = sqlContext.sparkContext.parallelize(Seq("bluejoe", "alex"), 4).map({ x: String ⇒ Row.fromSeq(Seq(x, Point(100, 100))) }); val dataFrame = sqlContext.createDataFrame(rowRdd, schema) dataFrame.createOrReplaceTempView("person"); sqlContext.sql("SELECT * FROM person").foreach(println(_)); {code} the last statement throws exception: {code:java} Caused by: java.lang.ClassCastException: org.apache.spark.sql.catalyst.expressions.GenericRow cannot be cast to org.apache.spark.sql.catalyst.InternalRow at org.apache.spark.sql.catalyst.expressions.GeneratedClass$SpecificUnsafeProjection.evalIfFalseExpr1$(Unknown Source) at org.apache.spark.sql.catalyst.expressions.GeneratedClass$SpecificUnsafeProjection.apply(Unknown Source) at org.apache.spark.sql.catalyst.encoders.ExpressionEncoder.toRow(ExpressionEncoder.scala:287) ... 18 more {code} > ClassCastException when call sqlContext.sql on temp table > --------------------------------------------------------- > > Key: SPARK-21905 > URL: https://issues.apache.org/jira/browse/SPARK-21905 > Project: Spark > Issue Type: Bug > Components: SQL > Affects Versions: 2.2.0 > Reporter: bluejoe > > {code:java} > val schema = StructType(List( > StructField("name", DataTypes.StringType, true), > StructField("location", new PointUDT, true))) > val rowRdd = sqlContext.sparkContext.parallelize(Seq("bluejoe", "alex"), > 4).map({ x: String ⇒ Row.fromSeq(Seq(x, Point(100, 100))) }); > val dataFrame = sqlContext.createDataFrame(rowRdd, schema) > dataFrame.createOrReplaceTempView("person"); > sqlContext.sql("SELECT * FROM person").foreach(println(_)); > {code} > the last statement throws exception: > {code:java} > Caused by: java.lang.ClassCastException: > org.apache.spark.sql.catalyst.expressions.GenericRow cannot be cast to > org.apache.spark.sql.catalyst.InternalRow > at > org.apache.spark.sql.catalyst.expressions.GeneratedClass$SpecificUnsafeProjection.evalIfFalseExpr1$(Unknown > Source) > at > org.apache.spark.sql.catalyst.expressions.GeneratedClass$SpecificUnsafeProjection.apply(Unknown > Source) > at > org.apache.spark.sql.catalyst.encoders.ExpressionEncoder.toRow(ExpressionEncoder.scala:287) > ... 18 more > {code} -- This message was sent by Atlassian JIRA (v6.4.14#64029) --------------------------------------------------------------------- To unsubscribe, e-mail: issues-unsubscr...@spark.apache.org For additional commands, e-mail: issues-h...@spark.apache.org