[
https://issues.apache.org/jira/browse/HIVE-25870?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Alessandro Solimando updated HIVE-25870:
----------------------------------------
Summary: Avoid simplification in HivePointLookupOptimizerRule, convert only
(was: Make HivePointLookupOptimizerRule to just convert OR to IN, no
simplification)
> Avoid simplification in HivePointLookupOptimizerRule, convert only
> ------------------------------------------------------------------
>
> 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
> Priority: Major
>
> _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, 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.
--
This message was sent by Atlassian Jira
(v8.20.1#820001)