NIFI-14861 Add EnrichGraphRecord processor#11316
Conversation
| throw new IOException("Identifier field(s) not found in record, check the RecordPath expression"); | ||
| } | ||
|
|
||
| final LinkedHashMap<String, Object> identifierFieldNameToValue = new LinkedHashMap<>(identifierFieldValues.size()); |
There was a problem hiding this comment.
I believe PMD is complaining that the assignment should be to an interface
| final LinkedHashMap<String, Object> identifierFieldNameToValue = new LinkedHashMap<>(identifierFieldValues.size()); | |
| final Map<String, Object> identifierFieldNameToValue = new LinkedHashMap<>(identifierFieldValues.size()); |
| if (RecordFieldType.ARRAY.equals(rawFieldType)) { | ||
| final DataType arrayElementDataType = ((ArrayDataType) rawDataType).getElementType(); | ||
| if (RecordFieldType.RECORD.getDataType().equals(arrayElementDataType)) { | ||
| final Object[] rawValueArray = (Object[]) rawValue; | ||
| final Object[] mappedValueArray = new Object[rawValueArray.length]; | ||
| for (int index = 0; index < rawValueArray.length; index++) { | ||
| final MapRecord mapRecord = (MapRecord) rawValueArray[index]; | ||
| mappedValueArray[index] = mapRecord.toMap(true); | ||
| } | ||
| return mappedValueArray; | ||
| } | ||
|
|
||
| return rawValue; | ||
| } | ||
|
|
||
| if (RecordFieldType.RECORD.equals(rawFieldType)) { | ||
| final MapRecord mapRecord = (MapRecord) rawValue; | ||
| return mapRecord.toMap(true); | ||
| } |
There was a problem hiding this comment.
Normalization won't work if the record have a nested array. The record could be normalized recursively to avoid the same problem in deeper levels of nesting.
There was a problem hiding this comment.
i don't think those scenarios are supported in graph databases.
not in neo4j at least.
There was a problem hiding this comment.
on second thought, handling deeply nested values have a particular benefit. while not a useful feature on it's own, it let's us delegate to the underlying database to report it's domain-specifc error instead of crash in nifi.
I'll add it.
| @Test | ||
| void testGenerateSetPropertiesMutationForNode() { | ||
| final Neo4JCypherQueryGeneratorService service = new Neo4JCypherQueryGeneratorService(); | ||
| final LinkedHashMap<String, Object> identifiers = new LinkedHashMap<>(); |
There was a problem hiding this comment.
When running with -Pcontrib-check I get 4 PMD violations for using LinkedHashMap instead of Map
There was a problem hiding this comment.
This was addressed already in an earlier comment.
hleonps
left a comment
There was a problem hiding this comment.
Code is working as expected. The type validation is delegated to the database instead of NiFi as expected.
Fixing the PMD violations is the only thing pending.
|
With my data I got the following errors, but it might just be a problem with the input: |
Neo4J doesn't support nested values as edge/node properties. |
Summary
NIFI-14861
Tracking
Please complete the following tracking steps prior to pull request creation.
Issue Tracking
Pull Request Tracking
NIFI-00000NIFI-00000VerifiedstatusPull Request Formatting
mainbranchVerification
Please indicate the verification steps performed prior to pull request creation.
Build
./mvnw clean install -P contrib-checkLicensing
LICENSEandNOTICEfilesDocumentation