zstan commented on code in PR #3436:
URL: https://github.com/apache/calcite/pull/3436#discussion_r1370221712


##########
core/src/test/java/org/apache/calcite/test/JdbcTest.java:
##########
@@ -3119,6 +3122,100 @@ void testInnerJoinValues(String format) {
             "deptno=10; name=Sales; employees=[{100, 10, Bill, 10000.0, 1000}, 
{150, 10, Sebastian, 7000.0, null}]; location={-122, 38}");
   }
 
+  /** Test case for
+   * <a 
href="https://issues.apache.org/jira/browse/CALCITE-5984";>[CALCITE-5984]</a>
+   * Disabling trimming of unused fields via config and program.
+   * Case: trimmingByProgram: false ; trimmingByConfig: false. */
+  @Test void testJoinWithTrimmingDisabled() {
+    CalciteAssert.hr().query("select \"d\".\"name\" from \"hr\".\"depts\" as 
\"d\" \n"
+                + "  join \"hr\".\"emps\" as \"e\" on \"d\".\"deptno\" = 
\"e\".\"deptno\" \n")
+        .withHook(Hook.SQL2REL_CONVERTER_CONFIG_BUILDER,
+            (Consumer<Holder<Config>>) configHolder ->
+            configHolder.set(configHolder.get().withTrimUnusedFields(false)))
+        .withHook(Hook.PROGRAM,
+            (Consumer<Holder<Program>>)
+            programHolder -> programHolder
+                    
.set(Programs.standard(DefaultRelMetadataProvider.INSTANCE, false)))
+        .convertContains(""
+                + "LogicalProject(name=[$1])\n"
+                + "  LogicalJoin(condition=[=($0, $5)], joinType=[inner])\n"
+                + "    LogicalTableScan(table=[[hr, depts]])\n"
+                + "    LogicalTableScan(table=[[hr, emps]])\n"
+                + "");
+  }
+
+  /** Test case for
+   * <a 
href="https://issues.apache.org/jira/browse/CALCITE-5984";>[CALCITE-5984]</a>
+   * Disabling trimming of unused fields via config and program.
+   * Case: trimmingByProgram: false ; trimmingByConfig: true. */
+  @Test void testJoinWithTrimmingEnabledByConfig() {

Review Comment:
   you can use @ParameterizedTest from junit5 or make your custom input 
collection and unite 3 below tests into one, wdyt ?



-- 
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]

Reply via email to