[
https://issues.apache.org/jira/browse/CALCITE-4210?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Julian Hyde updated CALCITE-4210:
---------------------------------
Description:
SqlToRelConverter does not correctly expand a sub-query in an ON clause.
Aggregation is dropped during decorrelation.
{code:java}
SELECT "employee"."department_id", "employee"."salary"
FROM "department"
LEFT JOIN "employee" ON "employee"."salary" = (
SELECT max("employee"."salary")
FROM "employee"
WHERE "employee"."department_id" = "department"."department_id"
)
{code}
{code:java}
LogicalProject(department_id=[$9], salary=[$13])
LogicalJoin(condition=[=($13, $0)], joinType=[left])
LogicalTableScan(table=[[foodmart, department]])
LogicalTableScan(table=[[foodmart, employee]]){code}
This may be related to CALCITE-4206.
was:
Aggregation is dropped during decorreleation.
{code:java}
SELECT "employee"."department_id", "employee"."salary"
FROM "department"
LEFT JOIN "employee" ON "employee"."salary" = (
SELECT max("employee"."salary")
FROM "employee"
WHERE "employee"."department_id" = "department"."department_id"
)
{code}
{code:java}
LogicalProject(department_id=[$9], salary=[$13])
LogicalJoin(condition=[=($13, $0)], joinType=[left])
LogicalTableScan(table=[[foodmart, department]])
LogicalTableScan(table=[[foodmart, employee]]){code}
This may be related to CALCITE-4206.
> Sub-query in ON clause is not correctly expanded by SqlToRelConverter
> ---------------------------------------------------------------------
>
> Key: CALCITE-4210
> URL: https://issues.apache.org/jira/browse/CALCITE-4210
> Project: Calcite
> Issue Type: Bug
> Components: core
> Reporter: James Starr
> Priority: Major
> Labels: pull-request-available
> Fix For: 1.26.0
>
> Time Spent: 2h 40m
> Remaining Estimate: 0h
>
> SqlToRelConverter does not correctly expand a sub-query in an ON clause.
> Aggregation is dropped during decorrelation.
> {code:java}
> SELECT "employee"."department_id", "employee"."salary"
> FROM "department"
> LEFT JOIN "employee" ON "employee"."salary" = (
> SELECT max("employee"."salary")
> FROM "employee"
> WHERE "employee"."department_id" = "department"."department_id"
> )
> {code}
> {code:java}
> LogicalProject(department_id=[$9], salary=[$13])
> LogicalJoin(condition=[=($13, $0)], joinType=[left])
> LogicalTableScan(table=[[foodmart, department]])
> LogicalTableScan(table=[[foodmart, employee]]){code}
> This may be related to CALCITE-4206.
--
This message was sent by Atlassian Jira
(v8.3.4#803005)