chunweilei commented on a change in pull request #1690: [CALCITE-3524] Add 
methods for creating RexSubQueries in RelBuilder
URL: https://github.com/apache/calcite/pull/1690#discussion_r361353459
 
 

 ##########
 File path: core/src/test/java/org/apache/calcite/test/RelBuilderTest.java
 ##########
 @@ -3048,4 +3048,30 @@ private void checkExpandTable(RelBuilder builder, 
Matcher<RelNode> matcher) {
         + "    LogicalTableScan(table=[[scott, DEPT]])\n";
     assertThat(root, hasTree(expected));
   }
+
+  @Test public void testRexSubQueryIn() {
+
+    final RelBuilder builder = RelBuilder.create(config().build());
+    RelNode root = builder.scan("EMP")
+        .filter(
+            builder.in(
+                builder.scan("DEPT")
+                    .filter(
+                        builder.call(SqlStdOperatorTable.EQUALS,
+                            builder.field("DNAME"),
+                            builder.literal("AAA")))
+                    .project(builder.field("DEPTNO"))
+                    .build(),
+                ImmutableList.of(builder.field("DEPTNO"))))
+        .build();
+
+    final String expected = "LogicalFilter(condition=[IN($7, {\n"
+        + "LogicalProject(DEPTNO=[$0])\n"
+        + "  LogicalFilter(condition=[=($1, 'AAA')])\n"
+        + "    LogicalTableScan(table=[[scott, DEPT]])\n"
+        + "})])\n"
+        + "  LogicalTableScan(table=[[scott, EMP]])\n";
+
 
 Review comment:
   Also add  tests about `RexSubQuery exists(RelNode rel)` and `RexSubQuery 
scalar(RelNode rel)`.

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

Reply via email to