You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@doris.apache.org by kx...@apache.org on 2024/09/26 01:38:58 UTC
(doris) branch master updated: [fix](array-funcs)fix array agg func with decimal type (#40839)
This is an automated email from the ASF dual-hosted git repository.
kxiao 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 16d05dc2f9d [fix](array-funcs)fix array agg func with decimal type (#40839)
16d05dc2f9d is described below
commit 16d05dc2f9ddacce88f40acf32b31c2586c779fa
Author: amory <wa...@selectdb.com>
AuthorDate: Thu Sep 26 09:38:50 2024 +0800
[fix](array-funcs)fix array agg func with decimal type (#40839)
---
.../functions/array/function_array_aggregation.cpp | 13 +
.../functions/ComputePrecisionForArrayItemAgg.java | 10 +-
.../functions/scalar/ArraysOverlap.java | 3 +-
.../nereids_function_p0/scalar_function/Array.out | 816 +++++++++++++++++++++
.../test_array_large_decimal.csv | 100 +++
.../suites/nereids_function_p0/load.groovy | 22 +
.../scalar_function/Array.groovy | 33 +
7 files changed, 994 insertions(+), 3 deletions(-)
diff --git a/be/src/vec/functions/array/function_array_aggregation.cpp b/be/src/vec/functions/array/function_array_aggregation.cpp
index d2edfe34fb6..18367816bc8 100644
--- a/be/src/vec/functions/array/function_array_aggregation.cpp
+++ b/be/src/vec/functions/array/function_array_aggregation.cpp
@@ -146,6 +146,18 @@ struct ArrayAggregateImpl {
using Function = AggregateFunction<AggregateFunctionImpl<operation>>;
const DataTypeArray* data_type_array =
static_cast<const DataTypeArray*>(remove_nullable(arguments[0]).get());
+ if constexpr (operation != AggregateOperation::MIN &&
+ operation != AggregateOperation::MAX) {
+ // only array_min and array_max support decimal256 type
+ if (is_decimal(remove_nullable(data_type_array->get_nested_type()))) {
+ const auto decimal_type = remove_nullable(data_type_array->get_nested_type());
+ if (check_decimal<Decimal256>(*decimal_type)) {
+ throw doris::Exception(
+ ErrorCode::INVALID_ARGUMENT, "Unexpected type {} for aggregation {}",
+ data_type_array->get_nested_type()->get_name(), operation);
+ }
+ }
+ }
auto function = Function::create(data_type_array->get_nested_type());
if (function) {
return function->get_return_type();
@@ -175,6 +187,7 @@ struct ArrayAggregateImpl {
execute_type<Decimal64>(res, type, data, offsets) ||
execute_type<Decimal128V2>(res, type, data, offsets) ||
execute_type<Decimal128V3>(res, type, data, offsets) ||
+ execute_type<Decimal256>(res, type, data, offsets) ||
execute_type<Date>(res, type, data, offsets) ||
execute_type<DateTime>(res, type, data, offsets) ||
execute_type<DateV2>(res, type, data, offsets) ||
diff --git a/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/functions/ComputePrecisionForArrayItemAgg.java b/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/functions/ComputePrecisionForArrayItemAgg.java
index 50c9f1adfdb..05efb92222b 100644
--- a/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/functions/ComputePrecisionForArrayItemAgg.java
+++ b/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/functions/ComputePrecisionForArrayItemAgg.java
@@ -21,6 +21,7 @@ import org.apache.doris.catalog.FunctionSignature;
import org.apache.doris.nereids.types.ArrayType;
import org.apache.doris.nereids.types.DataType;
import org.apache.doris.nereids.types.DecimalV3Type;
+import org.apache.doris.qe.ConnectContext;
/** ComputePrecisionForSum */
public interface ComputePrecisionForArrayItemAgg extends ComputePrecision {
@@ -29,8 +30,15 @@ public interface ComputePrecisionForArrayItemAgg extends ComputePrecision {
if (getArgumentType(0) instanceof ArrayType) {
DataType itemType = ((ArrayType) getArgument(0).getDataType()).getItemType();
if (itemType instanceof DecimalV3Type) {
+ boolean enableDecimal256 = false;
+ ConnectContext connectContext = ConnectContext.get();
+ if (connectContext != null) {
+ enableDecimal256 = connectContext.getSessionVariable().isEnableDecimal256();
+ }
DecimalV3Type returnType = DecimalV3Type.createDecimalV3Type(
- DecimalV3Type.MAX_DECIMAL128_PRECISION, ((DecimalV3Type) itemType).getScale());
+ enableDecimal256 ? DecimalV3Type.MAX_DECIMAL256_PRECISION
+ : DecimalV3Type.MAX_DECIMAL128_PRECISION,
+ ((DecimalV3Type) itemType).getScale());
if (signature.returnType instanceof ArrayType) {
signature = signature.withReturnType(ArrayType.of(returnType));
} else {
diff --git a/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/functions/scalar/ArraysOverlap.java b/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/functions/scalar/ArraysOverlap.java
index 9e40d732644..d3c200cb92e 100644
--- a/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/functions/scalar/ArraysOverlap.java
+++ b/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/functions/scalar/ArraysOverlap.java
@@ -26,7 +26,6 @@ import org.apache.doris.nereids.trees.expressions.visitor.ExpressionVisitor;
import org.apache.doris.nereids.types.ArrayType;
import org.apache.doris.nereids.types.BooleanType;
import org.apache.doris.nereids.types.coercion.AnyDataType;
-import org.apache.doris.nereids.types.coercion.FollowToAnyDataType;
import com.google.common.base.Preconditions;
import com.google.common.collect.ImmutableList;
@@ -41,7 +40,7 @@ public class ArraysOverlap extends ScalarFunction implements ExplicitlyCastableS
public static final List<FunctionSignature> SIGNATURES = ImmutableList.of(
FunctionSignature.ret(BooleanType.INSTANCE)
- .args(ArrayType.of(new AnyDataType(0)), ArrayType.of(new FollowToAnyDataType(0)))
+ .args(ArrayType.of(new AnyDataType(0)), ArrayType.of(new AnyDataType(0)))
);
/**
diff --git a/regression-test/data/nereids_function_p0/scalar_function/Array.out b/regression-test/data/nereids_function_p0/scalar_function/Array.out
index dc519c96ad3..cbfbf3a9519 100644
--- a/regression-test/data/nereids_function_p0/scalar_function/Array.out
+++ b/regression-test/data/nereids_function_p0/scalar_function/Array.out
@@ -14454,6 +14454,822 @@ true
-- !sql_array_map --
[1, 1, 1, 1]
+-- !sql_array_min_decimal256 --
+1.12345678901234567890123456789012345600000000000000000000
+1234567890.09876543210987654321098765432109876500000000000000000000
+12345678901234567.43210987654321098765432109876543210900000000000000000000
+123456789012345678.23456789012345678901234567890123456700000000000000000000
+123456789012345678.23456789012345678901234567890123456700000000000000000000
+1234567890123456789.09876543210987654321098765432109876500000000000000000000
+1234567890123456789.09876543210987654321098765432109876500000000000000000000
+1234567890123456789.34567890123456789012345678901234567800000000000000000000
+1234567890123456789.43210987654321098765432109876543210900000000000000000000
+1234567890123456789.54321098765432109876543210987654321000000000000000000000
+1234567890123456789.54321098765432109876543210987654321000000000000000000000
+1234567890123456789.65432109876543210987654321098765432100000000000000000000
+1234567890123456789.65432109876543210987654321098765432100000000000000000000
+1234567890123456789.98765432109876543210987654321098765400000000000000000000
+1234567890123456789.98765432109876543210987654321098765400000000000000000000
+12345678901234567890.09876543210987654321098765432109876500000000000000000000
+12345678901234567890.09876543210987654321098765432109876500000000000000000000
+12345678901234567890.23456789012345678901234567890123456700000000000000000000
+12345678901234567890.54321098765432109876543210987654321000000000000000000000
+12345678901234567890.65432109876543210987654321098765432100000000000000000000
+12345678901234567890.65432109876543210987654321098765432100000000000000000000
+12345678901234567890.98765432109876543210987654321098765400000000000000000000
+2345678901234567.56789012345678901234567890123456789000000000000000000000
+234567890123456789.54321098765432109876543210987654321000000000000000000000
+234567890123456789.65432109876543210987654321098765432100000000000000000000
+2345678901234567890.09876543210987654321098765432109876500000000000000000000
+2345678901234567890.23456789012345678901234567890123456700000000000000000000
+2345678901234567890.54321098765432109876543210987654321000000000000000000000
+2345678901234567890.98765432109876543210987654321098765400000000000000000000
+23456789012345678901.65432109876543210987654321098765432100000000000000000000
+23456789012345678901.65432109876543210987654321098765432100000000000000000000
+23456789012345678901.87654321098765432109876543210987654321000000000000000000
+345678901234567890.23456789012345678901234567890123456700000000000000000000
+345678901234567890.34567890123456789012345678901234567800000000000000000000
+345678901234567890.65432109876543210987654321098765432100000000000000000000
+345678901234567890.98765432109876543210987654321098765400000000000000000000
+3456789012345678901.09876543210987654321098765432109876500000000000000000000
+3456789012345678901.23456789012345678901234567890123456700000000000000000000
+3456789012345678901.34567890123456789012345678901234567800000000000000000000
+3456789012345678901.87654321098765432109876543210987654321000000000000000000
+3456789012345678901.98765432109876543210987654321098765400000000000000000000
+34567890123456789012.09876543210987654321098765432109876500000000000000000000
+34567890123456789012.43210987654321098765432109876543210900000000000000000000
+4567890123456789.09876543210987654321098765432109876500000000000000000000
+4567890123456789012.12345678901234567890123456789012345600000000000000000000
+4567890123456789012.12345678901234567890123456789012345600000000000000000000
+4567890123456789012.23456789012345678901234567890123456700000000000000000000
+4567890123456789012.65432109876543210987654321098765432100000000000000000000
+4567890123456789012.98765432109876543210987654321098765400000000000000000000
+45678901234567890123.12345678901234567890123456789012345600000000000000000000
+567890123456789012.34567890123456789012345678901234567800000000000000000000
+567890123456789012.54321098765432109876543210987654321000000000000000000000
+5678901234567890123.23456789012345678901234567890123456700000000000000000000
+5678901234567890123.43210987654321098765432109876543210900000000000000000000
+5678901234567890123.65432109876543210987654321098765432100000000000000000000
+5678901234567890123.87654321098765432109876543210987654321000000000000000000
+5678901234567890123.98765432109876543210987654321098765400000000000000000000
+56789012345678901234.34567890123456789012345678901234567800000000000000000000
+56789012345678901234.43210987654321098765432109876543210900000000000000000000
+56789012345678901234.54321098765432109876543210987654321000000000000000000000
+67890123456789012.34567890123456789012345678901234567800000000000000000000
+67890123456789012.98765432109876543210987654321098765400000000000000000000
+678901234567890123.09876543210987654321098765432109876500000000000000000000
+678901234567890123.43210987654321098765432109876543210900000000000000000000
+678901234567890123.43210987654321098765432109876543210900000000000000000000
+678901234567890123.54321098765432109876543210987654321000000000000000000000
+6789012345678901234.12345678901234567890123456789012345600000000000000000000
+6789012345678901234.98765432109876543210987654321098765400000000000000000000
+67890123456789012345.12345678901234567890123456789012345600000000000000000000
+67890123456789012345.67890123456789012345678901234567890100000000000000000000
+789012345678901234.12345678901234567890123456789012345600000000000000000000
+789012345678901234.34567890123456789012345678901234567800000000000000000000
+789012345678901234.65432109876543210987654321098765432100000000000000000000
+789012345678901234.87654321098765432109876543210987654321000000000000000000
+7890123456789012345.09876543210987654321098765432109876500000000000000000000
+7890123456789012345.09876543210987654321098765432109876500000000000000000000
+7890123456789012345.09876543210987654321098765432109876500000000000000000000
+7890123456789012345.54321098765432109876543210987654321000000000000000000000
+7890123456789012345.98765432109876543210987654321098765400000000000000000000
+78901234567890123456.09876543210987654321098765432109876500000000000000000000
+78901234567890123456.23456789012345678901234567890123456700000000000000000000
+78901234567890123456.65432109876543210987654321098765432100000000000000000000
+89012345678901234.34567890123456789012345678901234567800000000000000000000
+89012345678901234.98765432109876543210987654321098765400000000000000000000
+890123456789012345.09876543210987654321098765432109876500000000000000000000
+890123456789012345.12345678901234567890123456789012345600000000000000000000
+890123456789012345.54321098765432109876543210987654321000000000000000000000
+8901234567890123456.23456789012345678901234567890123456700000000000000000000
+8901234567890123456.34567890123456789012345678901234567800000000000000000000
+8901234567890123456.43210987654321098765432109876543210900000000000000000000
+8901234567890123456.87654321098765432109876543210987654321000000000000000000
+8901234567890123456.98765432109876543210987654321098765400000000000000000000
+8901234567890123456.98765432109876543210987654321098765400000000000000000000
+8901234567890123456.98765432109876543210987654321098765400000000000000000000
+89012345678901234567.09876543210987654321098765432109876500000000000000000000
+89012345678901234567.43210987654321098765432109876543210900000000000000000000
+89012345678901234567.54321098765432109876543210987654321000000000000000000000
+89012345678901234567.87654321098765432109876543210987654321000000000000000000
+9876543210.54321098765432109876543210987654321000000000000000000000
+98765432109876543210.65432109876543210987654321098765432100000000000000000000
+
+-- !sql_array_max_decimal256 --
+1.12345678901234567890123456789012345600000000000000000000
+1234567890.09876543210987654321098765432109876500000000000000000000
+12345678901234567.43210987654321098765432109876543210900000000000000000000
+123456789012345678.23456789012345678901234567890123456700000000000000000000
+123456789012345678.23456789012345678901234567890123456700000000000000000000
+1234567890123456789.09876543210987654321098765432109876500000000000000000000
+1234567890123456789.09876543210987654321098765432109876500000000000000000000
+1234567890123456789.34567890123456789012345678901234567800000000000000000000
+1234567890123456789.43210987654321098765432109876543210900000000000000000000
+1234567890123456789.54321098765432109876543210987654321000000000000000000000
+1234567890123456789.54321098765432109876543210987654321000000000000000000000
+1234567890123456789.65432109876543210987654321098765432100000000000000000000
+1234567890123456789.65432109876543210987654321098765432100000000000000000000
+1234567890123456789.98765432109876543210987654321098765400000000000000000000
+1234567890123456789.98765432109876543210987654321098765400000000000000000000
+12345678901234567890.09876543210987654321098765432109876500000000000000000000
+12345678901234567890.09876543210987654321098765432109876500000000000000000000
+12345678901234567890.23456789012345678901234567890123456700000000000000000000
+12345678901234567890.54321098765432109876543210987654321000000000000000000000
+12345678901234567890.65432109876543210987654321098765432100000000000000000000
+12345678901234567890.65432109876543210987654321098765432100000000000000000000
+12345678901234567890.98765432109876543210987654321098765400000000000000000000
+2345678901234567.56789012345678901234567890123456789000000000000000000000
+234567890123456789.54321098765432109876543210987654321000000000000000000000
+234567890123456789.65432109876543210987654321098765432100000000000000000000
+2345678901234567890.09876543210987654321098765432109876500000000000000000000
+2345678901234567890.23456789012345678901234567890123456700000000000000000000
+2345678901234567890.54321098765432109876543210987654321000000000000000000000
+2345678901234567890.98765432109876543210987654321098765400000000000000000000
+23456789012345678901.65432109876543210987654321098765432100000000000000000000
+23456789012345678901.65432109876543210987654321098765432100000000000000000000
+23456789012345678901.87654321098765432109876543210987654321000000000000000000
+345678901234567890.23456789012345678901234567890123456700000000000000000000
+345678901234567890.34567890123456789012345678901234567800000000000000000000
+345678901234567890.65432109876543210987654321098765432100000000000000000000
+345678901234567890.98765432109876543210987654321098765400000000000000000000
+3456789012345678901.09876543210987654321098765432109876500000000000000000000
+3456789012345678901.23456789012345678901234567890123456700000000000000000000
+3456789012345678901.34567890123456789012345678901234567800000000000000000000
+3456789012345678901.87654321098765432109876543210987654321000000000000000000
+3456789012345678901.98765432109876543210987654321098765400000000000000000000
+34567890123456789012.09876543210987654321098765432109876500000000000000000000
+34567890123456789012.43210987654321098765432109876543210900000000000000000000
+4567890123456789.09876543210987654321098765432109876500000000000000000000
+4567890123456789012.12345678901234567890123456789012345600000000000000000000
+4567890123456789012.12345678901234567890123456789012345600000000000000000000
+4567890123456789012.23456789012345678901234567890123456700000000000000000000
+4567890123456789012.65432109876543210987654321098765432100000000000000000000
+4567890123456789012.98765432109876543210987654321098765400000000000000000000
+45678901234567890123.12345678901234567890123456789012345600000000000000000000
+567890123456789012.34567890123456789012345678901234567800000000000000000000
+567890123456789012.54321098765432109876543210987654321000000000000000000000
+5678901234567890123.23456789012345678901234567890123456700000000000000000000
+5678901234567890123.43210987654321098765432109876543210900000000000000000000
+5678901234567890123.65432109876543210987654321098765432100000000000000000000
+5678901234567890123.87654321098765432109876543210987654321000000000000000000
+5678901234567890123.98765432109876543210987654321098765400000000000000000000
+56789012345678901234.34567890123456789012345678901234567800000000000000000000
+56789012345678901234.43210987654321098765432109876543210900000000000000000000
+56789012345678901234.54321098765432109876543210987654321000000000000000000000
+67890123456789012.34567890123456789012345678901234567800000000000000000000
+67890123456789012.98765432109876543210987654321098765400000000000000000000
+678901234567890123.09876543210987654321098765432109876500000000000000000000
+678901234567890123.43210987654321098765432109876543210900000000000000000000
+678901234567890123.43210987654321098765432109876543210900000000000000000000
+678901234567890123.54321098765432109876543210987654321000000000000000000000
+6789012345678901234.12345678901234567890123456789012345600000000000000000000
+6789012345678901234.98765432109876543210987654321098765400000000000000000000
+67890123456789012345.12345678901234567890123456789012345600000000000000000000
+67890123456789012345.67890123456789012345678901234567890100000000000000000000
+789012345678901234.12345678901234567890123456789012345600000000000000000000
+789012345678901234.34567890123456789012345678901234567800000000000000000000
+789012345678901234.65432109876543210987654321098765432100000000000000000000
+789012345678901234.87654321098765432109876543210987654321000000000000000000
+7890123456789012345.09876543210987654321098765432109876500000000000000000000
+7890123456789012345.09876543210987654321098765432109876500000000000000000000
+7890123456789012345.09876543210987654321098765432109876500000000000000000000
+7890123456789012345.54321098765432109876543210987654321000000000000000000000
+7890123456789012345.98765432109876543210987654321098765400000000000000000000
+78901234567890123456.09876543210987654321098765432109876500000000000000000000
+78901234567890123456.23456789012345678901234567890123456700000000000000000000
+78901234567890123456.65432109876543210987654321098765432100000000000000000000
+89012345678901234.34567890123456789012345678901234567800000000000000000000
+89012345678901234.98765432109876543210987654321098765400000000000000000000
+890123456789012345.09876543210987654321098765432109876500000000000000000000
+890123456789012345.12345678901234567890123456789012345600000000000000000000
+890123456789012345.54321098765432109876543210987654321000000000000000000000
+8901234567890123456.23456789012345678901234567890123456700000000000000000000
+8901234567890123456.34567890123456789012345678901234567800000000000000000000
+8901234567890123456.43210987654321098765432109876543210900000000000000000000
+8901234567890123456.87654321098765432109876543210987654321000000000000000000
+8901234567890123456.98765432109876543210987654321098765400000000000000000000
+8901234567890123456.98765432109876543210987654321098765400000000000000000000
+8901234567890123456.98765432109876543210987654321098765400000000000000000000
+89012345678901234567.09876543210987654321098765432109876500000000000000000000
+89012345678901234567.43210987654321098765432109876543210900000000000000000000
+89012345678901234567.54321098765432109876543210987654321000000000000000000000
+89012345678901234567.87654321098765432109876543210987654321000000000000000000
+9876543210.54321098765432109876543210987654321000000000000000000000
+98765432109876543210.65432109876543210987654321098765432100000000000000000000
+
+-- !sql_array_overlaps_1 --
+\N
+\N
+\N
+\N
+\N
+\N
+\N
+\N
+\N
+\N
+\N
+\N
+\N
+\N
+\N
+\N
+\N
+\N
+\N
+\N
+\N
+\N
+\N
+\N
+\N
+\N
+\N
+\N
+\N
+\N
+\N
+\N
+false
+false
+false
+false
+false
+false
+false
+false
+false
+false
+false
+false
+false
+false
+false
+false
+false
+false
+false
+false
+false
+false
+false
+false
+false
+false
+false
+false
+false
+false
+false
+false
+false
+false
+false
+false
+false
+false
+false
+false
+false
+false
+false
+false
+false
+false
+false
+false
+false
+false
+false
+false
+false
+false
+false
+false
+false
+false
+false
+false
+false
+false
+false
+false
+false
+false
+false
+false
+
+-- !sql_array_overlaps_2 --
+\N
+\N
+\N
+\N
+\N
+\N
+\N
+\N
+\N
+\N
+\N
+\N
+\N
+\N
+\N
+\N
+\N
+\N
+\N
+\N
+\N
+\N
+\N
+\N
+\N
+\N
+\N
+\N
+\N
+\N
+\N
+\N
+false
+false
+false
+false
+false
+false
+false
+false
+false
+false
+false
+false
+false
+false
+false
+false
+false
+false
+false
+false
+false
+false
+false
+false
+false
+false
+false
+false
+false
+false
+false
+false
+false
+false
+false
+false
+false
+false
+false
+false
+false
+false
+false
+false
+false
+false
+false
+false
+false
+false
+false
+false
+false
+false
+false
+false
+false
+false
+false
+false
+false
+false
+false
+false
+false
+false
+false
+false
+
+-- !sql_array_overlaps_3 --
+\N
+\N
+\N
+\N
+\N
+\N
+\N
+\N
+\N
+\N
+\N
+\N
+\N
+\N
+\N
+\N
+\N
+\N
+\N
+\N
+\N
+\N
+\N
+\N
+\N
+\N
+\N
+\N
+\N
+\N
+\N
+\N
+\N
+\N
+\N
+\N
+\N
+\N
+\N
+\N
+\N
+\N
+\N
+\N
+\N
+\N
+\N
+\N
+\N
+\N
+\N
+\N
+\N
+\N
+\N
+\N
+\N
+\N
+\N
+\N
+\N
+\N
+\N
+\N
+\N
+\N
+\N
+\N
+\N
+\N
+\N
+\N
+\N
+\N
+\N
+\N
+\N
+\N
+\N
+\N
+\N
+\N
+\N
+\N
+\N
+\N
+\N
+\N
+\N
+\N
+\N
+\N
+\N
+\N
+\N
+\N
+\N
+\N
+\N
+\N
+
+-- !sql_array_overlaps_4 --
+\N
+\N
+\N
+\N
+\N
+\N
+\N
+\N
+\N
+\N
+\N
+\N
+\N
+\N
+\N
+\N
+\N
+\N
+\N
+\N
+\N
+\N
+\N
+\N
+\N
+\N
+\N
+\N
+\N
+\N
+\N
+\N
+\N
+\N
+\N
+\N
+\N
+\N
+\N
+\N
+\N
+\N
+\N
+\N
+\N
+\N
+\N
+\N
+\N
+\N
+\N
+\N
+\N
+\N
+\N
+\N
+\N
+\N
+\N
+\N
+\N
+\N
+\N
+\N
+\N
+\N
+\N
+\N
+\N
+\N
+\N
+\N
+\N
+\N
+\N
+\N
+\N
+\N
+\N
+\N
+\N
+\N
+\N
+\N
+\N
+\N
+\N
+\N
+\N
+\N
+\N
+\N
+\N
+\N
+\N
+\N
+\N
+\N
+\N
+\N
+
+-- !sql_array_overlaps_5 --
+\N
+\N
+\N
+\N
+\N
+\N
+\N
+\N
+\N
+\N
+\N
+\N
+\N
+\N
+\N
+\N
+\N
+\N
+\N
+\N
+\N
+\N
+\N
+\N
+\N
+\N
+\N
+\N
+\N
+\N
+\N
+\N
+\N
+\N
+\N
+\N
+\N
+\N
+\N
+\N
+\N
+\N
+\N
+\N
+\N
+\N
+\N
+\N
+\N
+\N
+\N
+\N
+\N
+\N
+\N
+\N
+\N
+\N
+\N
+\N
+\N
+\N
+\N
+\N
+\N
+\N
+\N
+\N
+\N
+\N
+\N
+\N
+\N
+\N
+\N
+\N
+\N
+\N
+\N
+\N
+\N
+\N
+\N
+\N
+\N
+\N
+\N
+\N
+\N
+\N
+\N
+\N
+\N
+\N
+\N
+\N
+\N
+\N
+\N
+\N
+
+-- !sql_array_overlaps_6 --
+\N
+\N
+\N
+\N
+\N
+\N
+\N
+\N
+\N
+\N
+\N
+\N
+\N
+\N
+\N
+\N
+\N
+\N
+\N
+\N
+\N
+\N
+\N
+\N
+\N
+\N
+\N
+\N
+\N
+\N
+\N
+\N
+\N
+\N
+\N
+\N
+\N
+\N
+\N
+\N
+\N
+\N
+\N
+\N
+\N
+\N
+\N
+\N
+\N
+\N
+\N
+\N
+\N
+\N
+\N
+\N
+\N
+\N
+\N
+\N
+\N
+\N
+\N
+\N
+\N
+\N
+\N
+\N
+\N
+\N
+\N
+\N
+\N
+\N
+\N
+\N
+\N
+\N
+\N
+\N
+\N
+\N
+\N
+\N
+\N
+\N
+\N
+\N
+\N
+\N
+\N
+\N
+\N
+\N
+\N
+\N
+\N
+\N
+\N
+\N
+
-- !sql_array_match_any_1 --
["a", "b", "c"] true
["a", null, "c"] true
diff --git a/regression-test/data/nereids_function_p0/test_array_large_decimal.csv b/regression-test/data/nereids_function_p0/test_array_large_decimal.csv
new file mode 100644
index 00000000000..1c770088269
--- /dev/null
+++ b/regression-test/data/nereids_function_p0/test_array_large_decimal.csv
@@ -0,0 +1,100 @@
+1;[1, null];[100];[1.123456789012345678901234567890123456, null]
+2;[2, 3];[200, 300];[1234567890.098765432109876543210987654321098765, null]
+3;[4, null];[400];[45678901234567890123.123456789012345678901234567890123456, null]
+4;[5];[500];[9876543210.543210987654321098765432109876543210, null]
+5;[6, 7];[600, 700];[12345678901234567890.234567890123456789012345678901234567, null]
+6;[8];[800];[3456789012345678901.876543210987654321098765432109876543210, null]
+7;[9, null];[900];[6789012345678901234.123456789012345678901234567890123456, null]
+8;[10, 11];[1000, 1100];[89012345678901234567.543210987654321098765432109876543210, null]
+9;[12];[1200];[123456789012345678.234567890123456789012345678901234567, null]
+10;[13, null];[1300];[4567890123456789.098765432109876543210987654321098765, null]
+11;[14, 15];[1400, 1500];[98765432109876543210.654321098765432109876543210987654321, null]
+12;[16, null];[1600];[1234567890123456789.987654321098765432109876543210987654, null]
+13;[17];[1700];[2345678901234567890.543210987654321098765432109876543210, null]
+14;[18, 19];[1800, 1900];[34567890123456789012.432109876543210987654321098765432109, null]
+15;[20];[2000];[67890123456789012345.678901234567890123456789012345678901, null]
+16;[21, null];[2100];[8901234567890123456.345678901234567890123456789012345678, null]
+17;[22, 23];[2200, 2300];[12345678901234567890.987654321098765432109876543210987654, null]
+18;[24];[2400];[345678901234567890.234567890123456789012345678901234567, null]
+19;[25, null];[2500];[4567890123456789012.654321098765432109876543210987654321, null]
+20;[26, 27];[2600, 2700];[67890123456789012.345678901234567890123456789012345678, null]
+21;[28, null];[2800];[789012345678901234.876543210987654321098765432109876543210, null]
+22;[29, 30];[2900, 3000];[12345678901234567.432109876543210987654321098765432109, null]
+23;[31];[3100];[2345678901234567.567890123456789012345678901234567890, null]
+24;[32, null];[3200];[89012345678901234567.098765432109876543210987654321098765, null]
+25;[33];[3300];[4567890123456789012.234567890123456789012345678901234567, null]
+26;[34, 35];[3400, 3500];[6789012345678901234.987654321098765432109876543210987654, null]
+27;[36];[3600];[7890123456789012345.543210987654321098765432109876543210, null]
+28;[37, 38];[3700, 3800];[1234567890123456789.345678901234567890123456789012345678, null]
+29;[39];[3900];[89012345678901234567.432109876543210987654321098765432109, null]
+30;[40, 41];[4000, 4100];[234567890123456789.543210987654321098765432109876543210, null]
+31;[42];[4200];[123456789012345678.234567890123456789012345678901234567, null]
+32;[43, null];[4300];[5678901234567890123.987654321098765432109876543210987654, null]
+33;[44];[4400];[3456789012345678901.345678901234567890123456789012345678, null]
+34;[45, 46];[4500, 4600];[789012345678901234.123456789012345678901234567890123456, null]
+35;[47];[4700];[89012345678901234567.876543210987654321098765432109876543210, null]
+36;[48, null];[4800];[12345678901234567890.543210987654321098765432109876543210, null]
+37;[49];[4900];[56789012345678901234.345678901234567890123456789012345678, null]
+38;[50, 51];[5000, 5100];[678901234567890123.432109876543210987654321098765432109, null]
+39;[52];[5200];[7890123456789012345.098765432109876543210987654321098765, null]
+40;[53, null];[5300];[1234567890123456789.654321098765432109876543210987654321, null]
+41;[54, 55];[5400, 5500];[3456789012345678901.987654321098765432109876543210987654, null]
+42;[56];[5600];[2345678901234567890.234567890123456789012345678901234567, null]
+43;[57, 58];[5700, 5800];[12345678901234567890.098765432109876543210987654321098765, null]
+44;[59];[5900];[67890123456789012.987654321098765432109876543210987654, null]
+45;[60, null];[6000];[8901234567890123456.876543210987654321098765432109876543210, null]
+46;[61];[6100];[1234567890123456789.654321098765432109876543210987654321, null]
+47;[62, 63];[6200, 6300];[5678901234567890123.234567890123456789012345678901234567, null]
+48;[64];[6400];[23456789012345678901.654321098765432109876543210987654321, null]
+49;[65, null];[6500];[345678901234567890.987654321098765432109876543210987654, null]
+50;[66, 67];[6600, 6700];[5678901234567890123.432109876543210987654321098765432109, null]
+51;[68];[6800];[789012345678901234.654321098765432109876543210987654321, null]
+52;[69, 70];[6900, 7000];[890123456789012345.123456789012345678901234567890123456, null]
+53;[71];[7100];[1234567890123456789.098765432109876543210987654321098765, null]
+54;[72, null];[7200];[5678901234567890123.654321098765432109876543210987654321, null]
+55;[73];[7300];[789012345678901234.345678901234567890123456789012345678, null]
+56;[74, 75];[7400, 7500];[8901234567890123456.987654321098765432109876543210987654, null]
+57;[76];[7600];[2345678901234567890.098765432109876543210987654321098765, null]
+58;[77, 78];[7700, 7800];[12345678901234567890.654321098765432109876543210987654321, null]
+59;[79];[7900];[89012345678901234.345678901234567890123456789012345678, null]
+60;[80, null];[8000];[34567890123456789012.098765432109876543210987654321098765, null]
+61;[81];[8100];[567890123456789012.543210987654321098765432109876543210, null]
+62;[82, 83];[8200, 8300];[67890123456789012345.123456789012345678901234567890123456, null]
+63;[84];[8400];[1234567890123456789.098765432109876543210987654321098765, null]
+64;[85, null];[8500];[23456789012345678901.654321098765432109876543210987654321, null]
+65;[86, 87];[8600, 8700];[345678901234567890.345678901234567890123456789012345678, null]
+66;[88];[8800];[4567890123456789012.987654321098765432109876543210987654, null]
+67;[89, null];[8900];[678901234567890123.432109876543210987654321098765432109, null]
+68;[90, 91];[9000, 9100];[7890123456789012345.098765432109876543210987654321098765, null]
+69;[92];[9200];[89012345678901234.987654321098765432109876543210987654, null]
+70;[93, null];[9300];[234567890123456789.654321098765432109876543210987654321, null]
+71;[94, 95];[9400, 9500];[12345678901234567890.098765432109876543210987654321098765, null]
+72;[96];[9600];[4567890123456789012.123456789012345678901234567890123456, null]
+73;[97, null];[9700];[56789012345678901234.543210987654321098765432109876543210, null]
+74;[98, 99];[9800, 9900];[678901234567890123.098765432109876543210987654321098765, null]
+75;[100];[10000];[78901234567890123456.234567890123456789012345678901234567, null]
+76;[101, null];[10100];[8901234567890123456.987654321098765432109876543210987654, null]
+77;[102, 103];[10200, 10300];[1234567890123456789.543210987654321098765432109876543210, null]
+78;[104];[10400];[23456789012345678901.876543210987654321098765432109876543210, null]
+79;[105, null];[10500];[56789012345678901234.432109876543210987654321098765432109, null]
+80;[106, 107];[10600, 10700];[8901234567890123456.234567890123456789012345678901234567, null]
+81;[108];[10800];[1234567890123456789.987654321098765432109876543210987654, null]
+82;[109, null];[10900];[78901234567890123456.654321098765432109876543210987654321, null]
+83;[110, 111];[11000, 11100];[4567890123456789012.123456789012345678901234567890123456, null]
+84;[112];[11200];[678901234567890123.543210987654321098765432109876543210, null]
+85;[113, null];[11300];[890123456789012345.098765432109876543210987654321098765, null]
+86;[114, 115];[11400, 11500];[2345678901234567890.987654321098765432109876543210987654, null]
+87;[116];[11600];[1234567890123456789.432109876543210987654321098765432109, null]
+88;[117, null];[11700];[7890123456789012345.098765432109876543210987654321098765, null]
+89;[118, 119];[11800, 11900];[345678901234567890.654321098765432109876543210987654321, null]
+90;[120];[12000];[8901234567890123456.432109876543210987654321098765432109, null]
+91;[121, null];[12100];[567890123456789012.345678901234567890123456789012345678, null]
+92;[122, 123];[12200, 12300];[12345678901234567890.654321098765432109876543210987654321, null]
+93;[124];[12400];[3456789012345678901.098765432109876543210987654321098765, null]
+94;[125, null];[12500];[7890123456789012345.987654321098765432109876543210987654, null]
+95;[126, 127];[12600, 12700];[890123456789012345.543210987654321098765432109876543210, null]
+96;[128];[12800];[5678901234567890123.876543210987654321098765432109876543210, null]
+97;[129, null];[12900];[3456789012345678901.234567890123456789012345678901234567, null]
+98;[130, 131];[13000, 13100];[78901234567890123456.098765432109876543210987654321098765, null]
+99;[132];[13200];[8901234567890123456.987654321098765432109876543210987654, null]
+100;[133, null];[13300];[1234567890123456789.543210987654321098765432109876543210, null]
diff --git a/regression-test/suites/nereids_function_p0/load.groovy b/regression-test/suites/nereids_function_p0/load.groovy
index 8a54b3bc250..105767843bd 100644
--- a/regression-test/suites/nereids_function_p0/load.groovy
+++ b/regression-test/suites/nereids_function_p0/load.groovy
@@ -265,6 +265,28 @@ suite("load") {
insert into fn_test_bitmap_not_nullable select * from fn_test_bitmap where id is not null
"""
+ sql """ set enable_decimal256 = true """
+ sql """ drop table if exists fn_test_array_with_large_decimal """
+ sql """
+ create table IF NOT EXISTS fn_test_array_with_large_decimal(id int, a array<tinyint>, b array<decimal(10,0)>, c array<decimal(76,56)>) properties('replication_num' = '1');
+ """
+ streamLoad {
+ table "fn_test_array_with_large_decimal"
+ db "regression_test_nereids_function_p0"
+ set 'column_separator', ';'
+ file "test_array_large_decimal.csv"
+ time 60000
+
+ check { result, exception, startTime, endTime ->
+ if (exception != null) {
+ throw exception
+ }
+ log.info("Stream load result: ${result}".toString())
+ def json = parseJson(result)
+ assertEquals(100, json.NumberTotalRows)
+ assertEquals(100, json.NumberLoadedRows)
+ }
+ }
// array_match_any && array_match_all
sql """ drop table if exists fn_test_am """
sql """ CREATE TABLE IF NOT EXISTS fn_test_am (id int, kastr array<string>, kaint array<int>) engine=olap
diff --git a/regression-test/suites/nereids_function_p0/scalar_function/Array.groovy b/regression-test/suites/nereids_function_p0/scalar_function/Array.groovy
index 9b2fb931d74..8a7f08a883a 100644
--- a/regression-test/suites/nereids_function_p0/scalar_function/Array.groovy
+++ b/regression-test/suites/nereids_function_p0/scalar_function/Array.groovy
@@ -1350,6 +1350,39 @@ suite("nereids_scalar_fn_Array") {
exception("errCode = 2")
}
+ // agg for array types add decimal256 cases array_min/array_max/array_product/array_avg/array_sum with decimal256
+ sql """ set enable_decimal256=true; """
+ order_qt_sql_array_min_decimal256 "select array_min(c) from fn_test_array_with_large_decimal order by id"
+ order_qt_sql_array_max_decimal256 "select array_max(c) from fn_test_array_with_large_decimal order by id"
+ test {
+ sql "select array_product(c) from fn_test_array_with_large_decimal order by id"
+ check{result, exception, startTime, endTime ->
+ assertTrue(exception != null)
+ logger.info(exception.message)
+ }
+ }
+ test {
+ sql "select array_avg(c) from fn_test_array_with_large_decimal order by id"
+ check{result, exception, startTime, endTime ->
+ assertTrue(exception != null)
+ logger.info(exception.message)
+ }
+ }
+ test {
+ sql "select array_sum(c) from fn_test_array_with_large_decimal order by id"
+ check{result, exception, startTime, endTime ->
+ assertTrue(exception != null)
+ logger.info(exception.message)
+ }
+ }
+ // array_overlap for type correctness
+ order_qt_sql_array_overlaps_1 """select arrays_overlap(a, b) from fn_test_array_with_large_decimal order by id"""
+ order_qt_sql_array_overlaps_2 """select arrays_overlap(b, a) from fn_test_array_with_large_decimal order by id"""
+ order_qt_sql_array_overlaps_3 """select arrays_overlap(a, c) from fn_test_array_with_large_decimal order by id"""
+ order_qt_sql_array_overlaps_4 """select arrays_overlap(c, a) from fn_test_array_with_large_decimal order by id"""
+ order_qt_sql_array_overlaps_5 """select arrays_overlap(b, c) from fn_test_array_with_large_decimal order by id"""
+ order_qt_sql_array_overlaps_6 """select arrays_overlap(c, b) from fn_test_array_with_large_decimal order by id"""
+
// array_match_any && array_match_all
// for table
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org