Skip to content

[CALCITE-4833] Complex nested correlated subquery failed. - #2571

Open
zstan wants to merge 3 commits into
apache:mainfrom
zstan:calcite-4833
Open

[CALCITE-4833] Complex nested correlated subquery failed.#2571
zstan wants to merge 3 commits into
apache:mainfrom
zstan:calcite-4833

Conversation

@zstan

@zstan zstan commented Oct 7, 2021

Copy link
Copy Markdown
Contributor

No description provided.

@zstan zstan changed the title CALCITE-4833 Complex nested correlated subquery failed. [CALCITE-4833] Complex nested correlated subquery failed. Oct 7, 2021
Comment thread build.gradle.kts Outdated
@jamesstarr

Copy link
Copy Markdown
Contributor

You should probably mark this a work in progress until you cleaned it up.

@zstan
zstan force-pushed the calcite-4833 branch 8 times, most recently from 46a649f to 2a4fb79 Compare October 8, 2021 08:00

@jamesstarr jamesstarr left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I think are more generalized approach should be taken. Very few queries will be written in way that this is handled.

* <a href="https://issues.apache.org/jira/browse/CALCITE-4833">[CALCITE-4833]
* Complex nested correlated subquery failed</a>.
*/
@Test void complexNestedCorrelatedSubquery() {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Could you split this up into multiple tests.

* Complex nested correlated subquery failed</a>.
*/
@Test void complexNestedCorrelatedSubquery() {
String sql = "SELECT t1.empid FROM emps t1 LEFT JOIN emps t2 ON (SELECT t2.empid)<=101";

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Could you please rework to join on different tables.

if (res != null) {
return res;
}
break;

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

We should throw an unsupported operation here.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

why ? we don`t throw it before.

case GREATER_THAN_OR_EQUAL:
case EQUALS:
RexNode res = simplifyOnWithSelectInConditions(expr);
if (res != null) {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

On the non expand path, we should be translating this RexSubquery, not doing a simplification of a trivial query.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

thanks ! but i don`t understand your case, can you explain better ?

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