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

Simplification: push negation into Case expression

VotersWatch issueWatchersLinkCloneUpdate Comment AuthorReplace String in CommentUpdate Comment VisibilityDelete Comments
    XMLWordPrintableJSON

    Details

    • Type: Improvement
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 1.19.0
    • Component/s: None

      Description

      Why would this be usefull?

      • right now a boolean CASE expressions are translated into AND/ORs in most cases ; "disjunction of conjuctions"
      • AND/OR simplification could "push" the NOT into them; but only after the CASE conversion; so the expression becames a "conjunction of disjunctions" and all the other simplification rules are working hard to restore order....
      • if the push of NOT would happen earlier it would be better because it could address complex cases better
        @Test public void testNotIntoCase() {
          checkSimplify(
              not(
                  case_(
                      isTrue(vBool()), vBool(1),
                      vBool(2))),
              "CASE(IS TRUE(?0.bool0), NOT(?0.bool1), NOT(?0.bool2))");
        }
      

      actually NOT right now stops the simplification recursion so it would be best to also enable that as well; in case NOT is not is not pushed/handled - unknownAs need to be negated.

       @Test public void testNotRecursion() {
          checkSimplify(
              not(coalesce(nullBool, trueLiteral)),
              "false");
        }
      

        Attachments

          Activity

            People

            • Assignee:
              kgyrtkirk Zoltan Haindrich
              Reporter:
              kgyrtkirk Zoltan Haindrich

              Dates

              • Created:
                Updated:
                Resolved:

                Time Tracking

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

                  Issue deployment