abhishek-das-gupta commented on code in PR #2853:
URL: https://github.com/apache/calcite/pull/2853#discussion_r990604610


##########
core/src/main/java/org/apache/calcite/rex/RexBuilder.java:
##########
@@ -1355,10 +1356,14 @@ public RexNode makeIn(RexNode arg, List<? extends 
RexNode> ranges) {
     if (areAssignable(arg, ranges)) {
       final Sarg sarg = toSarg(Comparable.class, ranges, RexUnknownAs.UNKNOWN);
       if (sarg != null) {
-        final RexNode range0 = ranges.get(0);
+        final List<RelDataType> types = ranges.stream()
+            .map(RexNode::getType)
+            .collect(Collectors.toList());
+        RelDataType searchType = typeFactory.leastRestrictive(types);
+        searchType = searchType == null ? ranges.get(0).getType() : searchType;

Review Comment:
   All the usages of `RelDataTypeFactory.leastRestrictive` handles the edge 
case where the return type is null. So I thought about defaulting to how it get 
handles now in current master.  Is it really not necessary to handle this case? 
Can you provide your thoughts on this?



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