[ https://issues.apache.org/jira/browse/HIVE-25952?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17868103#comment-17868103 ]
Alessandro Solimando edited comment on HIVE-25952 at 7/23/24 3:44 PM: ---------------------------------------------------------------------- It's been a long time but IIRC, I marked HIVE-25966 as blocking this ticket due to [HiveRelMdPredicates.java#L160|https://github.com/apache/hive/blob/master/ql/src/java/org/apache/hadoop/hive/ql/optimizer/calcite/stats/HiveRelMdPredicates.java#L160]. It seems that the opposite should be true, we can't fix HIVE-25966 (and adopt Calcite's machinery) without making them agree on what a constant is (the RexCall case you mentioned, with the imprecision you correctly spotted). Most probably the test results are not available anymore, but the divergence of Hive/Calcite on what is a constant where causing some issues that had to be fixed. EDIT: when the run of your PR is over we will probably see what issues blocked me back then when working on it. I don't remember how big these changes were, but for sure they were there. was (Author: asolimando): It's been a long time but IIRC, I marked HIVE-25966 as blocking this ticket due to [HiveRelMdPredicates.java#L160|https://github.com/apache/hive/blob/master/ql/src/java/org/apache/hadoop/hive/ql/optimizer/calcite/stats/HiveRelMdPredicates.java#L160]. It seems that the opposite should be true, we can't fix HIVE-25966 (and adopt Calcite's machinery) without making them agree on what a constant is (the RexCall case you mentioned, with the imprecision you correctly spotted). Most probably the test results are not available anymore, but the divergence of Hive/Calcite on what is a constant where causing some issues that had to be fixed. > Drop HiveRelMdPredicates::getPredicates(Project...) to use that of > RelMdPredicates > ---------------------------------------------------------------------------------- > > Key: HIVE-25952 > URL: https://issues.apache.org/jira/browse/HIVE-25952 > Project: Hive > Issue Type: Sub-task > Components: CBO > Affects Versions: 4.0.0 > Reporter: Alessandro Solimando > Assignee: Alessandro Solimando > Priority: Major > Labels: pull-request-available > Time Spent: 1h 20m > Remaining Estimate: 0h > > There are some differences on this method between Hive and Calcite, the idea > of this ticket is to unify the two methods, and then drop the override in > HiveRelMdPredicates in favour of the method of RelMdPredicates. > After applying HIVE-25966, the only difference is in the test for constant > expressions, which can be summarized as follows: > ||Expression Type|Is Constant for Hive?||Is Constant for Calcite?|| > |InputRef|False|False| > |Call|True if function is deterministic (arguments are not checked), false > otherwise|True if function is deterministic and all operands are constants, > false otherwise| > |CorrelatedVariable|False|False| > |LocalRef|False|False| > |Over|False|False| > |DymanicParameter|False|True| > |RangeRef|False|False| > |FieldAccess|False|Given expr.field, true if expr is constant, false > otherwise| -- This message was sent by Atlassian Jira (v8.20.10#820010)