Mihai Budiu created CALCITE-7052:
------------------------------------
Summary: When conformance specifies isGroupbyAlias = true the
validator rejects legal queries
Key: CALCITE-7052
URL: https://issues.apache.org/jira/browse/CALCITE-7052
Project: Calcite
Issue Type: Bug
Components: core
Affects Versions: 1.40.0
Reporter: Mihai Budiu
The following test in SqlValidatorTest passes:
{code:java}
sql("SELECT ALL - cor0.empno AS empno "
+ "FROM emp AS cor0 GROUP BY empno HAVING NOT ( cor0.empno ) IS NULL")
.ok();
{code}
but the following test fails:
{code:java]
sql("SELECT ALL - cor0.empno AS empno "
+ "FROM emp AS cor0 GROUP BY empno HAVING NOT ( cor0.empno ) IS NULL")
.withConformance(SqlConformanceEnum.LENIENT)
.ok();
{code}
with the error:
{code}
Expression 'COR0.EMPNO' is not being grouped
{code}
The validator incorrectly rewrites the query as:
SELECT ALL - `COR0`.`EMPNO` AS `EMPNO`
FROM `EMP` AS `COR0`
GROUP BY - `COR0`.`EMPNO`
HAVING NOT `COR0`.`EMPNO` IS NULL
because in this conformance isGroupbyAlias returns true.
--
This message was sent by Atlassian Jira
(v8.20.10#820010)