vlsi commented on a change in pull request #1610: [CALCITE-3525] RexSimplify:
eliminate redundant rex calls in OR
URL: https://github.com/apache/calcite/pull/1610#discussion_r358262236
##########
File path: core/src/main/java/org/apache/calcite/rex/RexExecutable.java
##########
@@ -85,7 +85,7 @@ public void reduce(RexBuilder rexBuilder, List<RexNode>
constExps,
reducedValues.add(
rexBuilder.makeLiteral(value.right, value.left.getType(), true));
}
- } catch (RuntimeException e) {
+ } catch (RuntimeException | AssertionError e) {
Review comment:
Technically speaking, `throw AssertionError` was added by Julian 7 years or
so ago:
https://github.com/apache/calcite/blob/571731b80a58eb095ebac7123285c375e7afff90/core/src/main/java/org/apache/calcite/rex/RexBuilder.java#L1487-L1488
I'm inlined that `IllegalArgumentException` works better there. @zabetak ,
@julianhyde , any thoughts?
In other words, I suppose that "AssertionError == something weird has
happened", and "IllegalArgumentException == it worked as designed, but the
argument value is wrong".
The sad thing altering the exception type might break the backward
compatibility (e.g. third-party code might rely on `catch AssertionError` from
`makeLiteral`).
So, to move this PR forward, I suggest: we leave `catch AssertionError`
here, add a code comment that explains why `AssertionError` needs be here and
add a TODO item to `makeLiteral` to refactor AssertionError into
`IllegalArgument` or something like that.
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
[email protected]
With regards,
Apache Git Services