[ https://issues.apache.org/jira/browse/HIVE-25953?focusedWorklogId=731637&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-731637 ]
ASF GitHub Bot logged work on HIVE-25953: ----------------------------------------- Author: ASF GitHub Bot Created on: 23/Feb/22 15:22 Start Date: 23/Feb/22 15:22 Worklog Time Spent: 10m Work Description: asolimando commented on a change in pull request #3033: URL: https://github.com/apache/hive/pull/3033#discussion_r813007732 ########## File path: ql/src/test/results/clientpositive/llap/subquery_scalar.q.out ########## @@ -491,25 +484,25 @@ STAGE PLANS: aggregations: count(VALUE._col0) mode: mergepartial outputColumnNames: _col0 - Statistics: Num rows: 1 Data size: 196 Basic stats: COMPLETE Column stats: NONE - Limit - Number of rows: 0 - Statistics: Num rows: 0 Data size: 0 Basic stats: COMPLETE Column stats: NONE + Statistics: Num rows: 1 Data size: 192 Basic stats: COMPLETE Column stats: NONE + Filter Operator + predicate: sq_count_check(_col0) (type: boolean) + Statistics: Num rows: 1 Data size: 192 Basic stats: COMPLETE Column stats: NONE Review comment: `HiveSortLimit(fetch=[0])` is introduced when `HiveMergeFilterRule` is invoked here: ``` HiveFilter(condition=[false]) HiveFilter(condition=[sq_count_check($0)]) HiveAggregate(group=[{}], cnt=[COUNT()]) HiveProject(p_name=[null:VARCHAR(2147483647) CHARACTER SET "UTF-16LE"]) HiveFilter(condition=[IS NULL($1)]) HiveTableScan(table=[[default, part_null_n1]], table:alias=[part_null_n1]) ``` The empty filter is rewritten by `HiveRelBuilder` as a LIMIT(0) expression (see [HiveRelBuilder.java#L133](https://github.com/apache/hive/blob/1c3ecf95f94a0329626a9fe46670586e7767f014/ql/src/java/org/apache/hadoop/hive/ql/optimizer/calcite/HiveRelBuilder.java#L133)). The "false" predicate is not pushed transitively in this case for the Calcite implementation, so this transformation never happens, we are left with what is the original plan after decorrelation (for that specific subtree): ``` 2022-02-22T08:29:38,455 DEBUG [6a4314fb-ef37-46d8-8331-338fff02f1df main] parse.CalcitePlanner: Plan after decorrelation: HiveProject(p_partkey=[$0], p_name=[$1], p_mfgr=[$2], p_brand=[$3], p_type=[$4], p_size=[$5], p_container=[$6], p_retailprice=[$7], p_comment= [$8]) HiveProject(p_partkey=[$0], p_name=[$1], p_mfgr=[$2], p_brand=[$3], p_type=[$4], p_size=[$5], p_container=[$6], p_retailprice=[$7], p_commen t=[$8], BLOCK__OFFSET__INSIDE__FILE=[$9], INPUT__FILE__NAME=[$10], ROW__ID=[$11], ROW__IS__DELETED=[$12]) HiveFilter(condition=[=($1, $14)]) HiveJoin(condition=[true], joinType=[left], algorithm=[none], cost=[not available]) HiveJoin(condition=[true], joinType=[inner], algorithm=[none], cost=[not available]) HiveTableScan(table=[[default, part]], table:alias=[part]) HiveFilter(condition=[sq_count_check($0)]) HiveAggregate(group=[{}], cnt=[COUNT()]) HiveProject(p_name=[$1]) HiveFilter(condition=[IS NULL($1)]) HiveTableScan(table=[[default, part_null_n1]], table:alias=[part_null_n1]) HiveProject(p_name=[$1]) HiveFilter(condition=[IS NULL($1)]) HiveTableScan(table=[[default, part_null_n1]], table:alias=[part_null_n1]) ``` `false` predicate is not inferred in Calcite, which does not support "non field predicates" (see [HiveRelMdPredicates.java#L439](https://github.com/apache/hive/blob/1c3ecf95f94a0329626a9fe46670586e7767f014/ql/src/java/org/apache/hadoop/hive/ql/optimizer/calcite/stats/HiveRelMdPredicates.java#L439)), which are predicates without field reference in it. I will see if I can craft a similar query for Calcite and file an improvement ticket to support such predicates without field reference. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: gitbox-unsubscr...@hive.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org Issue Time Tracking ------------------- Worklog Id: (was: 731637) Time Spent: 40m (was: 0.5h) > Drop HiveRelMdPredicates::getPredicates(Join...) to use that of > RelMdPredicates > ------------------------------------------------------------------------------- > > Key: HIVE-25953 > URL: https://issues.apache.org/jira/browse/HIVE-25953 > 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: 40m > Remaining Estimate: 0h > > The goal of the ticket is to unify the two implementations and remove the > override in HiveRelMdPredicates. -- This message was sent by Atlassian Jira (v8.20.1#820001)