-
Notifications
You must be signed in to change notification settings - Fork 2.9k
NIFI-15474 Support timestamp truncation in RecordPath DSL #10796
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
Conversation
pvillard31
left a comment
There was a problem hiding this 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
| final FieldValue lhs = lhsPath.evaluate(context).findFirst().orElseThrow(); | ||
| final FieldValue rhs = rhsPath.evaluate(context).findFirst().orElseThrow(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| 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")); |
| final FieldValue lhs = lhsPath.evaluate(context).findFirst().orElseThrow(); | ||
| final FieldValue rhs = rhsPath.evaluate(context).findFirst().orElseThrow(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| 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) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| entry("floatNumber", 123.45) | |
| entry("floatNumber", 123.45f) |
| public class MathDivideOperator implements MathBinaryOperator { | ||
| @Override | ||
| public Long operate(Long n, Long m) { | ||
| return n / m; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| 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; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| return n / m; | |
| if (m == 0.0) { | |
| throw new ArithmeticException("Division by zero in RecordPath divide function"); | |
| } | |
| return n / m; |
5121695 to
74ce039
Compare
74ce039 to
52af40d
Compare
|
thanks @pvillard31 - I have applied the suggested changes with additional tests |
Summary
NIFI-15474
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