From fef37990a39a2404dd49ee835947665d51b66d83 Mon Sep 17 00:00:00 2001 From: xy720 <22125576+xy720@users.noreply.github.com> Date: Mon, 15 Aug 2022 21:29:57 +0800 Subject: [PATCH] [fix](array-type) Fix incorrect in function-set for array type (#11585) There is some wrong logic in FunctionSet.java and it may causes potential risks for array functions invoke. --- .../src/main/java/org/apache/doris/catalog/ArrayType.java | 2 +- .../src/main/java/org/apache/doris/catalog/FunctionSet.java | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/fe/fe-core/src/main/java/org/apache/doris/catalog/ArrayType.java b/fe/fe-core/src/main/java/org/apache/doris/catalog/ArrayType.java index a2a9092b10..4e1441fdbe 100644 --- a/fe/fe-core/src/main/java/org/apache/doris/catalog/ArrayType.java +++ b/fe/fe-core/src/main/java/org/apache/doris/catalog/ArrayType.java @@ -118,7 +118,7 @@ public class ArrayType extends Type { return false; } ArrayType otherArrayType = (ArrayType) other; - return otherArrayType.itemType.equals(itemType); + return otherArrayType.itemType.equals(itemType) && otherArrayType.containsNull == containsNull; } public static boolean canCastTo(ArrayType type, ArrayType targetType) { diff --git a/fe/fe-core/src/main/java/org/apache/doris/catalog/FunctionSet.java b/fe/fe-core/src/main/java/org/apache/doris/catalog/FunctionSet.java index 5e9b89c790..fd6fad49f9 100644 --- a/fe/fe-core/src/main/java/org/apache/doris/catalog/FunctionSet.java +++ b/fe/fe-core/src/main/java/org/apache/doris/catalog/FunctionSet.java @@ -1200,7 +1200,7 @@ public class FunctionSet { if (!(descArgTypes[0] instanceof ScalarType) || !(candicateArgTypes[0] instanceof ScalarType)) { if (candicateArgTypes[0] instanceof ArrayType) { - return candicateArgTypes[0].matchesType(descArgTypes[0]); + return descArgTypes[0].matchesType(candicateArgTypes[0]); } return false;