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

New CASE statement simplification

    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 1.9.0
    • 1.18.0
    • core
    • None

    Description

      Another possible simplification for CASE statements that return boolean values.

      CASE
       WHEN p1 THEN e1
       WHEN p2 THEN e2
       ELSE TRUE
      END
      

      where e1...en are boolean expressions, can be rewritten into:

      (p1 and e1) or (p2 and e2 and not(p1)) or (not(p1) and not(p2))
      

      if p1...pn cannot be nullable.

      Attachments

        Issue Links

          Activity

            People

              kgyrtkirk Zoltan Haindrich
              jcamacho Jesús Camacho Rodríguez
              Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: