You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@hive.apache.org by "Jesus Camacho Rodriguez (JIRA)" <ji...@apache.org> on 2017/03/06 08:56:33 UTC
[jira] [Created] (HIVE-16117) SortProjectTransposeRule should check
for monotonicity preserving CAST
Jesus Camacho Rodriguez created HIVE-16117:
----------------------------------------------
Summary: SortProjectTransposeRule should check for monotonicity preserving CAST
Key: HIVE-16117
URL: https://issues.apache.org/jira/browse/HIVE-16117
Project: Hive
Issue Type: Bug
Components: CBO
Affects Versions: 2.2.0
Reporter: Jesus Camacho Rodriguez
Assignee: Jesus Camacho Rodriguez
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:
{noformat}
...
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))
...
{noformat}
will be transformed into:
{noformat}
...
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)
...
{noformat}
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.
--
This message was sent by Atlassian JIRA
(v6.3.15#6346)