data is good On Saturday, December 17, 2016 11:50 PM, "zjp_j...@163.com" <zjp_j...@163.com> wrote:
#yiv7434848277 body {line-height:1.5;}#yiv7434848277 blockquote {margin-top:0px;margin-bottom:0px;margin-left:0.5em;}#yiv7434848277 div.yiv7434848277foxdiv20161217234614718397 {}#yiv7434848277 body {font-size:10.5pt;color:rgb(0, 0, 0);line-height:1.5;}I think the causation is your invanlid Double data , have u checked your data ? zjp_j...@163.com From: Richard XinDate: 2016-12-17 23:28To: UserSubject: Java to show struct field from a Dataframelet's say I have a DataFrame with schema of followings:root |-- name: string (nullable = true) |-- location: struct (nullable = true) | |-- longitude: double (nullable = true) | |-- latitude: double (nullable = true) df.show(); throws following exception: java.lang.ClassCastException: [D cannot be cast to java.lang.Double at scala.runtime.BoxesRunTime.unboxToDouble(BoxesRunTime.java:119) at org.apache.spark.sql.catalyst.expressions.BaseGenericInternalRow$class.getDouble(rows.scala:44) at org.apache.spark.sql.catalyst.expressions.GenericInternalRow.getDouble(rows.scala:221) at org.apache.spark.sql.catalyst.expressions.GeneratedClass$SpecificUnsafeProjection.apply(Unknown Source).... Any advise?Thanks in advance.Richard