Github user kevinyu98 commented on a diff in the pull request:

    https://github.com/apache/spark/pull/10125#discussion_r63655581
  
    --- Diff: 
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/CatalystTypeConverters.scala
 ---
    @@ -321,11 +323,13 @@ object CatalystTypeConverters {
       }
     
       private class DecimalConverter(dataType: DecimalType)
    -    extends CatalystTypeConverter[Any, JavaBigDecimal, Decimal] {
    +  extends CatalystTypeConverter[Any, JavaBigDecimal, Decimal] {
    --- End diff --
    
    Hello Wenchen: I have to keep case d: JavaBigInteger => Decimal(d) there, 
otherwise, this testcase will fail with the java.math.BigInteger.
    
    @Test
      public void testCreateDataFrameFromLocalJavaBeans() {
        Bean bean = new Bean();
        List<Bean> data = Arrays.asList(bean);
        Dataset<Row> df = spark.createDataFrame(data, Bean.class);
        validateDataFrameWithBeans(bean, df);
      }
    here is the trace
    
    scala.MatchError: 1234567 (of class java.math.BigInteger)
        at 
org.apache.spark.sql.catalyst.CatalystTypeConverters$DecimalConverter.toCatalystImpl(CatalystTypeConverters.scala:326)
        at 
org.apache.spark.sql.catalyst.CatalystTypeConverters$DecimalConverter.toCatalystImpl(CatalystTypeConverters.scala:323)
        at 
org.apache.spark.sql.catalyst.CatalystTypeConverters$CatalystTypeConverter.toCatalyst(CatalystTypeConverters.scala:102)
        at 
org.apache.spark.sql.catalyst.CatalystTypeConverters$$anonfun$createToCatalystConverter$2.apply(CatalystTypeConverters.scala:401)
        at 
org.apache.spark.sql.SQLContext$$anonfun$beansToRows$1$$anonfun$apply$1.apply(SQLContext.scala:892)
        at 
org.apache.spark.sql.SQLContext$$anonfun$beansToRows$1$$anonfun$apply$1.apply(SQLContext.scala:892)
        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.SQLContext$$anonfun$beansToRows$1.apply(SQLContext.scala:892)
        at 
org.apache.spark.sql.SQLContext$$anonfun$beansToRows$1.apply(SQLContext.scala:890)
        at scala.collection.Iterator$$anon$11.next(Iterator.scala:409)
        at scala.collection.Iterator$class.toStream(Iterator.scala:1322)
        at scala.collection.AbstractIterator.toStream(Iterator.scala:1336)
        at 
scala.collection.TraversableOnce$class.toSeq(TraversableOnce.scala:298)
        at scala.collection.AbstractIterator.toSeq(Iterator.scala:1336)
        at 
org.apache.spark.sql.SparkSession.createDataFrame(SparkSession.scala:373)
        at 
test.org.apache.spark.sql.JavaDataFrameSuite.testCreateDataFrameFromLocalJavaBeans(JavaDataFrameSuite.java:200)


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org
For additional commands, e-mail: reviews-h...@spark.apache.org

Reply via email to