mihaibudiu commented on code in PR #4772:
URL: https://github.com/apache/calcite/pull/4772#discussion_r2730402362
##########
core/src/test/java/org/apache/calcite/test/enumerable/EnumerableJoinTest.java:
##########
@@ -440,6 +447,96 @@ private void
checkMergeJoinWithCompositeKeyAndNullValues(boolean bigSchema, Join
"empid=5; name=Emp5");
}
+ /** Test case for
+ * <a
href="https://issues.apache.org/jira/browse/CALCITE-7385";>[CALCITE-7385]
+ * Support LEFT_MARK type for nested loop join in enumerable convention</a>.
*/
+ @Test void testLeftMarkJoinBasedNestedLoop() {
+ Program subQuery =
+ Programs.hep(
+ ImmutableList.of(CoreRules.PROJECT_SUB_QUERY_TO_MARK_CORRELATE),
+ true,
+ DefaultRelMetadataProvider.INSTANCE);
+ Program toCalc =
+ Programs.hep(
+ ImmutableList.of(CoreRules.PROJECT_TO_CALC,
CoreRules.FILTER_TO_CALC,
+ CoreRules.CALC_MERGE),
+ true,
+ DefaultRelMetadataProvider.INSTANCE);
+ Program enumerableImpl =
Programs.ofRules(EnumerableRules.ENUMERABLE_RULES);
+
+ // case1: left mark join from uncorrelated SOME subquery
+ tester(false, new HrSchema())
+ .query(
+ "WITH t1(id) as (VALUES (1), (2), (NULL)), t2(id) as (VALUES (2),
(3)) "
+ + "select id, id >= SOME(select id from t2) as marker from t1")
+ .withHook(Hook.PROGRAM, (Consumer<Holder<Program>>) program -> {
+ program.set(Programs.sequence(subQuery, toCalc, enumerableImpl));
+ })
+ .explainHookMatches(
+ "EnumerableNestedLoopJoin(condition=[>=($0, $1)],
joinType=[left_mark])\n"
+ + " EnumerableValues(tuples=[[{ 1 }, { 2 }, { null }]])\n"
+ + " EnumerableCalc(expr#0=[{inputs}], id=[$t0])\n"
+ + " EnumerableValues(tuples=[[{ 2 }, { 3 }]])\n")
+ .returnsUnordered(
Review Comment:
one way to make it easier to check that this is validated is by using the
old compilation algorithm and comparing the two produced results.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]