zabetak commented on code in PR #4345:
URL: https://github.com/apache/calcite/pull/4345#discussion_r2066188356
##########
core/src/test/java/org/apache/calcite/rex/RexBuilderTest.java:
##########
@@ -960,6 +960,22 @@ private void checkDate(RexLiteral literal) {
assertThat(inCall.getKind(), is(SqlKind.SEARCH));
}
+ @Test void testMakeInWithArrayLiterals() {
+ RelDataTypeFactory typeFactory = new
SqlTypeFactoryImpl(RelDataTypeSystem.DEFAULT);
+ RexBuilder rexBuilder = new RexBuilder(typeFactory);
+ RelDataType intType = typeFactory.createSqlType(SqlTypeName.INTEGER);
+ RelDataType arrayIntType = typeFactory.createArrayType(intType, -1);
+ RexNode column = rexBuilder.makeInputRef(arrayIntType, 0);
+ RexNode l1 = rexBuilder.makeLiteral(ImmutableList.of(100, 200),
arrayIntType, false);
+ RexNode l2 = rexBuilder.makeLiteral(ImmutableList.of(300, 400),
arrayIntType, false);
+ RexNode inCall = rexBuilder.makeIn(column, ImmutableList.of(l1, l2));
+ assertThat(
+ inCall, hasToString("SEARCH($0, Sarg["
+ + "[100:INTEGER, 200:INTEGER]:INTEGER NOT NULL ARRAY, "
Review Comment:
The type of the Sarg literal is indeed `INTEGER NOT NULL ARRAY NOT NULL`
despite the fact that it does not appear in the `toString` representation.
There are various inconsistencies and potentially redundant information in
the digest/toString of Sarg literals but it's outside the scope of this PR. If
we want to change the `toString` representation then it would be better to do
in a separate JIRA.
--
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]