shardulm94 commented on code in PR #37191:
URL: https://github.com/apache/spark/pull/37191#discussion_r921763332
##########
connector/avro/src/main/scala/org/apache/spark/sql/avro/AvroOutputWriterFactory.scala:
##########
@@ -36,7 +36,8 @@ private[sql] class AvroOutputWriterFactory(
avroSchemaAsJsonString: String,
positionalFieldMatching: Boolean) extends OutputWriterFactory {
- private lazy val avroSchema = new
Schema.Parser().parse(avroSchemaAsJsonString)
+ private lazy val avroSchema =
+ new
Schema.Parser().setValidateDefaults(false).parse(avroSchemaAsJsonString)
Review Comment:
I think, we should only disable validation when parsing Avro schemas coming
from files already written previously. This allows us to read files written
before Avro 1.9. The Avro project also made this change in Avro 1.10.2
https://github.com/apache/avro/pull/966
However here, we are writing a new file. I don't think we should allow
writing files with invalid defaults.
--
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]