Aseem Bansal created SPARK-21473:
------------------------------------

             Summary: Running Transform on a bean which has only setters gives 
NullPointerExcpetion
                 Key: SPARK-21473
                 URL: https://issues.apache.org/jira/browse/SPARK-21473
             Project: Spark
          Issue Type: Bug
          Components: Spark Core
    Affects Versions: 2.1.0
            Reporter: Aseem Bansal


If I run the following 

{code:java}
dataset.map(Transformer::transform, 
Encoders.bean(BeanWithOnlySettersAndNoGetters.class));
{code}

Then I get the below exception. I understand that it is not bean-compliant 
without the getters but the exception is wrong. Perhaps fixing the exception 
message would be a solution?

{noformat}
Caused by: java.lang.NullPointerException
        at org.spark_project.guava.reflect.TypeToken.method(TypeToken.java:465)
        at 
org.apache.spark.sql.catalyst.JavaTypeInference$$anonfun$2.apply(JavaTypeInference.scala:126)
        at 
org.apache.spark.sql.catalyst.JavaTypeInference$$anonfun$2.apply(JavaTypeInference.scala:125)
        at 
scala.collection.TraversableLike$$anonfun$map$1.apply(TraversableLike.scala:234)
        at 
scala.collection.TraversableLike$$anonfun$map$1.apply(TraversableLike.scala:234)
        at 
scala.collection.IndexedSeqOptimized$class.foreach(IndexedSeqOptimized.scala:33)
        at scala.collection.mutable.ArrayOps$ofRef.foreach(ArrayOps.scala:186)
        at scala.collection.TraversableLike$class.map(TraversableLike.scala:234)
        at scala.collection.mutable.ArrayOps$ofRef.map(ArrayOps.scala:186)
        at 
org.apache.spark.sql.catalyst.JavaTypeInference$.org$apache$spark$sql$catalyst$JavaTypeInference$$inferDataType(JavaTypeInference.scala:125)
        at 
org.apache.spark.sql.catalyst.JavaTypeInference$.inferDataType(JavaTypeInference.scala:55)
        at 
org.apache.spark.sql.catalyst.encoders.ExpressionEncoder$.javaBean(ExpressionEncoder.scala:89)
        at org.apache.spark.sql.Encoders$.bean(Encoders.scala:142)
        at org.apache.spark.sql.Encoders.bean(Encoders.scala)
{noformat}




--
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

Reply via email to