Skip to content

NIFI-14861 Add EnrichGraphRecord processor#11316

Open
tpalfy wants to merge 2 commits into
apache:mainfrom
tpalfy:NIFI-14861-EnrichGraphRecord
Open

NIFI-14861 Add EnrichGraphRecord processor#11316
tpalfy wants to merge 2 commits into
apache:mainfrom
tpalfy:NIFI-14861-EnrichGraphRecord

Conversation

@tpalfy

@tpalfy tpalfy commented Jun 8, 2026

Copy link
Copy Markdown
Contributor

Summary

NIFI-14861

Tracking

Please complete the following tracking steps prior to pull request creation.

Issue Tracking

Pull Request Tracking

  • Pull Request title starts with Apache NiFi Jira issue number, such as NIFI-00000
  • Pull Request commit message starts with Apache NiFi Jira issue number, as such NIFI-00000
  • Pull request contains commits signed with a registered key indicating Verified status

Pull Request Formatting

  • Pull Request based on current revision of the main branch
  • Pull Request refers to a feature branch with one commit containing changes

Verification

Please indicate the verification steps performed prior to pull request creation.

Build

  • Build completed using ./mvnw clean install -P contrib-check
    • JDK 21
    • JDK 25

Licensing

  • New dependencies are compatible with the Apache License 2.0 according to the License Policy
  • New dependencies are documented in applicable LICENSE and NOTICE files

Documentation

  • Documentation formatting appears as expected in rendered files

throw new IOException("Identifier field(s) not found in record, check the RecordPath expression");
}

final LinkedHashMap<String, Object> identifierFieldNameToValue = new LinkedHashMap<>(identifierFieldValues.size());

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I believe PMD is complaining that the assignment should be to an interface

Suggested change
final LinkedHashMap<String, Object> identifierFieldNameToValue = new LinkedHashMap<>(identifierFieldValues.size());
final Map<String, Object> identifierFieldNameToValue = new LinkedHashMap<>(identifierFieldValues.size());

@hleonps hleonps left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for working on this!

I left a comment related to value normalization. But everything else LGTM.

Comment on lines +422 to +440
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);
}

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i don't think those scenarios are supported in graph databases.
not in neo4j at least.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants