Github user viirya commented on a diff in the pull request:
https://github.com/apache/spark/pull/22151#discussion_r211243540
--- Diff:
external/avro/src/main/scala/org/apache/spark/sql/avro/AvroSerializer.scala ---
@@ -201,13 +201,11 @@ class AvroSerializer(rootCatalystType: DataType,
rootAvroType: Schema, nullable:
private def newStructConverter(
catalystStruct: StructType, avroStruct: Schema): InternalRow =>
Record = {
- if (avroStruct.getType != RECORD) {
+ if (avroStruct.getType != RECORD || avroStruct.getFields.size() !=
catalystStruct.length) {
throw new IncompatibleSchemaException(s"Cannot convert Catalyst type
$catalystStruct to " +
s"Avro type $avroStruct.")
}
- val avroFields = avroStruct.getFields
- assert(avroFields.size() == catalystStruct.length)
--- End diff --
Is this check redundant? Why remove it now?
---
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]