You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@hive.apache.org by "Alessandro Solimando (Jira)" <ji...@apache.org> on 2022/01/17 16:13:00 UTC

[jira] [Created] (HIVE-25870) Make HivePointLookupOptimizerRule to just convert OR to IN, no simplification

Alessandro Solimando created HIVE-25870:
-------------------------------------------

             Summary: Make HivePointLookupOptimizerRule to just convert OR to IN, no simplification
                 Key: HIVE-25870
                 URL: https://issues.apache.org/jira/browse/HIVE-25870
             Project: Hive
          Issue Type: Improvement
          Components: CBO
    Affects Versions: 4.0.0
            Reporter: Alessandro Solimando


_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):

{noformat}
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))))
{noformat}

For Calcite <= 1.25, simplification is still missed:
{noformat}
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)))"
{noformat}

From Calcite >= 1.26, the simplifications happens:
{noformat}
Expected: "OR(?0.int0=1, ?0.int0=2)"
     but: was "SEARCH(?0.int0, Sarg[1, 2])"
{noformat}

For this reason, 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.



--
This message was sent by Atlassian Jira
(v8.20.1#820001)