Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

NIFI-12704 Support record root reference in function arguments #8450

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

EndzeitBegins
Copy link
Contributor

@EndzeitBegins EndzeitBegins commented Feb 25, 2024

Summary

Add support for references to the record root in functions.

NIFI-12704

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 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 mvn clean install -P contrib-check
    • JDK 21

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

@EndzeitBegins EndzeitBegins marked this pull request as ready for review February 25, 2024 10:32
Comment on lines +2071 to +2218
private static FieldValue evaluateSingleFieldValue(RecordPath recordPath, Record record) {
return recordPath.evaluate(record).getSelectedFields().findFirst().get();
}

private static FieldValue evaluateSingleFieldValue(String path, Record record) {
return evaluateSingleFieldValue(RecordPath.compile(path), record);
}
Copy link
Contributor

Choose a reason for hiding this comment

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

@EndzeitBegins I appreciate you adding these methods and the unit test testRecordRootReferenceInFunction to exercise the bug you fixed but all the other changes just to use these method(s) do not relate to this ticket. Can you please create a follow on ticket and make those changes with these methods? It makes reviewing the code much easier. Thanks!

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thank you for the feedback @dan-s1.

That's why I split the PR into two commits. But you're right that the PR should be focused on the required changes only.
I reduced this PR to a single commit with just the changes needed.
I'd appreciate a review.

I might open a separate PR for the test refactorings.

Copy link
Contributor

Choose a reason for hiding this comment

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

@EndzeitBegins This looks good to me but I would like @markap14 final word on this. @markap14 can you please take a look at this PR to ensure the logic here is correct? Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants