[
https://issues.apache.org/jira/browse/CALCITE-2451?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16622361#comment-16622361
]
Julian Hyde edited comment on CALCITE-2451 at 9/20/18 5:17 PM:
---------------------------------------------------------------
I also tried this approach: simulating {{unknownAsFalse}} by wrapping
everything in {{... IS TRUE}}. The problem is that we now had to match an extra
level in the tree (e.g. matching "x < NULL" was a 2-deep tree, now we match "(x
< NULL) IS TRUE" which is a 3-deep tree), so the code got more complicated.
Also we had to add "IS TRUE" wrapper nodes on each call. Previously when
RexSimplify looked at an expression that was already simplified, it would do
close to zero object allocations when it returned the same result. With this
new approach there are a lot of object allocations.
Vladimir has proposed maintaining a table so that we know whether an expression
has already been simplified. I don't know whether that table would persist
while one expression is being simplified, or for a longer duration (say for the
whole of the optimization process). Either way, it adds a lot of weight.
RexSimplify becomes something fundamentally different, and I don't like it.
was (Author: julianhyde):
I also tried this approach: simulating {{unknownAsFalse}} by wrapping
everything in {{... IS TRUE}}. The problem is that we now had to match an extra
level in the tree (e.g. matching "x < NULL" was a 2-deep tree, now we match "(x
< NULL) IS TRUE" which is a 3-deep tree), so the code got more complicated.
Also we had to add "IS TRUE" wrapper nodes on each call. Previously when
RexSimplify looked at an expression that was already simplified, it would do
close to zero object allocations when it returned the same result. With this
new approach there are a lot of object allocations.
Vladimir has proposed maintaining a table so that we know whether an expression
has already been simplified. I don't know whether that table would persist
while one expression is being simplified, or for a longer duration (say for the
whole of the optimization process). Either way, it adds a lot of weight,
> RexSimplify: fuse unknownAsFalse and IS TRUE handling
> -----------------------------------------------------
>
> Key: CALCITE-2451
> URL: https://issues.apache.org/jira/browse/CALCITE-2451
> Project: Calcite
> Issue Type: Sub-task
> Components: core
> Affects Versions: 1.17.0
> Reporter: Vladimir Sitnikov
> Assignee: Julian Hyde
> Priority: Major
>
> It looks like {{unknownAsFalse}} duplicates {{IS_TRUE}} handling.
> In other words, {{withUnknownAsFalse(true). simplfy(expr)}} is more or less
> comparable to {{simplify(isTrue(expr))}}
> Implementing {{IS_TRUE/IS_FALSE/...}} simplification possibilities might make
> {{unknownAsFalse}} obsolete.
--
This message was sent by Atlassian JIRA
(v7.6.3#76005)