[ 
https://issues.apache.org/jira/browse/HIVE-16117?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15973585#comment-15973585
 ] 

Ashutosh Chauhan commented on HIVE-16117:
-----------------------------------------

+1

> 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
>         Attachments: HIVE-16117.01.patch, HIVE-16117.patch
>
>
> 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)

Reply via email to