Skip to content

Commit

Permalink
Handle code-reviews
Browse files Browse the repository at this point in the history
  • Loading branch information
chucheng92 committed Dec 15, 2023
1 parent 8b86e86 commit 855e39c
Showing 1 changed file with 2 additions and 8 deletions.
10 changes: 2 additions & 8 deletions core/src/main/java/org/apache/calcite/sql/type/OperandTypes.java
Original file line number Diff line number Diff line change
Expand Up @@ -1231,10 +1231,6 @@ private static class MapFromEntriesOperandTypeChecker

/**
* 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 {
Expand Down Expand Up @@ -1264,15 +1260,14 @@ private static class ArrayFunctionOperandTypeChecker
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;
Expand All @@ -1281,7 +1276,6 @@ private static class ArrayFunctionOperandTypeChecker
RESOURCE.needSameTypeParameter());
}
}
prev = i;
}
return true;
}
Expand Down

0 comments on commit 855e39c

Please sign in to comment.