beyond1920 commented on a change in pull request #2612:
URL: https://github.com/apache/calcite/pull/2612#discussion_r758033547
##########
File path: core/src/test/java/org/apache/calcite/test/RelBuilderTest.java
##########
@@ -4031,6 +4033,41 @@ private static RelNode groupIdRel(RelBuilder builder,
boolean extra) {
assertThat(root, hasTree(expected));
}
+ /**
+ * Tests {@link RelBuilder#in} would throw exception if types of the ranges
are not compatible.
+ */
+ @Test void testFilterInWithNotCompatibleArguments() {
+ try {
+ final RelBuilder b = RelBuilder.create(config().build());
+ final RelNode root = b.scan("EMP")
+ .filter(b.in(b.field(2), b.literal(1), b.literal(true)))
+ .build();
+ fail("expected error, got " + root);
+ } catch (ClassCastException e) {
+ // good
Review comment:
Good question, I once assert the exception message here. But I found
assert only success for mac, failed in Window/Linux because ClassCastException
message is minor different when run in the different environment.
So I only check the exception class here.
--
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]