wayneguow commented on code in PR #47651:
URL: https://github.com/apache/spark/pull/47651#discussion_r1717343527


##########
connector/avro/src/main/scala/org/apache/spark/sql/avro/AvroDeserializer.scala:
##########
@@ -386,14 +386,46 @@ private[sql] class AvroDeserializer(
       case (LONG, _: DayTimeIntervalType) => (updater, ordinal, value) =>
         updater.setLong(ordinal, value.asInstanceOf[Long])
 
-      case (LONG, _: DecimalType) => (updater, ordinal, value) =>
-        val d = avroType.getLogicalType.asInstanceOf[CustomDecimal]
-        updater.setDecimal(ordinal, Decimal(value.asInstanceOf[Long], 
d.precision, d.scale))
+      case (INT, dt: DecimalType) => avroType.getLogicalType match {
+        case null =>

Review Comment:
   In addition to supporting the use of widened DecimalType to read int and 
long; I also refer to the previously customized decimal logic type #41409 to 
read long, which is also supported when reading int.
   
   If you think that these two parts are not suitable to be placed in one PR, I 
can seperate them apart.



-- 
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.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


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

Reply via email to