[
https://issues.apache.org/jira/browse/DRILL-4917?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16000383#comment-16000383
]
sven0726 commented on DRILL-4917:
---------------------------------
The same thing happened to me
0: jdbc:drill:zk=local> SELECT `respCode`,SUM(`num`) AS `num` FROM <db> GROUP
BY `respCode` ;
+-----------+--------+
| respCode | $f1 |
+-----------+--------+
> 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.15#6346)