This is an automated email from the ASF dual-hosted git repository. xuyang pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/doris.git
The following commit(s) were added to refs/heads/master by this push: new bd982ac815 [Bug] Fix array functions arguments mismatch (#10549) bd982ac815 is described below commit bd982ac815e7a12507f7cabcbc634fe34ed04f1b Author: xy720 <22125576+xy...@users.noreply.github.com> AuthorDate: Wed Jul 13 14:54:49 2022 +0800 [Bug] Fix array functions arguments mismatch (#10549) Currently, we convert array<Int> to array<BigInt> For example, the input array_sum([1, 2, 3]) can match function array_sum(Array<Int>) as well as array_sum(Array<BigInt>). But when a function has more than one argument, the function may be match incorrectly. For example, the input array_contains([1, 2, 3], 2147483648) will match the function array_contains(Array<BigInt>, BigInt), but the correct match should be array_contains(Array<Int>, Int) The correct match should be: array_contains([1, 2, 3], 1) match array_contains(Array<Int>, Int) array_contains([1, 2, 3], 2147483648) match array_contains(Array<Int>, Int) array_contains([2147483648, 2147483649, 2147483650], 2147483648) match array_contains(Array<BigInt>, BigInt) now is: array_contains([1, 2, 3], 1) match array_contains(Array<Int>, Int) array_contains([1, 2, 3], 2147483648) match array_contains(Array<BigInt>, BigInt) array_contains([2147483648, 2147483649, 2147483650], 2147483648) match array_contains(Array<BigInt>, BigInt) And this will cause some trouble. Assume that there are two functions being defined: Int array_functions(Array<Int>, Int) BigInt array_functions(Array<BigInt>, BigInt) And array_functions([1,2,3], 2147483648) will match BigInt array_functions(Array<BigInt>, BigInt), but the result type should not be BigInt, but should be Int. --- fe/fe-core/src/main/java/org/apache/doris/catalog/ArrayType.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) 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 ff1b51d860..26f4aa0aec 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 @@ -81,7 +81,8 @@ public class ArrayType extends Type { if (itemType.isNull() || ((ArrayType) t).getItemType().isNull()) { return true; } - return Type.isImplicitlyCastable(itemType, ((ArrayType) t).itemType, true) + + return itemType.matchesType(((ArrayType) t).itemType) && (((ArrayType) t).containsNull || !containsNull); } --------------------------------------------------------------------- To unsubscribe, e-mail: commits-unsubscr...@doris.apache.org For additional commands, e-mail: commits-h...@doris.apache.org