Details
-
Bug
-
Status: Closed
-
Minor
-
Resolution: Fixed
-
1.36.0
Description
The SameOperandTypeChecker claims that it checks whether operands have the same type (the class name suggests this, as does the JavaDoc).
/** * Parameter type-checking strategy where all operand types must be the same. */ public class SameOperandTypeChecker implements SqlSingleOperandTypeChecker {
But the code does something this:
for (int i : operandList) { if (prev >= 0) { if (!SqlTypeUtil.isComparable(types[i], types[prev])) {
The documentation for isComparable says:
/** * Returns whether two types are comparable. They need to be scalar types of * the same family, or struct types whose fields are pairwise comparable.
Thus the class only checks that the operands have the same type family, not the same type.
I am not sure what the right fix is, though, since changing the class name would be a pretty big breaking change. But I suspect this confusion is a source of a few bugs. An instance is CALCITE-6382
Attachments
Issue Links
- links to