This is an automated email from the ASF dual-hosted git repository.
yiguolei pushed a commit to branch branch-2.1
in repository https://gitbox.apache.org/repos/asf/doris.git
The following commit(s) were added to refs/heads/branch-2.1 by this push:
new 5bc1618c2df branch-2.1: [fix](Nereids) could not work well when check
precision for null literal #50815 (#50899)
5bc1618c2df is described below
commit 5bc1618c2dff30d75fbec91397a69f3be2199c29
Author: github-actions[bot]
<41898282+github-actions[bot]@users.noreply.github.com>
AuthorDate: Thu May 22 14:38:39 2025 +0800
branch-2.1: [fix](Nereids) could not work well when check precision for
null literal #50815 (#50899)
Cherry-picked from #50815
Co-authored-by: morrySnow <[email protected]>
---
.../expressions/functions/SearchSignature.java | 4 +-
.../decimal_percision_compute.groovy | 48 ++++++++++++++++++++++
2 files changed, 51 insertions(+), 1 deletion(-)
diff --git
a/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/functions/SearchSignature.java
b/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/functions/SearchSignature.java
index 5fa426a99a2..bf5fd042307 100644
---
a/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/functions/SearchSignature.java
+++
b/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/functions/SearchSignature.java
@@ -152,7 +152,9 @@ public class SearchSignature {
finalType =
DecimalV3Type.forType(arguments.get(i).getDataType());
} else {
Expression arg = arguments.get(i);
- if (arg.isLiteral() && arg.getDataType().isIntegralType()) {
+ if (arg.isNullLiteral()) {
+ // do nothing
+ } else if (arg.isLiteral() &&
arg.getDataType().isIntegralType()) {
// create decimalV3 with minimum scale enough to hold the
integral literal
finalType = DecimalV3Type.createDecimalV3Type(new
BigDecimal(((Literal) arg).getStringValue()));
} else {
diff --git
a/regression-test/suites/nereids_syntax_p0/decimal_percision_compute.groovy
b/regression-test/suites/nereids_syntax_p0/decimal_percision_compute.groovy
new file mode 100644
index 00000000000..0a3603012d2
--- /dev/null
+++ b/regression-test/suites/nereids_syntax_p0/decimal_percision_compute.groovy
@@ -0,0 +1,48 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements. See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership. The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied. See the License for the
+// specific language governing permissions and limitations
+// under the License.
+
+suite("decimal_precision") {
+
+ sql """
+ CREATE TABLE IF NOT EXISTS test_null_literal_compute (
+ id INT,
+ name VARCHAR(50),
+ age INT,
+ score DECIMAL(5,2),
+ create_time DATETIME,
+ is_active BOOLEAN
+ ) ENGINE=OLAP
+ DUPLICATE KEY(id)
+ DISTRIBUTED BY HASH(id) BUCKETS 10
+ PROPERTIES (
+ "replication_num" = "1"
+ );
+ """
+
+ sql """
+ INSERT INTO test_null_literal_compute VALUES
+ (1, 'Alice', 25, 89.5, '2023-01-01 10:00:00', true),
+ (2, 'Bob', 30, 76.2, '2023-01-02 11:00:00', true),
+ (3, 'Charlie', 22, 92.0, '2023-01-03 12:00:00', false),
+ (4, 'David', 28, 85.7, '2023-01-04 13:00:00', true),
+ (5, 'Eve', 35, 67.8, '2023-01-05 14:00:00', false);
+ """
+
+ sql """
+ SELECT name, age, LAG(age, 1) OVER (ORDER BY id) AS prev_age FROM
test_null_literal_compute;
+ """
+}
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]