zeruibao commented on code in PR #41052:
URL: https://github.com/apache/spark/pull/41052#discussion_r1277762673


##########
connector/avro/src/main/scala/org/apache/spark/sql/avro/AvroDeserializer.scala:
##########
@@ -117,6 +119,10 @@ 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_ALLOW_INCOMPATIBLE_SCHEMA
+    val preventReadingIncorrectType = !SQLConf.get.getConf(confKey)
+
     (avroType.getType, catalystType) match {

Review Comment:
   Hi @gengliangwang and @cloud-fan, I receive a ticket about the performance 
slowdown on avro reader because of this PR. 
https://databricks.atlassian.net/browse/ES-761029. In this PR, to make code 
more readable, we turn one match-case statement into nested match-case 
statement which slows down the AvroDeserializer. Do you think we should revert 
this code structure?



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