Skip to content

Conversation

@r1b
Copy link
Contributor

@r1b r1b commented Jan 22, 2026

Summary

NIFI-15474

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

Copy link
Contributor

@pvillard31 pvillard31 left a comment

Choose a reason for hiding this comment

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

LGTM, left some minor comments

Comment on lines 39 to 40
final FieldValue lhs = lhsPath.evaluate(context).findFirst().orElseThrow();
final FieldValue rhs = rhsPath.evaluate(context).findFirst().orElseThrow();
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
final FieldValue lhs = lhsPath.evaluate(context).findFirst().orElseThrow();
final FieldValue rhs = rhsPath.evaluate(context).findFirst().orElseThrow();
final FieldValue lhs = lhsPath.evaluate(context).findFirst()
.orElseThrow(() -> new IllegalArgumentException("divide function requires a left-hand operand"));
final FieldValue rhs = rhsPath.evaluate(context).findFirst()
.orElseThrow(() -> new IllegalArgumentException("divide function requires a right-hand operand"));

Comment on lines 39 to 40
final FieldValue lhs = lhsPath.evaluate(context).findFirst().orElseThrow();
final FieldValue rhs = rhsPath.evaluate(context).findFirst().orElseThrow();
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
final FieldValue lhs = lhsPath.evaluate(context).findFirst().orElseThrow();
final FieldValue rhs = rhsPath.evaluate(context).findFirst().orElseThrow();
final FieldValue lhs = lhsPath.evaluate(context).findFirst()
.orElseThrow(() -> new IllegalArgumentException("multiply function requires a left-hand operand"));
final FieldValue rhs = rhsPath.evaluate(context).findFirst()
.orElseThrow(() -> new IllegalArgumentException("multiply function requires a right-hand operand"));

entry("longNumber", 1234567890123456789L)
entry("shortNumber", (short) 123),
entry("longNumber", 1234567890123456789L),
entry("floatNumber", 123.45)
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
entry("floatNumber", 123.45)
entry("floatNumber", 123.45f)

public class MathDivideOperator implements MathBinaryOperator {
@Override
public Long operate(Long n, Long m) {
return n / m;
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
return n / m;
if (m == 0L) {
throw new ArithmeticException("Division by zero in RecordPath divide function");
}
return n / m;


@Override
public Double operate(Double n, Double m) {
return n / m;
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
return n / m;
if (m == 0.0) {
throw new ArithmeticException("Division by zero in RecordPath divide function");
}
return n / m;

@r1b r1b force-pushed the feat/recordpath-ts-truncation branch 2 times, most recently from 5121695 to 74ce039 Compare January 30, 2026 23:11
@r1b r1b force-pushed the feat/recordpath-ts-truncation branch from 74ce039 to 52af40d Compare January 30, 2026 23:27
@r1b
Copy link
Contributor Author

r1b commented Jan 30, 2026

thanks @pvillard31 - I have applied the suggested changes with additional tests

@r1b r1b requested a review from pvillard31 January 30, 2026 23:36
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.

2 participants