Skip to content

IGNITE-23799 : Calcite. Hash join.#11770

Closed
Vladsz83 wants to merge 51 commits intoapache:masterfrom
Vladsz83:IGNITE-23799_calcite_hash_join
Closed

IGNITE-23799 : Calcite. Hash join.#11770
Vladsz83 wants to merge 51 commits intoapache:masterfrom
Vladsz83:IGNITE-23799_calcite_hash_join

Conversation

@Vladsz83
Copy link
Contributor

No description provided.


/** Tests 'Select e.id, e.name, d.name as dep_name from DEP d <JOIN TYPE> join EMP e on e.DEPNO = d.DEPNO'. */
@Test
public void testHashJoin() {
Copy link
Contributor

Choose a reason for hiding this comment

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

ExecutionTest already contains a lot of unsorted tests, maybe it's time to move join tests to another class. But we also have MergeJoinExecutionTest/NestedLoopJoinExecutionTest they look almost identical and looks like they cover more cases than testHashJoin test. Maybe it's better to extract common part and add new HashJoinExecutionTest class.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I think you are right. But this might be other tests refactoring ticket.

private static List<List<Object>> testJoinIsAppliedParameters() {
return F.asList(
F.asList("select t1.c1 from t1 %s join t1 t2 using(c1)", true),
F.asList("select t1.c1 from t1 %s join t1 t2 on t1.c1 = t2.c1", true),
Copy link
Contributor

Choose a reason for hiding this comment

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

Please add two columns test.
Also, in cases like t1.c1 = t2.c2 and t1.id = 1 second condition can be pushed down to table scan (at least for some types of join), perhaps these cases should be tested too.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

There are two-column tests below. Yes, some scans are pushed down and join uses only one equi join pair.

Vladsz83 added 14 commits July 16, 2025 13:33
# Conflicts:
#	modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/exec/rel/ExecutionTest.java
#	modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/planner/JoinCommutePlannerTest.java
# Conflicts:
#	modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/planner/PlannerTest.java
# Conflicts:
#	modules/calcite/src/main/java/org/apache/ignite/internal/processors/query/calcite/exec/RuntimeHashIndex.java
#	modules/calcite/src/main/java/org/apache/ignite/internal/processors/query/calcite/exec/rel/NestedLoopJoinNode.java
#	modules/calcite/src/test/java/org/apache/ignite/testsuites/ExecutionTestSuite.java
RowT right = rightIt.next();

if (nonEqCond != null && !nonEqCond.test(left, right))
continue;
Copy link
Contributor

Choose a reason for hiding this comment

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

For left join we should emit row with empty right part, but only once per one left row

/** */
@Test
public void testLeftJoinWithPostFiltration() {
Object[][] expected = new Object[][]{
Copy link
Contributor

Choose a reason for hiding this comment

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

Every row from the left side should be in the set

Copy link
Contributor Author

Choose a reason for hiding this comment

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

There is a condition ((CharSequence)l[1]).length() > 4;. However, Left is reverted for now.

@sonarqubecloud
Copy link

Quality Gate Failed Quality Gate failed

Failed conditions
11.1% Duplication on New Code (required ≤ 5%)
37 New Code Smells (required ≤ 1)
17 Duplicated Blocks on New Code (required ≤ 10)

See analysis details on SonarQube Cloud

Catch issues before they fail your Quality Gate with our IDE extension SonarQube for IDE

@Vladsz83 Vladsz83 deleted the IGNITE-23799_calcite_hash_join branch January 27, 2026 12:23
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.

2 participants