Uploaded image for project: 'Hive'
  1. Hive
  2. HIVE-25870

Avoid simplification in HivePointLookupOptimizerRule, convert only

    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Open
    • Major
    • Resolution: Unresolved
    • 4.0.0
    • None
    • CBO
    • None

    Description

      HivePointLookupOptimizerRule has been introduced to improve simplifications and improve statistics/estimations (see https://issues.apache.org/jira/browse/HIVE-11424?focusedCommentId=15197407&page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#comment-15197407).

      At the time, RexSimplify could not simplify such OR/AND expressions (as reported in the JIRA above):

      simplify(unknown as unknown): AND(true, OR(=(?0.int0, 1), =(?0.int0, 2), =(?0.int0, 3)), OR(AND(true, =(?0.int0, 1)), AND(true, =(?0.int0, 2))))
      

      For Calcite <= 1.25, simplification is still missed:

      Expected: "OR(?0.int0=1, ?0.int0=2)"
           but: was "AND(OR(=(?0.int0, 1), =(?0.int0, 2), =(?0.int0, 3)), OR(=(?0.int0, 1), =(?0.int0, 2)))"
      

      From Calcite >= 1.26, the simplifications happens:

      Expected: "OR(?0.int0=1, ?0.int0=2)"
           but: was "SEARCH(?0.int0, Sarg[1, 2])"
      

      For this reason, once we upgrade to Calcite >= 1.26, we could drop all the simplifications within the rule, just keep the OR -> IN conversion, and move the rule to the very last planning stage.

      Attachments

        Issue Links

          Activity

            People

              Unassigned Unassigned
              asolimando Alessandro Solimando
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated: