[
https://issues.apache.org/jira/browse/IMPALA-10096?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17200166#comment-17200166
]
ASF subversion and git services commented on IMPALA-10096:
----------------------------------------------------------
Commit 462d91884fed4a139587a9e5ffa353b82e486c95 in impala's branch
refs/heads/master from xqhe
[ https://gitbox.apache.org/repos/asf?p=impala.git;h=462d918 ]
IMPALA-10096: Use the original ordinal if the group by ordinal reference is a
constant int
The SelectStmt's groupingExprs_ uses the analyzed version and the
ordinal reference will be substituted.
It will throw an exception if the ordinal reference is still a numeric
literal, because we will re-analyze after the expression has been
rewritten. For example, here "count(1)" is rewritten to "count(*)" so
we need to re-analyze the new query.
select 13, id, count(1) from dimtbl group by 1, 2;
The rewritten sql should be
select 13, id, count(*) from dimtbl group by 1, id;
If the original query uses "count(*)", it won't hit the bug since
no rewriting happens.
Testing:
- Added new unit tests with ordinal in GROUP BY whereas SELECT has
the INT literal.
- Ran 'mvn test' for the FE
Change-Id: I34f659d15073d69aa0a4685f56ad94557df86560
Reviewed-on: http://gerrit.cloudera.org:8080/16353
Reviewed-by: Impala Public Jenkins <[email protected]>
Tested-by: Impala Public Jenkins <[email protected]>
> May throw exception after expr rewritten , if the group by ordinal reference
> is still a numeric literal
> -------------------------------------------------------------------------------------------------------
>
> Key: IMPALA-10096
> URL: https://issues.apache.org/jira/browse/IMPALA-10096
> Project: IMPALA
> Issue Type: Bug
> Components: Frontend
> Affects Versions: Impala 4.0
> Reporter: Xianqing He
> Assignee: Xianqing He
> Priority: Minor
>
> When the sql can rewrite, if the group by ordinal reference is still a
> numeric literal, it will throw exception
> {code:java}
> select 13, id, count(1) from dimtbl group by 1, 2;
> ERROR: AnalysisException: GROUP BY: ordinal exceeds the number of items in
> the SELECT list: 13
> {code}
--
This message was sent by Atlassian Jira
(v8.3.4#803005)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]