You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@calcite.apache.org by GitBox <gi...@apache.org> on 2021/11/19 07:32:06 UTC

[GitHub] [calcite] hsyuan commented on a change in pull request #2612: [CALCITE-4888] The type of Sargs which rangeSets contains multiple CHAR literals with different length should be VARCHAR (based on shouldConvertRaggedUnionTypesToVarying settings)

hsyuan commented on a change in pull request #2612:
URL: https://github.com/apache/calcite/pull/2612#discussion_r752918215



##########
File path: core/src/test/java/org/apache/calcite/test/RelBuilderTest.java
##########
@@ -4031,6 +4033,22 @@ private static RelNode groupIdRel(RelBuilder builder, boolean extra) {
     assertThat(root, hasTree(expected));
   }
 
+  @Test void testFilterInCharWithDiffLength() {
+    final Function<RelBuilder, RelNode> f = b ->
+        b.scan("EMP")
+            .filter(b.in(b.field("JOB"), b.literal("CLERK"), b.literal("A")))
+            .build();
+    final String expected =
+        "LogicalFilter(condition=[SEARCH($2, Sarg['A':CHAR(5), 'CLERK']:CHAR(5))])\n"
+            + "  LogicalTableScan(table=[[scott, EMP]])\n";
+    final String expectedWithLeastRestrictive =
+        "LogicalFilter(condition=[SEARCH($2, Sarg['A':VARCHAR(5), 'CLERK':VARCHAR(5)]:VARCHAR(5))])\n"
+        + "  LogicalTableScan(table=[[scott, EMP]])\n";
+    assertThat(f.apply(createBuilder()), hasTree(expected));
+    assertThat(f.apply(RelBuilder.create(config().typeSystem(VaryingTypeSystem.INSTANCE).build())),
+        hasTree(expectedWithLeastRestrictive));
+  }
+

Review comment:
       Can you add a case for `(a,b) in (('1','1'), ('22', '333'))`?




-- 
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: commits-unsubscribe@calcite.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org