pratyakshsharma 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_r363037760
##########
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:
The return type is String for this function. That is why I am returning null
over here. If I change it to (obj == null) ? obj : obj.toString(), it throws
compile time error since obj is just an object.
----------------------------------------------------------------
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:
[email protected]
With regards,
Apache Git Services