You are viewing a plain text version of this content. The canonical link for it is here.
Posted to reviews@spark.apache.org by GitBox <gi...@apache.org> on 2019/03/11 05:00:00 UTC

[GitHub] [spark] maropu commented on a change in pull request #24014: [SPARK-27092][SQL] Apply refactored pattern in ScalaReflection and JavaTypeInference to RowEncoder

maropu commented on a change in pull request #24014: [SPARK-27092][SQL] Apply refactored pattern in ScalaReflection and JavaTypeInference to RowEncoder
URL: https://github.com/apache/spark/pull/24014#discussion_r264091828
 
 

 ##########
 File path: sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/encoders/RowEncoder.scala
 ##########
 @@ -285,63 +195,27 @@ object RowEncoder {
             "SQLUserDefinedType nor registered with UDTRegistration.}")
         }
       }
-      val obj = NewInstance(
-        udtClass,
-        Nil,
-        dataType = ObjectType(udtClass))
-      Invoke(obj, "deserialize", ObjectType(udt.userClass), input :: Nil)
+      createDeserializerForUserDefinedType(input, udt, udtClass)
 
-    case TimestampType if SQLConf.get.datetimeJava8ApiEnabled =>
-      StaticInvoke(
-        DateTimeUtils.getClass,
-        ObjectType(classOf[java.time.Instant]),
-        "microsToInstant",
-        input :: Nil,
-        returnNullable = false)
+    case TimestampType if SQLConf.get.datetimeJava8ApiEnabled => createDeserializerForInstant(input)
 
-    case TimestampType =>
-      StaticInvoke(
-        DateTimeUtils.getClass,
-        ObjectType(classOf[java.sql.Timestamp]),
-        "toJavaTimestamp",
-        input :: Nil,
-        returnNullable = false)
+    case TimestampType => createDeserializerForSqlTimestamp(input)
 
-    case DateType if SQLConf.get.datetimeJava8ApiEnabled =>
-      StaticInvoke(
-        DateTimeUtils.getClass,
-        ObjectType(classOf[java.time.LocalDate]),
-        "daysToLocalDate",
-        input :: Nil,
-        returnNullable = false)
+    case DateType if SQLConf.get.datetimeJava8ApiEnabled => createDeserializerForLocalDate(input)
 
 Review comment:
   ditto

----------------------------------------------------------------
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:
users@infra.apache.org


With regards,
Apache Git Services

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