Mihai Budiu created CALCITE-6383:
------------------------------------
Summary: The class SameOperandTypeChecker is incorrectly named and
documented
Key: CALCITE-6383
URL: https://issues.apache.org/jira/browse/CALCITE-6383
Project: Calcite
Issue Type: Bug
Components: core
Affects Versions: 1.36.0
Reporter: Mihai Budiu
The SameOperandTypeChecker claims that it checks whether operands have the same
type (the class name suggests this, as does the JavaDoc).
{code:java}
/**
* Parameter type-checking strategy where all operand types must be the same.
*/
public class SameOperandTypeChecker implements SqlSingleOperandTypeChecker {
{code}
But the code does something this:
{code:java}
for (int i : operandList) {
if (prev >= 0) {
if (!SqlTypeUtil.isComparable(types[i], types[prev])) {
{code}
The documentation for isComparable says:
{code:java}
/**
* Returns whether two types are comparable. They need to be scalar types of
* the same family, or struct types whose fields are pairwise comparable.
{code}
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]
--
This message was sent by Atlassian Jira
(v8.20.10#820010)