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 9e696d72f1b [fix](nereids)check functionBuilders is not null before 
using it (#38535)
9e696d72f1b is described below

commit 9e696d72f1b28a54784342be8597d54de33361cf
Author: starocean999 <[email protected]>
AuthorDate: Wed Jul 31 11:00:39 2024 +0800

    [fix](nereids)check functionBuilders is not null before using it (#38535)
    
    ## Proposed changes
    
    pick from master https://github.com/apache/doris/pull/38457
    
    <!--Describe your changes.-->
---
 .../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 020d3022325..0e049b4b902 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: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to