cloud-fan 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_r259704058
##########
File path:
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/JavaTypeInference.scala
##########
@@ -300,25 +317,26 @@ object JavaTypeInference {
returnNullable = false)
case other if other.isEnum =>
- StaticInvoke(
- other,
- ObjectType(other),
- "valueOf",
- Invoke(path, "toString", ObjectType(classOf[String]), returnNullable
= false) :: Nil,
- returnNullable = false)
+ createDeserializerForTypesSupportValueOf(
+ createDeserializerForString(path, returnNullable = false),
+ other)
case other =>
val properties = getJavaBeanReadableAndWritableProperties(other)
val setters = properties.map { p =>
val fieldName = p.getName
val fieldType = typeToken.method(p.getReadMethod).getReturnType
- val (_, nullable) = inferDataType(fieldType)
- val constructor = deserializerFor(fieldType, addToPath(fieldName))
- val setter = if (nullable) {
- constructor
- } else {
- AssertNotNull(constructor, Seq("currently no type path record in
java"))
- }
+ val (dataType, nullable) = inferDataType(fieldType)
+ val newTypePath =
+ s"""- field (class: "${fieldType.getType.getTypeName}",
+ |name: "$fieldName")""".stripMargin +: walkedTypePath
Review comment:
ditto
----------------------------------------------------------------
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]