You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@hive.apache.org by "Walter Wu (JIRA)" <ji...@apache.org> on 2017/02/20 06:38:44 UTC
[jira] [Commented] (HIVE-15874) Invalid position alias in Group By
when CBO failed
[ https://issues.apache.org/jira/browse/HIVE-15874?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15874116#comment-15874116 ]
Walter Wu commented on HIVE-15874:
----------------------------------
Use MR engine.
Before CBO optimize, processPositionAlias will be called once. 'select 2017 as a, b from alias_test_02 group by 1, 2' will be transformed into 'select 2017 as a, b from alias_test_02 group by 2017, b'.
When CBO optimize failed and reAnalyzeAST is set to true, processPositionAlias will be called twice. '2017' will be considered to column alias. Error : 'Invalid position alias in Group By' will occur.
Obviously, we just need process position alias one time. So the most intuitive and effective way is stepping processPositionAlias out of genResolvedParseTree.
> Invalid position alias in Group By when CBO failed
> ---------------------------------------------------
>
> Key: HIVE-15874
> URL: https://issues.apache.org/jira/browse/HIVE-15874
> Project: Hive
> Issue Type: Bug
> Components: CBO
> Affects Versions: 1.2.1, 2.1.1
> Reporter: Walter Wu
>
> for example:
> create table alias_test_01(a INT, b STRING) ;
> create table alias_test_02(a INT, b STRING) ;
> create table alias_test_03(a INT, b STRING) ;
> set hive.groupby.position.alias = true;
> set hive.cbo.enable=true;
> explain
> select * from
> alias_test_01 alias01
> left join
> (
> select 2017 as a, b from alias_test_02 group by 1, 2
> ) alias02
> on alias01.a = alias02.a
> left join
> alias_test_03 alias03
> on alias01.a = alias03.a;
> error info:
> FAILED: SemanticException [Error 10220]: Invalid position alias in Group By
> Position alias: 2017 does not exist
> The Select List is indexed from 1 to 2
> the first process Position Alias result:
> when CBO optimize failed and reAnalyzeAST is true, position alias will be processed twice.
> 1. 'group by 1, 2' convert to 'group by 2017, b'
> 2. 'group by 2017, b' 2017 column does not exist
--
This message was sent by Atlassian JIRA
(v6.3.15#6346)