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
[CALCITE-3845] CASE WHEN expression with nullability CAST is considered as reduced wrongly in ReduceExpressionsRule #1848
Conversation
28d7154
to
0746873
Compare
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.
+1
LGTM |
@@ -302,6 +302,7 @@ public ProjectReduceExpressionsRule(Class<? extends Project> projectClass, | |||
Lists.newArrayList(project.getProjects()); | |||
if (reduceExpressions(project, expList, predicates, false, | |||
matchNullability)) { | |||
assert !project.getProjects().equals(expList); |
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.
Can you please add a message, so the failure looks human-readable?
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.
Ok. Will do.
final RexNode caseRexNode = rexBuilder.makeCall(SqlStdOperatorTable.CASE, | ||
rexBuilder.makeCall(SqlStdOperatorTable.EQUALS, | ||
rexBuilder.makeCall(SqlStdOperatorTable.MOD, ref, literal2), literal1), | ||
rexBuilder.makeCall(SqlStdOperatorTable.LESS_THAN, ref, literal2), | ||
rexBuilder.makeCall(SqlStdOperatorTable.EQUALS, | ||
rexBuilder.makeCall(SqlStdOperatorTable.MOD, ref, literal3), literal2), | ||
rexBuilder.makeCall(SqlStdOperatorTable.LESS_THAN, ref, literal1), | ||
rexBuilder.makeCall(SqlStdOperatorTable.LESS_THAN, ref, literal3)); |
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.
This looks way too verbose :-/
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.
I wish I can provide a more simple case, but I cannot. Because CASE WHEN will be changed to OR in many cases and thus it will not reproduce the issue.
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.
What I mean is signal to noise ratio leaves much to be desired here.
The dance of rexBuilder.makeCall(SqlStdOperatorTable
repeats again and again :(
…ed as reduced wrongly in ReduceExpressionsRule
JIRA: https://issues.apache.org/jira/browse/CALCITE-3845