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

Hugo Bellomusto commented on DRILL-4917:
----------------------------------------

Same behavior with group by and *sum* function:
{code:sql}
SELECT EXPR$0 col1, sum(EXPR$0) ignoredAlias 
FROM (VALUES(1))
GROUP BY EXPR$0
{code}
||col1||{color:red}$f1{color}|
|1|1|

Using count, avg, min, max it works well.

> Unable to alias columns from subquery
> -------------------------------------
>
>                 Key: DRILL-4917
>                 URL: https://issues.apache.org/jira/browse/DRILL-4917
>             Project: Apache Drill
>          Issue Type: Bug
>    Affects Versions: 1.8.0
>            Reporter: Dan Wild
>
> Column aliasing works in a simple query (without subqueries):
> {code}
> select 1 as myVal from (values(1))
> {code}
> My result set gives me one column called myVal as expected
> |myVal||
> |1|
> However, when I run the query
> {code}
> select myVal as myValAlias FROM(select 1 as myVal from (values(1)))
> {code}
> the alias myValAlias is not applied, and the resulting column is still called 
> myVal
> |myVal||
> |1|
> This is problematic because if my query instead looked like
> {code}
> select myVal, SUM(myVal) as mySum FROM(select 1 as myVal from (values(1))) 
> GROUP BY myVal
> {code}
> I would get a result set back that looks like this, with no way to alias the 
> second column:
> |myVal|$f1|
> |1|1|



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to