You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@doris.apache.org by mo...@apache.org on 2024/07/31 13:58:21 UTC
(doris) branch branch-2.0 updated: [fix](nereids) check functionBuilders is not null before using it (#38457) (#38536)
This is an automated email from the ASF dual-hosted git repository.
morrysnow pushed a commit to branch branch-2.0
in repository https://gitbox.apache.org/repos/asf/doris.git
The following commit(s) were added to refs/heads/branch-2.0 by this push:
new 66b0dc5471e [fix](nereids) check functionBuilders is not null before using it (#38457) (#38536)
66b0dc5471e is described below
commit 66b0dc5471eeb4221fd5358238bf6c17fad9a8ed
Author: starocean999 <40...@users.noreply.github.com>
AuthorDate: Wed Jul 31 21:58:13 2024 +0800
[fix](nereids) check functionBuilders is not null before using it (#38457) (#38536)
pick from master #38457
---
.../org/apache/doris/catalog/FunctionRegistry.java | 8 +++--
.../data/correctness_p0/test_orderby_mod.out | 7 ++++
.../suites/correctness_p0/test_orderby_mod.groovy | 41 ++++++++++++++++++++++
3 files changed, 53 insertions(+), 3 deletions(-)
diff --git a/fe/fe-core/src/main/java/org/apache/doris/catalog/FunctionRegistry.java b/fe/fe-core/src/main/java/org/apache/doris/catalog/FunctionRegistry.java
index c24b1587065..f63fed67cda 100644
--- a/fe/fe-core/src/main/java/org/apache/doris/catalog/FunctionRegistry.java
+++ b/fe/fe-core/src/main/java/org/apache/doris/catalog/FunctionRegistry.java
@@ -90,9 +90,11 @@ public class FunctionRegistry {
Class<?> aggClass = org.apache.doris.nereids.trees.expressions.functions.agg.AggregateFunction.class;
if (StringUtils.isEmpty(dbName)) {
List<FunctionBuilder> functionBuilders = name2BuiltinBuilders.get(name);
- for (FunctionBuilder functionBuilder : functionBuilders) {
- if (aggClass.isAssignableFrom(functionBuilder.functionClass())) {
- return true;
+ if (functionBuilders != null) {
+ for (FunctionBuilder functionBuilder : functionBuilders) {
+ if (aggClass.isAssignableFrom(functionBuilder.functionClass())) {
+ return true;
+ }
}
}
}
diff --git a/regression-test/data/correctness_p0/test_orderby_mod.out b/regression-test/data/correctness_p0/test_orderby_mod.out
new file mode 100644
index 00000000000..040aa0cedd9
--- /dev/null
+++ b/regression-test/data/correctness_p0/test_orderby_mod.out
@@ -0,0 +1,7 @@
+-- This file is automatically generated. You should know what you did if you want to edit this
+-- !select_mod --
+10 3.3 3
+
+-- !select_op --
+10 3.3 3
+
diff --git a/regression-test/suites/correctness_p0/test_orderby_mod.groovy b/regression-test/suites/correctness_p0/test_orderby_mod.groovy
new file mode 100644
index 00000000000..08112f1a369
--- /dev/null
+++ b/regression-test/suites/correctness_p0/test_orderby_mod.groovy
@@ -0,0 +1,41 @@
+
+// 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("test_order_by_mod") {
+ sql """set enable_nereids_planner=true"""
+ sql """
+ drop table if exists order_by_mod_t;
+ """
+
+ sql """
+ create table order_by_mod_t(a int, b float, c int)
+ duplicate key(a)
+ distributed by hash(a) buckets 1
+ properties ("replication_num" = "1");
+ """
+
+ sql """
+ insert into order_by_mod_t values (10, 3.3, 3), (20, 3.3, 3);;
+ """
+ qt_select_mod """
+ select * from order_by_mod_t order by mod(a,c) limit 1;;
+ """
+ qt_select_op """
+ select * from order_by_mod_t order by a % c limit 1;
+ """
+}
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org