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 2020/01/03 23:44:36 UTC

[GitHub] [incubator-hudi] n3nash commented on a change in pull request #1154: [HUDI-406] Added default partition path in TimestampBasedKeyGenerator

n3nash commented on a change in pull request #1154: [HUDI-406] Added default partition path in TimestampBasedKeyGenerator
URL: https://github.com/apache/incubator-hudi/pull/1154#discussion_r362995932
 
 

 ##########
 File path: hudi-spark/src/main/java/org/apache/hudi/DataSourceUtils.java
 ##########
 @@ -52,29 +52,18 @@
  */
 public class DataSourceUtils {
 
-  /**
-   * Obtain value of the provided nullable field as string, denoted by dot notation. e.g: a.b.c
-   */
-  public static String getNullableNestedFieldValAsString(GenericRecord record, String fieldName) {
-    try {
-      return getNestedFieldValAsString(record, fieldName);
-    } catch (HoodieException e) {
-      return null;
-    }
-  }
-
   /**
    * Obtain value of the provided field as string, denoted by dot notation. e.g: a.b.c
    */
-  public static String getNestedFieldValAsString(GenericRecord record, String fieldName) {
-    Object obj = getNestedFieldVal(record, fieldName);
-    return obj.toString();
+  public static String getNestedFieldValAsString(GenericRecord record, String fieldName, boolean returnNullIfNotFound) {
+    Object obj = getNestedFieldVal(record, fieldName, returnNullIfNotFound);
+    return (obj == null) ? null : obj.toString();
 
 Review comment:
   can we do (obj == null) ? obj : obj.toString() ?

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services