cloud-fan commented on code in PR #41052:
URL: https://github.com/apache/spark/pull/41052#discussion_r1185670376
##########
connector/avro/src/main/scala/org/apache/spark/sql/avro/AvroDeserializer.scala:
##########
@@ -117,6 +118,20 @@ private[sql] class AvroDeserializer(
val incompatibleMsg = errorPrefix +
s"schema is incompatible (avroType = $avroType, sqlType =
${catalystType.sql})"
+ val realDataType = SchemaConverters.toSqlType(avroType).dataType
+ val confKey =
SQLConf.LEGACY_AVRO_PREVENT_READING_INCORRECT_SAME_ENCODED_TYPES
+ val preventReadingIncorrectType = SQLConf.get.getConf(confKey)
+ def isNotExactType: Boolean = {
+ preventReadingIncorrectType && !realDataType.acceptsType(catalystType)
Review Comment:
It's weird to use `acceptsType` here, which is designed for expressions to
define the expected type. I think we should just use `DataTypeUtils.sameType`.
--
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]