This is an automated email from the ASF dual-hosted git repository. taoran pushed a commit to branch main in repository https://gitbox.apache.org/repos/asf/calcite.git
commit 93c62ba225ffc6f3c4a6e7c71c1e81b8df716e35 Author: Ran Tao <[email protected]> AuthorDate: Fri Dec 15 10:59:59 2023 +0800 Handle code-reviews --- .../main/java/org/apache/calcite/sql/type/OperandTypes.java | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/core/src/main/java/org/apache/calcite/sql/type/OperandTypes.java b/core/src/main/java/org/apache/calcite/sql/type/OperandTypes.java index 6d4228d1f8..8abb7c8178 100644 --- a/core/src/main/java/org/apache/calcite/sql/type/OperandTypes.java +++ b/core/src/main/java/org/apache/calcite/sql/type/OperandTypes.java @@ -1231,10 +1231,6 @@ public abstract class OperandTypes { /** * Operand type-checking strategy for a ARRAY function, it allows empty array. - * - * <p> The reason it overrides SameOperandTypeChecker#checkOperandTypesImpl is that it needs - * to handle the scenario where row/struct type and NULL exist simultaneously in array. - * This scenario need be supported, but will be rejected by the current checkOperandTypesImpl. */ private static class ArrayFunctionOperandTypeChecker extends SameOperandTypeChecker { @@ -1264,15 +1260,14 @@ public abstract class OperandTypes { for (int i : operandList) { types[i] = operatorBinding.getOperandType(i); } - int prev = -1; for (int i : operandList) { - if (prev >= 0) { + if (i > 0) { // we replace SqlTypeUtil.isComparable with SqlTypeUtil.leastRestrictiveForComparison // to handle struct type and NULL constant. // details please see: https://issues.apache.org/jira/browse/CALCITE-6163 RelDataType type = SqlTypeUtil.leastRestrictiveForComparison(operatorBinding.getTypeFactory(), - types[i], types[prev]); + types[i], types[i - 1]); if (type == null) { if (!throwOnFailure) { return false; @@ -1281,7 +1276,6 @@ public abstract class OperandTypes { RESOURCE.needSameTypeParameter()); } } - prev = i; } return true; }
