nsivabalan commented on code in PR #11585:
URL: https://github.com/apache/hudi/pull/11585#discussion_r1667798215


##########
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:
   do we even need to log a warn ? 



-- 
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

Reply via email to