rubenada commented on code in PR #5228:
URL: https://github.com/apache/calcite/pull/5228#discussion_r3878890222
##########
core/src/main/java/org/apache/calcite/rex/RexSimplify.java:
##########
@@ -1614,16 +1635,23 @@ private boolean isSafe(RexCall call, boolean deep) {
SqlKind sqlKind = call.getKind();
SqlOperator sqlOperator = call.getOperator();
- if (SqlKind.CHECKED_ARITHMETIC.contains(sqlKind)) {
- // Checked arithmetic throws on overflow, so it is only safe when the
- // arithmetic is never performed, i.e. when an operand is NULL.
+ if (SqlKind.CHECKED_ARITHMETIC.contains(sqlKind)
Review Comment:
I agree this system looks a bit ad-hoc, but it is the one we have in place
(until we decide a big re-work on this mechanism).
Theoretically a third party can add new operators and override the
`SqlOperator#isSafeOperator` method, which gets evaluated here; but it doesn't
seem too powerful since it cannot inspect arguments. Perhaps a new method that
would allow to evaluate the whole call (including arguments) would be better
(but that would be out of the scope of the current PR).
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]