Uploaded image for project: 'Calcite'
  1. Calcite
  2. CALCITE-2449

RexSimplify overhaul

    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Open
    • Major
    • Resolution: Unresolved
    • 1.17.0
    • None
    • core
    • None

    Description

      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)

      Attachments

        Issue Links

          Activity

            People

              Unassigned Unassigned
              vladimirsitnikov Vladimir Sitnikov
              Votes:
              0 Vote for this issue
              Watchers:
              7 Start watching this issue

              Dates

                Created:
                Updated:

                Time Tracking

                  Estimated:
                  Original Estimate - Not Specified
                  Not Specified
                  Remaining:
                  Remaining Estimate - 0h
                  0h
                  Logged:
                  Time Spent - 5h 50m
                  5h 50m