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


##########
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:
   At the same time, I think the logic of converting float to double(for float, 
`case x: NumericType` is matched, and then `toDouble` is called directly) in 
our cast expression is also worth discussing the implementation, which is 
similar to this problem.
   
   
https://github.com/apache/spark/blob/6d32472b2a4225bd847953a679d3be2b077d212e/sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/expressions/Cast.scala#L1008-L1031



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