You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@calcite.apache.org by GitBox <gi...@apache.org> on 2019/02/14 13:43:46 UTC
[GitHub] vlsi commented on a change in pull request #1044: [CALCITE-2838] Simplification: Remove redundant IS TRUE/IS NOT FALSE …
vlsi commented on a change in pull request #1044: [CALCITE-2838] Simplification: Remove redundant IS TRUE/IS NOT FALSE …
URL: https://github.com/apache/calcite/pull/1044#discussion_r256836978
##########
File path: core/src/main/java/org/apache/calcite/rex/RexSimplify.java
##########
@@ -494,10 +494,16 @@ private RexNode simplifyNot(RexCall call, RexUnknownAs unknownAs) {
return call;
}
- private RexNode simplifyIs(RexCall call) {
+ private RexNode simplifyIs(RexCall call, RexUnknownAs unknownAs) {
final SqlKind kind = call.getKind();
- final RexNode a = call.getOperands().get(0);
-
+ final RexNode argument = call.getOperands().get(0);
+ if (kind == SqlKind.IS_TRUE && unknownAs == RexUnknownAs.FALSE) {
+ return simplify(argument, unknownAs);
+ }
+ if (kind == SqlKind.IS_NOT_FALSE && unknownAs == RexUnknownAs.TRUE) {
+ return simplify(argument, unknownAs);
+ }
+ final RexNode a = simplify(call.getOperands().get(0), RexUnknownAs.UNKNOWN);
Review comment:
This does look like `O(N^2)`.
Can you please avoid simplifying the same nodes again and again?
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
With regards,
Apache Git Services