You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hudi.apache.org by GitBox <gi...@apache.org> on 2022/04/13 03:17:57 UTC

[GitHub] [hudi] danny0405 commented on a diff in pull request #5201: [HUDI-3748] write and select hudi table when enable hoodie.datasource.write.drop.partition.columns

danny0405 commented on code in PR #5201:
URL: https://github.com/apache/hudi/pull/5201#discussion_r849035284


##########
hudi-common/src/main/java/org/apache/hudi/avro/HoodieAvroUtils.java:
##########
@@ -164,6 +164,18 @@ public static GenericRecord jsonBytesToAvro(byte[] bytes, Schema schema) throws
     return reader.read(null, jsonDecoder);
   }
 
+  /**
+   * True if the schema contains this name of field
+   */
+  public static boolean containsFieldInSchema(Schema schema, String fieldName) {
+    try {
+      Field field = schema.getField(fieldName);
+      return field != null;
+    } catch (Exception e) {
+      return false;
+    }

Review Comment:
   What is the philosophy to return `false` when exception throws ? And do we need such a method for this simple calling ?



-- 
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-unsubscribe@hudi.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org