This is an automated email from the ASF dual-hosted git repository.
morrysnow 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 daa4db097e [fix](Nereids) array_difference and array_position get
wrong result (#23331)
daa4db097e is described below
commit daa4db097e3d5cd77f24f134a35b891ecbd18992
Author: morrySnow <[email protected]>
AuthorDate: Wed Aug 23 20:38:09 2023 +0800
[fix](Nereids) array_difference and array_position get wrong result (#23331)
1. change array_difference signature to let it return same type as arg
2. do not change precision when signature not use wildcard type
---
.../functions/ComputeSignatureHelper.java | 13 ++++--
.../functions/scalar/ArrayDifference.java | 6 +--
.../nereids_function_p0/scalar_function/Array.out | 48 +++++++++++-----------
.../pipeline/p0/conf/regression-conf.groovy | 2 +-
4 files changed, 36 insertions(+), 33 deletions(-)
diff --git
a/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/functions/ComputeSignatureHelper.java
b/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/functions/ComputeSignatureHelper.java
index 88cad49481..a8e03153ae 100644
---
a/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/functions/ComputeSignatureHelper.java
+++
b/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/functions/ComputeSignatureHelper.java
@@ -334,6 +334,10 @@ public class ComputeSignatureHelper {
if (!(targetType instanceof DecimalV3Type)) {
continue;
}
+ // only process wildcard decimalv3
+ if (((DecimalV3Type) targetType).getPrecision() > 0) {
+ continue;
+ }
if (finalType == null) {
finalType =
DecimalV3Type.forType(arguments.get(i).getDataType());
} else {
@@ -347,19 +351,20 @@ public class ComputeSignatureHelper {
}
finalType = DecimalV3Type.widerDecimalV3Type((DecimalV3Type)
finalType, argType, true);
}
- Preconditions.checkState(finalType.isDecimalV3Type(),
- "decimalv3 precision promotion failed.");
+ Preconditions.checkState(finalType.isDecimalV3Type(), "decimalv3
precision promotion failed.");
}
DataType argType = finalType;
List<DataType> newArgTypes = signature.argumentsTypes.stream().map(t
-> {
- if (t instanceof DecimalV3Type) {
+ // only process wildcard decimalv3
+ if (t instanceof DecimalV3Type && ((DecimalV3Type)
t).getPrecision() <= 0) {
return argType;
} else {
return t;
}
}).collect(Collectors.toList());
signature = signature.withArgumentTypes(signature.hasVarArgs,
newArgTypes);
- if (signature.returnType instanceof DecimalV3Type) {
+ if (signature.returnType instanceof DecimalV3Type
+ && ((DecimalV3Type) signature.returnType).getPrecision() <= 0)
{
signature = signature.withReturnType(argType);
}
return signature;
diff --git
a/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/functions/scalar/ArrayDifference.java
b/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/functions/scalar/ArrayDifference.java
index c883852cd3..ce1aa70b0f 100644
---
a/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/functions/scalar/ArrayDifference.java
+++
b/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/functions/scalar/ArrayDifference.java
@@ -53,10 +53,8 @@ public class ArrayDifference extends ScalarFunction
FunctionSignature.ret(ArrayType.of(LargeIntType.INSTANCE)).args(ArrayType.of(LargeIntType.INSTANCE)),
FunctionSignature.ret(ArrayType.of(DoubleType.INSTANCE)).args(ArrayType.of(FloatType.INSTANCE)),
FunctionSignature.ret(ArrayType.of(DoubleType.INSTANCE)).args(ArrayType.of(DoubleType.INSTANCE)),
- FunctionSignature.ret(ArrayType.of(DecimalV2Type.SYSTEM_DEFAULT))
- .args(ArrayType.of(DecimalV2Type.SYSTEM_DEFAULT)),
- FunctionSignature.ret(ArrayType.of(DecimalV3Type.WILDCARD))
- .args(ArrayType.of(DecimalV3Type.WILDCARD))
+
FunctionSignature.retArgType(0).args(ArrayType.of(DecimalV2Type.SYSTEM_DEFAULT)),
+
FunctionSignature.retArgType(0).args(ArrayType.of(DecimalV3Type.WILDCARD))
);
/**
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 426c1ee1bd..dad029a71b 100644
--- a/regression-test/data/nereids_function_p0/scalar_function/Array.out
+++ b/regression-test/data/nereids_function_p0/scalar_function/Array.out
@@ -8120,33 +8120,33 @@ true
[9, 9, 9, 9, 9, 9, 9, 9, 9]
-- !sql_array_with_constant_DecimalV3 --
-[0.100000000]
-[0.200000000, 0.200000000]
-[0.300000000, 0.300000000, 0.300000000]
-[0.400000000, 0.400000000, 0.400000000, 0.400000000]
-[0.500000000, 0.500000000, 0.500000000, 0.500000000, 0.500000000]
-[0.600000000, 0.600000000, 0.600000000, 0.600000000, 0.600000000, 0.600000000]
-[0.700000000, 0.700000000, 0.700000000, 0.700000000, 0.700000000, 0.700000000,
0.700000000]
-[0.800000000, 0.800000000, 0.800000000, 0.800000000, 0.800000000, 0.800000000,
0.800000000, 0.800000000]
-[0.900000000, 0.900000000, 0.900000000, 0.900000000, 0.900000000, 0.900000000,
0.900000000, 0.900000000, 0.900000000]
-[1.000000000, 1.000000000, 1.000000000, 1.000000000, 1.000000000, 1.000000000,
1.000000000, 1.000000000, 1.000000000, 1.000000000]
-[1.100000000, 1.100000000, 1.100000000, 1.100000000, 1.100000000, 1.100000000,
1.100000000, 1.100000000, 1.100000000, 1.100000000, 1.100000000]
-[1.200000000, 1.200000000, 1.200000000, 1.200000000, 1.200000000, 1.200000000,
1.200000000, 1.200000000, 1.200000000, 1.200000000, 1.200000000, 1.200000000]
+[0.100]
+[0.200, 0.200]
+[0.300, 0.300, 0.300]
+[0.400, 0.400, 0.400, 0.400]
+[0.500, 0.500, 0.500, 0.500, 0.500]
+[0.600, 0.600, 0.600, 0.600, 0.600, 0.600]
+[0.700, 0.700, 0.700, 0.700, 0.700, 0.700, 0.700]
+[0.800, 0.800, 0.800, 0.800, 0.800, 0.800, 0.800, 0.800]
+[0.900, 0.900, 0.900, 0.900, 0.900, 0.900, 0.900, 0.900, 0.900]
+[1.000, 1.000, 1.000, 1.000, 1.000, 1.000, 1.000, 1.000, 1.000, 1.000]
+[1.100, 1.100, 1.100, 1.100, 1.100, 1.100, 1.100, 1.100, 1.100, 1.100, 1.100]
+[1.200, 1.200, 1.200, 1.200, 1.200, 1.200, 1.200, 1.200, 1.200, 1.200, 1.200,
1.200]
[]
-- !sql_array_with_constant_DecimalV3_notnull --
-[0.100000000]
-[0.200000000, 0.200000000]
-[0.300000000, 0.300000000, 0.300000000]
-[0.400000000, 0.400000000, 0.400000000, 0.400000000]
-[0.500000000, 0.500000000, 0.500000000, 0.500000000, 0.500000000]
-[0.600000000, 0.600000000, 0.600000000, 0.600000000, 0.600000000, 0.600000000]
-[0.700000000, 0.700000000, 0.700000000, 0.700000000, 0.700000000, 0.700000000,
0.700000000]
-[0.800000000, 0.800000000, 0.800000000, 0.800000000, 0.800000000, 0.800000000,
0.800000000, 0.800000000]
-[0.900000000, 0.900000000, 0.900000000, 0.900000000, 0.900000000, 0.900000000,
0.900000000, 0.900000000, 0.900000000]
-[1.000000000, 1.000000000, 1.000000000, 1.000000000, 1.000000000, 1.000000000,
1.000000000, 1.000000000, 1.000000000, 1.000000000]
-[1.100000000, 1.100000000, 1.100000000, 1.100000000, 1.100000000, 1.100000000,
1.100000000, 1.100000000, 1.100000000, 1.100000000, 1.100000000]
-[1.200000000, 1.200000000, 1.200000000, 1.200000000, 1.200000000, 1.200000000,
1.200000000, 1.200000000, 1.200000000, 1.200000000, 1.200000000, 1.200000000]
+[0.100]
+[0.200, 0.200]
+[0.300, 0.300, 0.300]
+[0.400, 0.400, 0.400, 0.400]
+[0.500, 0.500, 0.500, 0.500, 0.500]
+[0.600, 0.600, 0.600, 0.600, 0.600, 0.600]
+[0.700, 0.700, 0.700, 0.700, 0.700, 0.700, 0.700]
+[0.800, 0.800, 0.800, 0.800, 0.800, 0.800, 0.800, 0.800]
+[0.900, 0.900, 0.900, 0.900, 0.900, 0.900, 0.900, 0.900, 0.900]
+[1.000, 1.000, 1.000, 1.000, 1.000, 1.000, 1.000, 1.000, 1.000, 1.000]
+[1.100, 1.100, 1.100, 1.100, 1.100, 1.100, 1.100, 1.100, 1.100, 1.100, 1.100]
+[1.200, 1.200, 1.200, 1.200, 1.200, 1.200, 1.200, 1.200, 1.200, 1.200, 1.200,
1.200]
-- !sql_array_with_constant_Boolean --
[0, 0, 0, 0, 0, 0, 0]
diff --git a/regression-test/pipeline/p0/conf/regression-conf.groovy
b/regression-test/pipeline/p0/conf/regression-conf.groovy
index c5847ecede..12397d4708 100644
--- a/regression-test/pipeline/p0/conf/regression-conf.groovy
+++ b/regression-test/pipeline/p0/conf/regression-conf.groovy
@@ -54,7 +54,7 @@ testDirectories = ""
// this groups will not be executed
excludeGroups = ""
// this suites will not be executed
-excludeSuites =
"nereids_scalar_fn_Array,test_pk_uk_index_change,test_pk_uk_case,test_default_limit,test_profile,test_broker_load,test_spark_load,test_refresh_mtmv,test_bitmap_filter,test_export_parquet,test_doris_jdbc_catalog,test_transactional_hive,nereids_delete_mow_partial_update"
+excludeSuites =
"test_pk_uk_index_change,test_pk_uk_case,test_default_limit,test_profile,test_broker_load,test_spark_load,test_refresh_mtmv,test_bitmap_filter,test_export_parquet,test_doris_jdbc_catalog,test_transactional_hive,nereids_delete_mow_partial_update"
// this directories will not be executed
excludeDirectories = "workload_manager_p1"
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]