danny0405 commented on a change in pull request #1715: [CALCITE-3662] Generate
wrong SQL when plan contains Project(Sort(Aggregate)) and aggregate field has
no alias
URL: https://github.com/apache/calcite/pull/1715#discussion_r363631613
##########
File path:
core/src/main/java/org/apache/calcite/rel/rel2sql/RelToSqlConverter.java
##########
@@ -919,7 +924,11 @@ public Result visit(TableFunctionScan e) {
final String lowerName = name.toLowerCase(Locale.ROOT);
if (lowerName.startsWith("expr$")) {
// Put it in ordinalMap
- ordinalMap.put(lowerName, node);
+ if (stack.size() != 1) {
+ node = as(node, name);
Review comment:
The semantic is correct, but, can we have a more simple solution for the
SQL, the `RelToSqlConverterTest` has many failing test cases(some of which is
correct to fix but most are unnecessary change)
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
With regards,
Apache Git Services