mihaibudiu commented on code in PR #4240:
URL: https://github.com/apache/calcite/pull/4240#discussion_r1991902896


##########
core/src/main/java/org/apache/calcite/sql2rel/SqlToRelConverter.java:
##########
@@ -3458,22 +3458,20 @@ private RexNode convertUsing(SqlValidatorNamespace 
leftNamespace,
           validator().getTypeCoercion().commonTypeForBinaryComparison(
               comparedTypes.get(0), comparedTypes.get(1));
       if (resultType == null) {
-        // This should never happen, since the program has been validated.
-        throw new IllegalArgumentException("Cannot join on field `" + name
-            + "` because the types are not comparable: " + comparedTypes);
-      }
-
-      List<RexNode> castedOperands = new ArrayList<>();
-      for (int i = 0; i < operands.size(); i++) {
-        RexNode operand = operands.get(i);
-        RelDataType fieldType = comparedTypes.get(i);
-        RexNode expr = operand;
-        if (!fieldType.equals(resultType)) {
-          expr = rexBuilder.makeCast(resultType, operand, true, false);
+        list.add(rexBuilder.makeCall(SqlStdOperatorTable.EQUALS, operands));

Review Comment:
   Frankly, I never understood what it means for the result to be `null`.
   Ideally the API of the coercion would document the intended meaning.
   As least I would add a comment here explaining that the call is left 
unchanged in this case.
   I guess running multiple coercions, each of which handles some cases, is a 
legitimate use case.



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