[
https://issues.apache.org/jira/browse/CALCITE-4512?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17335085#comment-17335085
]
Julian Hyde commented on CALCITE-4512:
--------------------------------------
I took a quick look at the PR, and I am surprised that there is so much added
code, given that the new algorithm is simpler than the old one. (For GROUP BY
at least; maybe not for HAVING. For GROUP BY, the algorithm is very similar to
ordinal substitution.)
In SqlValidatorTest, you have {{select empno as deptno from emp group by
deptno}} as invalid. It should be valid, I think; it is valid in Bigquery.
No need to include bug numbers in code (except as javadoc for test cases), or
to add comments saying what behavior was before. That is cruft.
> group by expression has argument name same with select list item alias,
> causes validation error
> -----------------------------------------------------------------------------------------------
>
> Key: CALCITE-4512
> URL: https://issues.apache.org/jira/browse/CALCITE-4512
> Project: Calcite
> Issue Type: Bug
> Components: core
> Affects Versions: 1.26.0
> Environment: jvm: open-jdk8
> Reporter: yanjing.wang
> Priority: Major
> Labels: pull-request-available
> Time Spent: 50m
> Remaining Estimate: 0h
>
> String sql = "select replace(name, 'a', 'b') as name from users group by
> replace(name, 'a', 'b')";
>
> when group by expression has argument name same with select list item alias,
> the group by argument will be expanded to select list item when sql
> conformance supports 'groupByAlias', so the above sql will be expanded to
> String sql = "select replace(name, 'a', 'b') as name from users group by
> replace(replace(name, 'a', 'b'), 'a', 'b')";
>
> this is unexpected.
--
This message was sent by Atlassian Jira
(v8.3.4#803005)