Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[CALCITE-1873] SqlValidatorImpl: Strip AS when visiting group-by-ordinal. #490

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Expand Up @@ -5415,7 +5415,7 @@ public SqlNode visit(SqlLiteral literal) {

// SQL ordinals are 1-based, but Sort's are 0-based
int ordinal = intValue - 1;
return select.getSelectList().get(ordinal);
return SqlUtil.stripAs(select.getSelectList().get(ordinal));
}
break;
}
Expand Down
Expand Up @@ -6304,6 +6304,12 @@ public boolean isBangEqualAllowed() {
+ " group by 1,2")
.tester(strict).fails("Expression 'DEPTNO' is not being grouped")
.tester(lenient).sansCarets().ok();
sql("select ^empno^, count(*) from emp group by 1 order by 1")
.tester(strict).fails("Expression 'EMPNO' is not being grouped")
.tester(lenient).sansCarets().ok();
sql("select ^empno^ eno, count(*) from emp group by 1 order by 1")
.tester(strict).fails("Expression 'EMPNO' is not being grouped")
.tester(lenient).sansCarets().ok();
sql("select count(*) from (select 1 from emp"
+ " group by substring(ename from 2 for 3))")
.tester(strict).ok()
Expand Down