Skip to content

Conversation

@xiedeyantu
Copy link
Member

See CALCITE-7350

I'm not quite sure how to add test cases. Perhaps we don't need to add test cases related to this change during the evolution process?

Copy link
Contributor

@silundong silundong left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Perhaps you could try constructing a Window in correlated subquery (TopDownGeneralDecorrelator can handle window functions in the Project, but it doesn't support Window). For example, in RelOptRulesTest:

final String sql = "SELECT empno FROM emp e WHERE sal > some(SELECT avg(sal) over (partition by deptno) from emp_b b where b.deptno = e.deptno)";

sql(sql)
    .withRule(
        CoreRules.FILTER_SUB_QUERY_TO_MARK_CORRELATE,
        CoreRules.PROJECT_TO_LOGICAL_PROJECT_AND_WINDOW)
    .withLateDecorrelate(true)
    .withTopDownGeneralDecorrelate(true)
    .check();

@xiedeyantu
Copy link
Member Author

Perhaps you could try constructing a Window in correlated subquery (TopDownGeneralDecorrelator can handle window functions in the Project, but it doesn't support Window). For example, in RelOptRulesTest:

final String sql = "SELECT empno FROM emp e WHERE sal > some(SELECT avg(sal) over (partition by deptno) from emp_b b where b.deptno = e.deptno)";

sql(sql)
    .withRule(
        CoreRules.FILTER_SUB_QUERY_TO_MARK_CORRELATE,
        CoreRules.PROJECT_TO_LOGICAL_PROJECT_AND_WINDOW)
    .withLateDecorrelate(true)
    .withTopDownGeneralDecorrelate(true)
    .check();

Thank you for providing the case; I have added it.

Copy link
Member

@xuzifu666 xuzifu666 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

.check();
}

@Test void testUnnestInternalMissingParameter() {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please add jira link for it.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since it's a minor issue, I simply squashed the commits, thanks!

@sonarqubecloud
Copy link

sonarqubecloud bot commented Jan 3, 2026

@silundong silundong merged commit 6e86c22 into apache:main Jan 3, 2026
20 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants