Vladimir Sitnikov created CALCITE-2449:
------------------------------------------

             Summary: RexSimplify overhaul
                 Key: CALCITE-2449
                 URL: https://issues.apache.org/jira/browse/CALCITE-2449
             Project: Calcite
          Issue Type: Improvement
          Components: core
    Affects Versions: 1.17.0
            Reporter: Vladimir Sitnikov
            Assignee: Julian Hyde


I would like to update \{{RexSimplify}} as follows:

1) Avoid multiple passes over the same expressions. Current logic calls 
"simplify" in multiple places, and it might cause simplification of the same 
tree again and again.

2) I would like to rework \{{unknownAsFalse}} into support for \{{IS TRUE}}. 
Current support for \{{unknownAsFalse}} is hard to follow, and it looks like 
IS_TRUE(expr) allows for the same optimizations. In other words, 
"unknownAsFalse" would become a silent adding of IS_TRUE on top of the input 
expression. Then rules like \{{OR(x, y) IS TRUE ==> x IS TRUE or y IS TRUE}} 
would push \{{IS TRUE}} downstream.

3) I would like to "reorder" predicates in a defined order (e.g. rewrite \{{5=x 
==> x=5}} or \{{(x=1 or y=2) and (z=3)}} ==> \{{(z=3) and (x=1 or y=2)}}. It 
looks like adding \{{int nodeCount;}} to \{{RexNode}} would be helpful to rank 
rex nodes.

4) There are other bugs identified by expression fuzzer (like {{and(null, 
not(null))}} conversion to true and so on)



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Reply via email to