You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@spark.apache.org by "Hao Ren (JIRA)" <ji...@apache.org> on 2015/06/22 18:30:00 UTC
[jira] [Updated] (SPARK-8527) StructType's Factory method does not
work in java code
[ https://issues.apache.org/jira/browse/SPARK-8527?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Hao Ren updated SPARK-8527:
---------------------------
Description:
According to the following line of code below:
https://github.com/apache/spark/blob/master/sql/catalyst/src/main/scala/org/apache/spark/sql/types/StructType.scala#L209
The casting should be successful, however after type erasure, I encounter {{java.lang.ClassCastException}}:
{code}
ArrayList<StructField> structFields = new ArrayList<>();
// Some add operation
return StructType$.MODULE$.apply(structFields); // run time error
Exception in thread "main" java.lang.ClassCastException: [Ljava.lang.Object; cannot be cast to [Lorg.apache.spark.sql.types.StructField;
at org.apache.spark.sql.types.StructType$.apply(StructType.scala:209)
{code}
Am I missing anything ?
was:
According to the following line of code below:
https://github.com/apache/spark/blob/master/sql/catalyst/src/main/scala/org/apache/spark/sql/types/StructType.scala#L209
The casting should be successful, however after type erasure, I encounter {{java.lang.ClassCastException}}:
Exception in thread "main" java.lang.ClassCastException: [Ljava.lang.Object; cannot be cast to [Lorg.apache.spark.sql.types.StructField;
at org.apache.spark.sql.types.StructType$.apply(StructType.scala:209)
Am I missing anything ?
> StructType's Factory method does not work in java code
> ------------------------------------------------------
>
> Key: SPARK-8527
> URL: https://issues.apache.org/jira/browse/SPARK-8527
> Project: Spark
> Issue Type: Bug
> Components: SQL
> Affects Versions: 1.4.0
> Reporter: Hao Ren
>
> According to the following line of code below:
> https://github.com/apache/spark/blob/master/sql/catalyst/src/main/scala/org/apache/spark/sql/types/StructType.scala#L209
> The casting should be successful, however after type erasure, I encounter {{java.lang.ClassCastException}}:
> {code}
> ArrayList<StructField> structFields = new ArrayList<>();
> // Some add operation
> return StructType$.MODULE$.apply(structFields); // run time error
> Exception in thread "main" java.lang.ClassCastException: [Ljava.lang.Object; cannot be cast to [Lorg.apache.spark.sql.types.StructField;
> at org.apache.spark.sql.types.StructType$.apply(StructType.scala:209)
> {code}
> Am I missing anything ?
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@spark.apache.org
For additional commands, e-mail: issues-help@spark.apache.org