This is an automated email from the ASF dual-hosted git repository.
yiguolei 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 548226acfc [fix](planner)shouldn't change the child type to
assignmentCompatibleType if it's INVALID_TYPE (#22841)
548226acfc is described below
commit 548226acfc3d57ced0ff9db413fa7ae9d6a57296
Author: starocean999 <[email protected]>
AuthorDate: Fri Aug 11 17:14:49 2023 +0800
[fix](planner)shouldn't change the child type to assignmentCompatibleType
if it's INVALID_TYPE (#22841)
if changing the child type to INVALID_TYPE, the later getBuiltinFunction
call will fail
---
.../apache/doris/analysis/FunctionCallExpr.java | 26 ++++++++++++----------
.../data/correctness_p0/test_select_constant.out | 3 +++
.../correctness_p0/test_select_constant.groovy | 3 +++
3 files changed, 20 insertions(+), 12 deletions(-)
diff --git
a/fe/fe-core/src/main/java/org/apache/doris/analysis/FunctionCallExpr.java
b/fe/fe-core/src/main/java/org/apache/doris/analysis/FunctionCallExpr.java
index 7fbbfbadf4..1a3ec4149d 100644
--- a/fe/fe-core/src/main/java/org/apache/doris/analysis/FunctionCallExpr.java
+++ b/fe/fe-core/src/main/java/org/apache/doris/analysis/FunctionCallExpr.java
@@ -1411,20 +1411,22 @@ public class FunctionCallExpr extends Expr {
} else if (fnName.getFunction().equalsIgnoreCase("ifnull")) {
Type[] childTypes = collectChildReturnTypes();
Type assignmentCompatibleType =
ScalarType.getAssignmentCompatibleType(childTypes[0], childTypes[1], true);
- if (assignmentCompatibleType.isDecimalV3()) {
- if (assignmentCompatibleType.isDecimalV3() &&
!childTypes[0].equals(assignmentCompatibleType)) {
- uncheckedCastChild(assignmentCompatibleType, 0);
- }
- if (assignmentCompatibleType.isDecimalV3() &&
!childTypes[1].equals(assignmentCompatibleType)) {
- uncheckedCastChild(assignmentCompatibleType, 1);
+ if (assignmentCompatibleType != Type.INVALID) {
+ if (assignmentCompatibleType.isDecimalV3()) {
+ if (assignmentCompatibleType.isDecimalV3() &&
!childTypes[0].equals(assignmentCompatibleType)) {
+ uncheckedCastChild(assignmentCompatibleType, 0);
+ }
+ if (assignmentCompatibleType.isDecimalV3() &&
!childTypes[1].equals(assignmentCompatibleType)) {
+ uncheckedCastChild(assignmentCompatibleType, 1);
+ }
}
- }
- childTypes[0] = assignmentCompatibleType;
- childTypes[1] = assignmentCompatibleType;
+ childTypes[0] = assignmentCompatibleType;
+ childTypes[1] = assignmentCompatibleType;
- if (childTypes[1].isDecimalV3() && childTypes[0].isDecimalV3()) {
- argTypes[1] = assignmentCompatibleType;
- argTypes[0] = assignmentCompatibleType;
+ if (childTypes[1].isDecimalV3() &&
childTypes[0].isDecimalV3()) {
+ argTypes[1] = assignmentCompatibleType;
+ argTypes[0] = assignmentCompatibleType;
+ }
}
fn = getBuiltinFunction(fnName.getFunction(), childTypes,
Function.CompareMode.IS_NONSTRICT_SUPERTYPE_OF);
diff --git a/regression-test/data/correctness_p0/test_select_constant.out
b/regression-test/data/correctness_p0/test_select_constant.out
index cb391ffb12..33c56d3a22 100644
--- a/regression-test/data/correctness_p0/test_select_constant.out
+++ b/regression-test/data/correctness_p0/test_select_constant.out
@@ -5,3 +5,6 @@
-- !select_geo1 --
POINT (123.123456789 89.123456789)
+-- !select2 --
+20230101
+
diff --git a/regression-test/suites/correctness_p0/test_select_constant.groovy
b/regression-test/suites/correctness_p0/test_select_constant.groovy
index 6015e19576..38c1c2efdb 100644
--- a/regression-test/suites/correctness_p0/test_select_constant.groovy
+++ b/regression-test/suites/correctness_p0/test_select_constant.groovy
@@ -18,4 +18,7 @@
suite("test_select_constant") {
qt_select1 'select 100, "test", date("2021-01-02");'
qt_select_geo1 'SELECT
ST_AsText(ST_Point(123.12345678901234567890,89.1234567890));'
+
+ sql "set enable_nereids_planner=false;"
+ qt_select2 """select ifnull(cast('2023-01-01' as DATE) ,0);"""
}
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]