Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -241,7 +241,9 @@ protected boolean rightFinished(boolean withMaterialization) {
/** */
protected boolean checkJoinFinished() throws Exception {
if (!finishing) {
finishing = true;
if (leftFinished() && rightFinished(true))

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.

What if not finished? Why we clear all then?

finishing = true;

leftInBuf.clear();
rightInBuf.clear();
rightMaterialization = null;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,6 @@
import org.apache.ignite.internal.util.typedef.F;
import org.apache.ignite.testframework.GridTestUtils;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.junit.runners.Parameterized;

import static org.apache.calcite.rel.core.JoinRelType.ANTI;
import static org.apache.calcite.rel.core.JoinRelType.FULL;
Expand All @@ -45,7 +43,6 @@
import static org.apache.calcite.rel.core.JoinRelType.SEMI;

/** Tests that buffers of join nodes are cleared at the join end and that a join node is not stuck. */
@RunWith(Parameterized.class)
public class JoinBuffersExecutionTest extends AbstractExecutionTest {
/** */
@Test
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,16 @@

import java.sql.Date;
import java.time.Instant;
import java.util.List;
import java.util.UUID;
import org.apache.ignite.internal.processors.query.calcite.QueryChecker;
import org.apache.ignite.internal.processors.query.calcite.hint.HintDefinition;
import org.junit.Test;

import static org.apache.ignite.internal.processors.query.calcite.hint.HintDefinition.NO_CNL_JOIN;
import static org.apache.ignite.internal.processors.query.calcite.hint.HintDefinition.NO_HASH_JOIN;
import static org.apache.ignite.internal.processors.query.calcite.hint.HintDefinition.NO_NL_JOIN;

/**
* Tests correlated queries.
*/
Expand Down Expand Up @@ -90,19 +96,22 @@ public void testCorrelatesCollision() {
sql("INSERT INTO test1 VALUES (11, 1), (12, 2), (13, 3)");
sql("INSERT INTO test2 VALUES (11, 1), (12, 1), (13, 4)");

// Collision by correlate variables in the left hand.
assertQuery("SELECT * FROM test1 WHERE " +
"EXISTS(SELECT * FROM test2 WHERE test1.a=test2.a AND test1.b<>test2.c) " +
"AND NOT EXISTS(SELECT * FROM test2 WHERE test1.a=test2.a AND test1.b<test2.c)")
.returns(12, 2)
.check();

// Collision by correlate variables in both, left and right hands.
assertQuery("SELECT * FROM test1 WHERE " +
"EXISTS(SELECT * FROM test2 WHERE (SELECT test1.a)=test2.a AND (SELECT test1.b)<>test2.c) " +
"AND NOT EXISTS(SELECT * FROM test2 WHERE (SELECT test1.a)=test2.a AND (SELECT test1.b)<test2.c)")
.returns(12, 2)
.check();
for (HintDefinition noHint : List.of(NO_NL_JOIN, NO_CNL_JOIN, NO_HASH_JOIN)) {

@Vladsz83 Vladsz83 Aug 10, 2026

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.

Should we define which join we wanr use insteed? NO_JOIN does not guarantee another certain join wouldn't be taken twice.

log.info(">>> Check with: " + noHint);
// Collision by correlate variables in the left hand.
assertQuery("SELECT /*+ %s */ * FROM test1 WHERE ".formatted(noHint) +
"EXISTS(SELECT * FROM test2 WHERE test1.a=test2.a AND test1.b<>test2.c) " +
"AND NOT EXISTS(SELECT * FROM test2 WHERE test1.a=test2.a AND test1.b<test2.c)")
.returns(12, 2)
.check();

// Collision by correlate variables in both, left and right hands.
assertQuery("SELECT /*+ %s */ * FROM test1 WHERE ".formatted(noHint) +
"EXISTS(SELECT * FROM test2 WHERE (SELECT test1.a)=test2.a AND (SELECT test1.b)<>test2.c) " +
"AND NOT EXISTS(SELECT * FROM test2 WHERE (SELECT test1.a)=test2.a AND (SELECT test1.b)<test2.c)")
.returns(12, 2)
.check();
}
}

/**
Expand Down
Loading