Skip to content

Commit

Permalink
Handling array values in Neptune node (#2095)
Browse files Browse the repository at this point in the history
  • Loading branch information
Trianz-Akshay authored Jul 31, 2024
1 parent c9be4f5 commit 21a6e11
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@
import java.util.Date;
import java.util.Map;
import java.util.TreeMap;
import java.util.stream.Collectors;

/**
* This class is a Utility class to create Extractors for each field type as per
Expand Down Expand Up @@ -124,7 +125,14 @@ else if (fieldValue instanceof ArrayList) {
else if (fieldValue instanceof ArrayList) {
ArrayList<Object> objValues = (ArrayList) fieldValue;
if (objValues != null && objValues.get(0) != null) {
value.value = objValues.get(0).toString();
if (objValues.size() > 1) {
value.value = String.join(";", objValues.stream()
.map(Object::toString)
.collect(Collectors.toList()));
}
else {
value.value = objValues.get(0).toString();
}
value.isSet = 1;
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@
import java.util.Date;
import java.util.Map;
import java.util.TreeMap;
import java.util.stream.Collectors;

/**
* This class is a Utility class to create Extractors for each field type as per
Expand Down Expand Up @@ -96,8 +97,15 @@ public static void writeRowTemplate(RowWriterBuilder rowWriterBuilder, Field fie
}
else {
ArrayList<Object> objValues = (ArrayList) obj.get(fieldName);
if (objValues != null && objValues.get(0) != null) {
value.value = objValues.get(0).toString();
if (objValues != null && !objValues.isEmpty()) {
if (objValues.size() > 1) {
value.value = String.join(";", objValues.stream()
.map(Object::toString)
.collect(Collectors.toList()));
}
else {
value.value = objValues.get(0).toString();
}
value.isSet = 1;
}
}
Expand Down

0 comments on commit 21a6e11

Please sign in to comment.