in src/main/java/com/amazonaws/services/neptune/io/RecordSplitter.java [137:176]
private Collection<String> splitNeptuneStreamEvent(JsonNode jsonNode, int opNum) {
Collection<String> results = new ArrayList<>();
((ObjectNode) jsonNode.get("eventId")).replace("opNum", mapper.valueToTree(opNum));
String jsonString = jsonNode.toString();
int eventJsonLength = jsonString.length();
if (eventJsonLength > maxSize && largeStreamRecordHandlingStrategy.allowShred()) {
if (isProperytGraphEvent(jsonNode)) {
String value = jsonNode.get("data").get("value").get("value").textValue();
int maxStringLength = calculateStringMaxLength(maxSize, eventJsonLength, value.length());
Collection<String> splitValues = splitByLength(value, maxStringLength);
for (String splitValue : splitValues) {
((ObjectNode) jsonNode.get("eventId")).replace("opNum", mapper.valueToTree(opNum));
((ObjectNode) jsonNode.get("data").get("value")).replace("value", mapper.valueToTree(splitValue));
results.add(format(jsonNode.toString()));
opNum += 1;
}
} else {
String statement = jsonNode.get("data").get("stmt").textValue();
int statementLength = statement.length();
int maxStatementLength = calculateStringMaxLength(maxSize, eventJsonLength, statementLength);
handler.reset(statementLength, maxStatementLength);
try {
parser.parse(new StringReader(statement));
for (String splitStatement : handler.statements()) {
((ObjectNode) jsonNode.get("eventId")).replace("opNum", mapper.valueToTree(opNum));
((ObjectNode) jsonNode.get("data")).replace("stmt", mapper.valueToTree(splitStatement));
results.add(format(jsonNode.toString()));
opNum += 1;
}
} catch (IOException e) {
// What to do here?
results.add(format(jsonString));
}
}
} else {
results.add(format(jsonString));
}
return results;
}