yaooqinn commented on a change in pull request #28197: [SPARK-31431][SQL] Add 
CalendarInterval encoder support
URL: https://github.com/apache/spark/pull/28197#discussion_r409957915
 
 

 ##########
 File path: 
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/ScalaReflection.scala
 ##########
 @@ -235,6 +235,7 @@ object ScalaReflection extends ScalaReflection {
       case t if isSubtype(t, localTypeOf[java.lang.String]) =>
         createDeserializerForString(path, returnNullable = false)
 
+      case t if isSubtype(t, localTypeOf[CalendarInterval]) => path
 
 Review comment:
   Do you mean we work for scala Products? `Seq(Array(something)).toDF` seems 
need that `something` to be java primitives or `scala.Product`s. Not yet 
support `CalendarInterval` or e.g....
   ```scala
   scala> case class A(a: Int)
   defined class A
   
   scala> Seq(Array(A(1))).toDF
   res8: org.apache.spark.sql.DataFrame = [value: array<struct<a:int>>]
   
   scala> class B(a: Int)
   defined class B
   
   scala> Seq(Array(new B(1))).toDF
   <console>:29: error: value toDF is not a member of Seq[Array[B]]
          Seq(Array(new B(1))).toDF
                               ^
   
   scala> Seq(new java.math.BigDecimal(1)).toDF
   res10: org.apache.spark.sql.DataFrame = [value: decimal(38,18)]
   
   scala> Seq(Array(new java.math.BigDecimal(1))).toDF
   <console>:28: error: value toDF is not a member of 
Seq[Array[java.math.BigDecimal]]
          Seq(Array(new java.math.BigDecimal(1))).toDF
   ``` 

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to