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


##########
core/src/main/java/org/apache/calcite/sql2rel/SqlToRelConverter.java:
##########
@@ -3443,12 +3444,32 @@ private RexNode convertUsing(SqlValidatorNamespace 
leftNamespace,
           throw new AssertionError("field " + name + " is not found in "
               + rowType + " with " + nameMatcher);
         }
+
+        fieldTypes.add(field.getType());
         operands.add(
             rexBuilder.makeInputRef(field.getType(),
                 offset + field.getIndex()));
         offset += rowType.getFieldList().size();
       }
-      list.add(rexBuilder.makeCall(SqlStdOperatorTable.EQUALS, operands));
+
+      RelDataType resultType =
+          validator().getTypeCoercion().commonTypeForBinaryComparison(
+              fieldTypes.get(0), fieldTypes.get(1));
+      if (resultType == null) {
+        throw new IllegalArgumentException("Cannot compute compatible row 
type: " + fieldTypes);

Review Comment:
   I have checked, the validator will reject a program with a message like 
   `Column 'X' matched using NATURAL keyword or USING clause has incompatible 
types: cannot compare`
   I will add a comment that the exception is supposed to be unreachable.
   



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