maropu commented on a change in pull request #23854: [SPARK-22000][SQL] Address
missing Upcast in JavaTypeInference.deserializerFor
URL: https://github.com/apache/spark/pull/23854#discussion_r260125118
##########
File path:
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/ScalaReflection.scala
##########
@@ -211,73 +167,53 @@ object ScalaReflection extends ScalaReflection {
WrapOption(deserializerFor(optType, path, newTypePath),
dataTypeFor(optType))
case t if t <:< localTypeOf[java.lang.Integer] =>
- val boxedType = classOf[java.lang.Integer]
- val objectType = ObjectType(boxedType)
- StaticInvoke(boxedType, objectType, "valueOf", path :: Nil,
returnNullable = false)
+ createDeserializerForTypesSupportValueOf(path,
+ classOf[java.lang.Integer])
case t if t <:< localTypeOf[java.lang.Long] =>
- val boxedType = classOf[java.lang.Long]
- val objectType = ObjectType(boxedType)
- StaticInvoke(boxedType, objectType, "valueOf", path :: Nil,
returnNullable = false)
+ createDeserializerForTypesSupportValueOf(path,
+ classOf[java.lang.Long])
case t if t <:< localTypeOf[java.lang.Double] =>
- val boxedType = classOf[java.lang.Double]
- val objectType = ObjectType(boxedType)
- StaticInvoke(boxedType, objectType, "valueOf", path :: Nil,
returnNullable = false)
+ createDeserializerForTypesSupportValueOf(path,
+ classOf[java.lang.Double])
case t if t <:< localTypeOf[java.lang.Float] =>
- val boxedType = classOf[java.lang.Float]
- val objectType = ObjectType(boxedType)
- StaticInvoke(boxedType, objectType, "valueOf", path :: Nil,
returnNullable = false)
+ createDeserializerForTypesSupportValueOf(path,
+ classOf[java.lang.Float])
case t if t <:< localTypeOf[java.lang.Short] =>
- val boxedType = classOf[java.lang.Short]
- val objectType = ObjectType(boxedType)
- StaticInvoke(boxedType, objectType, "valueOf", path :: Nil,
returnNullable = false)
+ createDeserializerForTypesSupportValueOf(path,
+ classOf[java.lang.Short])
case t if t <:< localTypeOf[java.lang.Byte] =>
- val boxedType = classOf[java.lang.Byte]
- val objectType = ObjectType(boxedType)
- StaticInvoke(boxedType, objectType, "valueOf", path :: Nil,
returnNullable = false)
+ createDeserializerForTypesSupportValueOf(path,
+ classOf[java.lang.Byte])
case t if t <:< localTypeOf[java.lang.Boolean] =>
- val boxedType = classOf[java.lang.Boolean]
- val objectType = ObjectType(boxedType)
- StaticInvoke(boxedType, objectType, "valueOf", path :: Nil,
returnNullable = false)
+ createDeserializerForTypesSupportValueOf(path,
+ classOf[java.lang.Boolean])
case t if t <:< localTypeOf[java.sql.Date] =>
- StaticInvoke(
- DateTimeUtils.getClass,
- ObjectType(classOf[java.sql.Date]),
- "toJavaDate",
- path :: Nil,
- returnNullable = false)
+ createDeserializerForSqlDate(path)
case t if t <:< localTypeOf[java.sql.Timestamp] =>
- StaticInvoke(
- DateTimeUtils.getClass,
- ObjectType(classOf[java.sql.Timestamp]),
- "toJavaTimestamp",
- path :: Nil,
- returnNullable = false)
+ createDeserializerForSqlTimestamp(path)
case t if t <:< localTypeOf[java.lang.String] =>
- Invoke(path, "toString", ObjectType(classOf[String]), returnNullable =
false)
+ createDeserializerForString(path, returnNullable = false)
case t if t <:< localTypeOf[java.math.BigDecimal] =>
- Invoke(path, "toJavaBigDecimal",
ObjectType(classOf[java.math.BigDecimal]),
- returnNullable = false)
+ createDeserializerForJavaBigDecimal(path, returnNullable = false)
Review comment:
`createDeserializerForJavaBigInteger`, too.
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on 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]