1
0

Support nested types for recordKey, partitionPath and combineKey

This commit is contained in:
Balaji Varadarajan
2019-05-14 19:59:04 -07:00
committed by vinoth chandar
parent e43efa042f
commit a7e6cf5197
3 changed files with 12 additions and 4 deletions

View File

@@ -53,6 +53,14 @@ public class DataSourceUtils {
* 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 == null) ? null : obj.toString();
}
/**
* Obtain value of the provided field, denoted by dot notation. e.g: a.b.c
*/
public static Object getNestedFieldVal(GenericRecord record, String fieldName) {
String[] parts = fieldName.split("\\.");
GenericRecord valueNode = record;
int i = 0;
@@ -65,7 +73,7 @@ public class DataSourceUtils {
// return, if last part of name
if (i == parts.length - 1) {
return val.toString();
return val;
} else {
// VC: Need a test here
if (!(val instanceof GenericRecord)) {