gengliangwang commented on code in PR #49590:
URL: https://github.com/apache/spark/pull/49590#discussion_r1927991417
##########
sql/core/src/main/scala/org/apache/spark/sql/avro/AvroSerializer.scala:
##########
@@ -282,11 +284,20 @@ private[sql] class AvroSerializer(
}.toArray.unzip
val numFields = catalystStruct.length
+ val avroFields = avroStruct.getFields()
row: InternalRow =>
val result = new Record(avroStruct)
var i = 0
while (i < numFields) {
if (row.isNullAt(i)) {
+ val avroField = avroFields.get(i)
+ if (!avroField.schema().isNullable) {
Review Comment:
Shall we put this nullable info in an array outside the lambda? So that we
can simply check
```
if isSchemaNullable(i)
```
--
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]