danny0405 commented on code in PR #11585: URL: https://github.com/apache/hudi/pull/11585#discussion_r1668273223
########## hudi-common/src/main/java/org/apache/hudi/avro/AvroSchemaUtils.java: ########## @@ -302,9 +306,17 @@ private static Schema appendFieldsToSchemaBase(Schema schema, List<Schema.Field> * @return schema with fields from fields, and metadata from schema */ public static Schema createNewSchemaFromFieldsWithReference(Schema schema, List<Schema.Field> fields) { + if (schema == null) { + throw new IllegalArgumentException("Schema must not be null"); + } Schema newSchema = Schema.createRecord(schema.getName(), schema.getDoc(), schema.getNamespace(), schema.isError()); - for (Map.Entry<String, Object> prop : schema.getObjectProps().entrySet()) { - newSchema.addProp(prop.getKey(), prop.getValue()); + Map<String, Object> schemaProps = schema.getObjectProps(); + if (schemaProps != null) { + for (Map.Entry<String, Object> prop : schemaProps.entrySet()) { + newSchema.addProp(prop.getKey(), prop.getValue()); + } + } else { + LOG.warn("Schema.getObjectProps() returned null for schema: {}", schema); Review Comment: Yeah, I found the doc mentioned the attributes: https://avro.apache.org/docs/1.11.1/specification/#schema-declaration, it should not affect the serialization/deserialization, but it doesn't say how it is affected. -- 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: commits-unsubscr...@hudi.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org