Stamatis Zampetakis created HIVE-28252: ------------------------------------------
Summary: AssertionError when using HiveTableScan with a HepPlanner cluster Key: HIVE-28252 URL: https://issues.apache.org/jira/browse/HIVE-28252 Project: Hive Issue Type: Improvement Components: CBO, Tests Affects Versions: 4.0.0 Reporter: Stamatis Zampetakis Assignee: Stamatis Zampetakis The {{HiveTableScan}} operator throws an [AssertionError|https://github.com/apache/hive/blob/7950967eae9640fcc0aa22f4b6c7906b34281eac/ql/src/java/org/apache/hadoop/hive/ql/optimizer/calcite/reloperators/HiveTableScan.java#L153] if the operator does not have the {{HiveRelNode.CONVENTION}} set. The {{HepPlanner}} does not use any [RelTraitDef|https://github.com/apache/calcite/blob/f854ef5ee480e0ff893b18d27ec67dc381ee2244/core/src/main/java/org/apache/calcite/plan/AbstractRelOptPlanner.java#L276] so the default [empty traitset for the respective cluster|https://github.com/apache/calcite/blob/f854ef5ee480e0ff893b18d27ec67dc381ee2244/core/src/main/java/org/apache/calcite/plan/RelOptCluster.java#L99] is gonna be always empty. In principle we should not be able to use the {{HiveTableScan}} operator with {{HepPlanner}}. However, the optimizer heavily uses the {{HepPlanner}} (in fact more than the {{VolcanoPlanner}} and it is reasonable to wonder how is this possible given that this assertion is in place. The assertion is circumvented by creating a cluster from a [VolcanoPlanner|https://github.com/apache/hive/blob/7950967eae9640fcc0aa22f4b6c7906b34281eac/ql/src/java/org/apache/hadoop/hive/ql/parse/CalcitePlanner.java#L1620] and then using it in the [HepPlanner|https://github.com/apache/hive/blob/7950967eae9640fcc0aa22f4b6c7906b34281eac/ql/src/java/org/apache/hadoop/hive/ql/parse/CalcitePlanner.java#L2422]. This cluster usage is a bit contrived but does not necessarily need to change at this stage. Nevertheless, since the {{HiveTableScan}} operator is suitable to run with the {{HepPlanner}} the assertion can be relaxed (or removed altogether) to better reflect the actual usage of the operator, and allow passing a "true" HepPlanner cluster inside the operator. -- This message was sent by Atlassian Jira (v8.20.10#820010)