Ngone51 commented on a change in pull request #28572:
URL: https://github.com/apache/spark/pull/28572#discussion_r427146617
##########
File path:
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/DeserializerBuildHelper.scala
##########
@@ -161,6 +161,10 @@ object DeserializerBuildHelper {
case _: StructType => expr
case _: ArrayType => expr
case _: MapType => expr
+ case _: DecimalType =>
+ // For Scala/Java `BigDecimal`, we accept decimal types of any valid
precision/scale.
+ // Here we use the `DecimalType` object to indicate it.
+ UpCast(expr, DecimalType, walkedTypePath.getPaths)
Review comment:
It's for `semantic` purpose. `UpCast` could still mean to cast a value
to a concrete decimal type in this way while `object DecimalType` is an
exception for the encoder.
##########
File path:
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/DeserializerBuildHelper.scala
##########
@@ -161,6 +161,10 @@ object DeserializerBuildHelper {
case _: StructType => expr
case _: ArrayType => expr
case _: MapType => expr
+ case _: DecimalType =>
+ // For Scala/Java `BigDecimal`, we accept decimal types of any valid
precision/scale.
+ // Here we use the `DecimalType` object to indicate it.
+ UpCast(expr, DecimalType, walkedTypePath.getPaths)
Review comment:
It's for `semantic` purpose. `UpCast` could still mean to cast a value
to a concrete decimal type in this way while `object DecimalType` is only an
exception for the encoder.
----------------------------------------------------------------
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]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]