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


##########
connector/avro/src/main/scala/org/apache/spark/sql/avro/AvroDeserializer.scala:
##########
@@ -194,6 +200,9 @@ private[sql] class AvroDeserializer(
       case (FLOAT, FloatType) => (updater, ordinal, value) =>
         updater.setFloat(ordinal, value.asInstanceOf[Float])
 
+      case (FLOAT, DoubleType) => (updater, ordinal, value) =>
+        updater.setDouble(ordinal, value.asInstanceOf[Float].toString.toDouble)

Review Comment:
   @cloud-fan  I made a change here. 
   
   When it comes to converting maximum or minimum values ​​from float to 
double, if using the implicit toDouble directly, the result will not meet 
expectations. For example, the difference in the result is actually a very 
large number.
   
   
![image](https://github.com/user-attachments/assets/ee42baf4-a6cf-4dee-9579-6b5382c8bc6f)
   
   And I think this problem is also faced in the processing of parquet.
   
https://github.com/apache/spark/blob/d431d4034219f2c84c105e1894eebe03745bf105/sql/core/src/main/scala/org/apache/spark/sql/execution/datasources/parquet/ParquetRowConverter.scala#L330



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