Skip to content

Commit

Permalink
Merge pull request #183 from chitara-01/b/310247478
Browse files Browse the repository at this point in the history
Updated logic to process array data types in parquet
  • Loading branch information
chitara-01 authored Nov 16, 2023
2 parents d02173f + 3c7ce08 commit 65fb1e4
Showing 1 changed file with 12 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -98,12 +98,19 @@ private void processType(Object value, Schema fieldSchema, String parentKey, Str
break;

case ARRAY:
List<?> arrayValues = (List<?>) value;
List<String> updatedValues = new ArrayList<>();
for (int index = 0; index < arrayValues.size(); index++) {
updatedValues.add(arrayValues.get(index).toString());
String listFieldKey =
isBlank(parentKey) ? fieldName : String.format("%s.%s", parentKey, fieldName);
if (value == null) {
putValue(listFieldKey, Value.newBuilder().getDefaultInstanceForType());
} else {
List<?> arrayValues = (List<?>) value;
List<String> updatedValues = new ArrayList<>();
for (int index = 0; index < arrayValues.size(); index++) {
updatedValues.add(arrayValues.get(index).toString());
}
putValue(
listFieldKey, Value.newBuilder().setStringValue(updatedValues.toString()).build());
}
putValue(parentKey, Value.newBuilder().setStringValue(updatedValues.toString()).build());
break;

case UNION:
Expand Down

0 comments on commit 65fb1e4

Please sign in to comment.