Description
Due to CALCITE-1618, we need to move to new Calcite release to fix it.
Due to this, SortProjectTransposeRule ignores CAST in the Project operator.
For instance:
... HiveSortLimit(sort0=$4,sort1=$2,dir0=ASC-nulls-first,dir1=DESC-nulls-last,fetch=10) HiveProject(robot=$0,_o__c1=$2,m=$3,s=$4,(tok_function tok_int (tok_table_or_col robot))=CAST($0):INTEGER)) ...
will be transformed into:
... HiveProject(robot=$0,_o__c1=$2,m=$3,s=$4,(tok_function tok_int (tok_table_or_col robot))=CAST($0):INTEGER)) HiveSortLimit(sort0=$0,sort1=$2,dir0=ASC-nulls-first,dir1=DESC-nulls-last,fetch=10) ...
which is incorrect.
The problem seems to be in the permutation method in RelOptUtil, which is called in L87. The method actually considers a CAST on a reference as a valid column permutation of the column referenced; probably it should not.
permutation is only called by this rule and UnionPullUpConstantsRule, thus it seems it is safe to fix the semantics of the method.
Attachments
Attachments
Issue Links
- is blocked by
-
HIVE-15708 Upgrade calcite version to 1.12
- Closed