codope commented on code in PR #11585: URL: https://github.com/apache/hudi/pull/11585#discussion_r1667874668
########## 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: Schema has fields but no props. Throwing error would result in the same failure. The props were copied in https://github.com/apache/hudi/commit/eb20273cf662158f7872004c5460748b9695a240. We need to understand what's the side-effect of not having props. I think schema fields should be sufficient. @jonvex can help clarify this point. > do we even need to log a warn ? Logging a warn for debugging purpose. -- 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