xiedeyantu commented on code in PR #4364:
URL: https://github.com/apache/calcite/pull/4364#discussion_r2082704189
##########
core/src/test/java/org/apache/calcite/rex/RexBuilderTest.java:
##########
@@ -981,6 +981,34 @@ inCall, hasToString("SEARCH($0, Sarg["
+ "]:INTEGER NOT NULL ARRAY)"));
}
+ /**
+ * Test case for
+ * <a
href="https://issues.apache.org/jira/browse/CALCITE-6994">[CALCITE-6994]
+ * Enhance RexBuilder#makeIn to create SEARCH for MULTISET literals</a>.
+ */
+ @Test void testMakeInReturnsSearchForMultisetLiterals() {
+ RelDataTypeFactory typeFactory = new
SqlTypeFactoryImpl(RelDataTypeSystem.DEFAULT);
+ RexBuilder rexBuilder = new RexBuilder(typeFactory);
+ RelDataType intType = typeFactory.createSqlType(SqlTypeName.INTEGER);
+ RelDataType multisetType = typeFactory.createMultisetType(intType, -1);
+ RexNode column = rexBuilder.makeInputRef(multisetType, 0);
+
+ String expected = "SEARCH($0, Sarg["
+ + "[100:INTEGER, 200:INTEGER]:INTEGER NOT NULL MULTISET, "
+ + "[300:INTEGER, 400:INTEGER]:INTEGER NOT NULL MULTISET"
+ + "]:INTEGER NOT NULL MULTISET)";
+
+ RexNode m1 = rexBuilder.makeLiteral(ImmutableList.of(100, 200),
multisetType, true);
+ RexNode m2 = rexBuilder.makeLiteral(ImmutableList.of(300, 400),
multisetType, true);
+ RexNode inCall1 = rexBuilder.makeIn(column, ImmutableList.of(m1, m2));
+ assertThat(inCall1, hasToString(expected));
+
+ RexNode m3 = rexBuilder.makeLiteral(ImmutableList.of(100, 200),
multisetType, false);
Review Comment:
> The third parameter 'allowCast' is not reflected in the test case.
The last parameter 'false' is 'allowCast'.
--
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]