You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@doris.apache.org by yi...@apache.org on 2022/10/13 10:31:27 UTC

[doris] branch master updated: [feature](agg) support `any`,`any_value` agg functions. (#13228)

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 cb300b0b39 [feature](agg) support `any`,`any_value` agg functions. (#13228)
cb300b0b39 is described below

commit cb300b0b398abd6f74219cf8d9660d005261f7eb
Author: luozenglin <37...@users.noreply.github.com>
AuthorDate: Thu Oct 13 18:31:19 2022 +0800

    [feature](agg) support `any`,`any_value` agg functions. (#13228)
---
 be/src/exprs/aggregate_functions.cpp               | 62 ++++++++++++++++
 be/src/exprs/aggregate_functions.h                 |  8 ++
 .../aggregate_function_min_max.cpp                 | 15 +++-
 .../aggregate_function_min_max.h                   | 74 +++++++++++++++++++
 .../sql-functions/aggregate-functions/any_value.md | 48 ++++++++++++
 docs/sidebars.json                                 |  1 +
 .../sql-functions/aggregate-functions/any_value.md | 48 ++++++++++++
 .../java/org/apache/doris/catalog/FunctionSet.java | 85 ++++++++++++++++++++++
 .../data/query_p0/aggregate/aggregate.out          |  3 +
 .../suites/query_p0/aggregate/aggregate.groovy     | 31 ++++++++
 10 files changed, 374 insertions(+), 1 deletion(-)

diff --git a/be/src/exprs/aggregate_functions.cpp b/be/src/exprs/aggregate_functions.cpp
index 2ae13ffaef..4a3f9cd090 100644
--- a/be/src/exprs/aggregate_functions.cpp
+++ b/be/src/exprs/aggregate_functions.cpp
@@ -638,6 +638,23 @@ void AggregateFunctions::max(FunctionContext*, const T& src, T* dst) {
     }
 }
 
+template <typename T>
+void AggregateFunctions::any_init(FunctionContext* ctx, T* dst) {
+    T val {};
+    // set to null when intermediate slot is nullable
+    val.is_null = true;
+    *dst = val;
+}
+
+template <typename T>
+void AggregateFunctions::any(FunctionContext*, const T& src, T* dst) {
+    if (LIKELY(!dst->is_null || src.is_null)) {
+        return;
+    }
+
+    *dst = src;
+}
+
 template <>
 void AggregateFunctions::min(FunctionContext*, const DecimalV2Val& src, DecimalV2Val* dst) {
     if (src.is_null) {
@@ -712,6 +729,17 @@ void AggregateFunctions::max(FunctionContext* ctx, const StringVal& src, StringV
     }
 }
 
+template <>
+void AggregateFunctions::any(FunctionContext* ctx, const StringVal& src, StringVal* dst) {
+    if (LIKELY(src.is_null || !dst->is_null)) {
+        return;
+    }
+
+    uint8_t* copy = ctx->allocate(src.len);
+    memcpy(copy, src.ptr, src.len);
+    *dst = StringVal(copy, src.len);
+}
+
 template <>
 void AggregateFunctions::min(FunctionContext*, const DateTimeVal& src, DateTimeVal* dst) {
     if (src.is_null) {
@@ -2705,6 +2733,40 @@ template void AggregateFunctions::max<FloatVal>(FunctionContext*, const FloatVal
 template void AggregateFunctions::max<DoubleVal>(FunctionContext*, const DoubleVal& src,
                                                  DoubleVal* dst);
 
+template void AggregateFunctions::any_init<BooleanVal>(doris_udf::FunctionContext*,
+                                                       BooleanVal* dst);
+template void AggregateFunctions::any_init<TinyIntVal>(doris_udf::FunctionContext*,
+                                                       TinyIntVal* dst);
+template void AggregateFunctions::any_init<SmallIntVal>(doris_udf::FunctionContext*,
+                                                        SmallIntVal* dst);
+template void AggregateFunctions::any_init<IntVal>(doris_udf::FunctionContext*, IntVal* dst);
+template void AggregateFunctions::any_init<BigIntVal>(doris_udf::FunctionContext*, BigIntVal* dst);
+template void AggregateFunctions::any_init<LargeIntVal>(doris_udf::FunctionContext*,
+                                                        LargeIntVal* dst);
+template void AggregateFunctions::any_init<FloatVal>(doris_udf::FunctionContext*, FloatVal* dst);
+template void AggregateFunctions::any_init<DoubleVal>(doris_udf::FunctionContext*, DoubleVal* dst);
+template void AggregateFunctions::any_init<DateTimeVal>(doris_udf::FunctionContext*,
+                                                        DateTimeVal* dst);
+template void AggregateFunctions::any_init<DecimalV2Val>(doris_udf::FunctionContext*,
+                                                         DecimalV2Val* dst);
+template void AggregateFunctions::any_init<StringVal>(doris_udf::FunctionContext*, StringVal* dst);
+
+template void AggregateFunctions::any<BooleanVal>(FunctionContext*, const BooleanVal& src,
+                                                  BooleanVal* dst);
+template void AggregateFunctions::any<TinyIntVal>(FunctionContext*, const TinyIntVal& src,
+                                                  TinyIntVal* dst);
+template void AggregateFunctions::any<SmallIntVal>(FunctionContext*, const SmallIntVal& src,
+                                                   SmallIntVal* dst);
+template void AggregateFunctions::any<IntVal>(FunctionContext*, const IntVal& src, IntVal* dst);
+template void AggregateFunctions::any<BigIntVal>(FunctionContext*, const BigIntVal& src,
+                                                 BigIntVal* dst);
+template void AggregateFunctions::any<LargeIntVal>(FunctionContext*, const LargeIntVal& src,
+                                                   LargeIntVal* dst);
+template void AggregateFunctions::any<FloatVal>(FunctionContext*, const FloatVal& src,
+                                                FloatVal* dst);
+template void AggregateFunctions::any<DoubleVal>(FunctionContext*, const DoubleVal& src,
+                                                 DoubleVal* dst);
+
 template void AggregateFunctions::pc_update(FunctionContext*, const BooleanVal&, StringVal*);
 template void AggregateFunctions::pc_update(FunctionContext*, const TinyIntVal&, StringVal*);
 template void AggregateFunctions::pc_update(FunctionContext*, const SmallIntVal&, StringVal*);
diff --git a/be/src/exprs/aggregate_functions.h b/be/src/exprs/aggregate_functions.h
index ba283578e9..22407109d0 100644
--- a/be/src/exprs/aggregate_functions.h
+++ b/be/src/exprs/aggregate_functions.h
@@ -163,6 +163,14 @@ public:
     template <typename T>
     static void max(doris_udf::FunctionContext*, const T& src, T* dst);
 
+    // AnyInit
+    template <typename T>
+    static void any_init(doris_udf::FunctionContext*, T* dst);
+
+    // AnyUpdate/AnyMerge
+    template <typename T>
+    static void any(doris_udf::FunctionContext*, const T& src, T* dst);
+
     // String concat
     static void string_concat(doris_udf::FunctionContext*, const doris_udf::StringVal& src,
                               const doris_udf::StringVal& separator, doris_udf::StringVal* result);
diff --git a/be/src/vec/aggregate_functions/aggregate_function_min_max.cpp b/be/src/vec/aggregate_functions/aggregate_function_min_max.cpp
index fb48cc18b8..d4357367a4 100644
--- a/be/src/vec/aggregate_functions/aggregate_function_min_max.cpp
+++ b/be/src/vec/aggregate_functions/aggregate_function_min_max.cpp
@@ -26,7 +26,7 @@
 
 namespace doris::vectorized {
 
-/// min, max
+/// min, max, any
 template <template <typename, bool> class AggregateFunctionTemplate, template <typename> class Data>
 static IAggregateFunction* create_aggregate_function_single_value(const String& name,
                                                                   const DataTypes& argument_types,
@@ -93,9 +93,22 @@ AggregateFunctionPtr create_aggregate_function_min(const std::string& name,
                                                                              parameters));
 }
 
+AggregateFunctionPtr create_aggregate_function_any(const std::string& name,
+                                                   const DataTypes& argument_types,
+                                                   const Array& parameters,
+                                                   const bool result_is_nullable) {
+    return AggregateFunctionPtr(
+            create_aggregate_function_single_value<AggregateFunctionsSingleValue,
+                                                   AggregateFunctionAnyData>(name, argument_types,
+                                                                             parameters));
+}
+
 void register_aggregate_function_minmax(AggregateFunctionSimpleFactory& factory) {
     factory.register_function("max", create_aggregate_function_max);
     factory.register_function("min", create_aggregate_function_min);
+    factory.register_function("any", create_aggregate_function_any);
+
+    factory.register_alias("any", "any_value");
 }
 
 } // namespace doris::vectorized
diff --git a/be/src/vec/aggregate_functions/aggregate_function_min_max.h b/be/src/vec/aggregate_functions/aggregate_function_min_max.h
index 37e812bf38..5bb86dd271 100644
--- a/be/src/vec/aggregate_functions/aggregate_function_min_max.h
+++ b/be/src/vec/aggregate_functions/aggregate_function_min_max.h
@@ -123,6 +123,24 @@ public:
         }
     }
 
+    bool change_first_time(const IColumn& column, size_t row_num, Arena* arena) {
+        if (!has()) {
+            change(column, row_num, arena);
+            return true;
+        } else {
+            return false;
+        }
+    }
+
+    bool change_first_time(const Self& to, Arena* arena) {
+        if (!has() && to.has()) {
+            change(to, arena);
+            return true;
+        } else {
+            return false;
+        }
+    }
+
     bool is_equal_to(const Self& to) const { return has() && to.value == value; }
 
     bool is_equal_to(const IColumn& column, size_t row_num) const {
@@ -223,6 +241,24 @@ public:
         }
     }
 
+    bool change_first_time(const IColumn& column, size_t row_num, Arena* arena) {
+        if (!has()) {
+            change(column, row_num, arena);
+            return true;
+        } else {
+            return false;
+        }
+    }
+
+    bool change_first_time(const Self& to, Arena* arena) {
+        if (!has() && to.has()) {
+            change(to, arena);
+            return true;
+        } else {
+            return false;
+        }
+    }
+
     bool is_equal_to(const Self& to) const { return has() && to.value == value; }
 
     bool is_equal_to(const IColumn& column, size_t row_num) const {
@@ -381,6 +417,24 @@ public:
         }
     }
 
+    bool change_first_time(const IColumn& column, size_t row_num, Arena* arena) {
+        if (!has()) {
+            change(column, row_num, arena);
+            return true;
+        } else {
+            return false;
+        }
+    }
+
+    bool change_first_time(const Self& to, Arena* arena) {
+        if (!has() && to.has()) {
+            change(to, arena);
+            return true;
+        } else {
+            return false;
+        }
+    }
+
     bool is_equal_to(const Self& to) const {
         return has() && to.get_string_ref() == get_string_ref();
     }
@@ -416,6 +470,21 @@ struct AggregateFunctionMinData : Data {
     static const char* name() { return "min"; }
 };
 
+template <typename Data>
+struct AggregateFunctionAnyData : Data {
+    using Self = AggregateFunctionAnyData;
+    using Data::IsFixedLength;
+
+    bool change_if_better(const IColumn& column, size_t row_num, Arena* arena) {
+        return this->change_first_time(column, row_num, arena);
+    }
+    bool change_if_better(const Self& to, Arena* arena) {
+        return this->change_first_time(to, arena);
+    }
+
+    static const char* name() { return "any"; }
+};
+
 template <typename Data, bool AllocatesMemoryInArena>
 class AggregateFunctionsSingleValue final
         : public IAggregateFunctionDataHelper<
@@ -567,4 +636,9 @@ AggregateFunctionPtr create_aggregate_function_min(const std::string& name,
                                                    const Array& parameters,
                                                    const bool result_is_nullable);
 
+AggregateFunctionPtr create_aggregate_function_any(const std::string& name,
+                                                   const DataTypes& argument_types,
+                                                   const Array& parameters,
+                                                   const bool result_is_nullable);
+
 } // namespace doris::vectorized
diff --git a/docs/en/docs/sql-manual/sql-functions/aggregate-functions/any_value.md b/docs/en/docs/sql-manual/sql-functions/aggregate-functions/any_value.md
new file mode 100644
index 0000000000..46437429ef
--- /dev/null
+++ b/docs/en/docs/sql-manual/sql-functions/aggregate-functions/any_value.md
@@ -0,0 +1,48 @@
+---
+{
+    "title": "ANY_VALUE",
+    "language": "en"
+}
+---
+
+<!-- 
+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.
+-->
+
+## ANY_VALUE
+### description
+#### Syntax
+
+`ANY_VALUE(expr)`
+
+If there is a non NULL value in expr, any non NULL value is returned; otherwise, NULL is returned.
+
+Alias function: `ANY(expr)`
+
+### example
+```
+mysql> select id, any_value(name) from cost2 group by id;
++------+-------------------+
+| id   | any_value(`name`) |
++------+-------------------+
+|    3 | jack              |
+|    2 | jack              |
++------+-------------------+
+```
+### keywords
+ANY_VALUE, ANY
diff --git a/docs/sidebars.json b/docs/sidebars.json
index 03e3883ecb..a3efe0dfc9 100644
--- a/docs/sidebars.json
+++ b/docs/sidebars.json
@@ -425,6 +425,7 @@
                                 "sql-manual/sql-functions/aggregate-functions/collect_list",
                                 "sql-manual/sql-functions/aggregate-functions/min_by",
                                 "sql-manual/sql-functions/aggregate-functions/max",
+                                "sql-manual/sql-functions/aggregate-functions/any_value",
                                 "sql-manual/sql-functions/aggregate-functions/var_samp",
                                 "sql-manual/sql-functions/aggregate-functions/approx_count_distinct",
                                 "sql-manual/sql-functions/aggregate-functions/variance"
diff --git a/docs/zh-CN/docs/sql-manual/sql-functions/aggregate-functions/any_value.md b/docs/zh-CN/docs/sql-manual/sql-functions/aggregate-functions/any_value.md
new file mode 100644
index 0000000000..5ceff43633
--- /dev/null
+++ b/docs/zh-CN/docs/sql-manual/sql-functions/aggregate-functions/any_value.md
@@ -0,0 +1,48 @@
+---
+{
+    "title": "ANY_VALUE",
+    "language": "zh-CN"
+}
+---
+
+<!-- 
+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.
+-->
+
+## ANY_VALUE
+### description
+#### Syntax
+
+`ANY_VALUE(expr)`
+
+如果expr中存在非 NULL 值,返回任意非 NULL 值,否则返回 NULL。
+
+别名函数: `ANY(expr)`
+
+### example
+```
+mysql> select id, any_value(name) from cost2 group by id;
++------+-------------------+
+| id   | any_value(`name`) |
++------+-------------------+
+|    3 | jack              |
+|    2 | jack              |
++------+-------------------+
+```
+### keywords
+ANY_VALUE, ANY
diff --git a/fe/fe-core/src/main/java/org/apache/doris/catalog/FunctionSet.java b/fe/fe-core/src/main/java/org/apache/doris/catalog/FunctionSet.java
index 8bc7df6c98..23af2f806f 100644
--- a/fe/fe-core/src/main/java/org/apache/doris/catalog/FunctionSet.java
+++ b/fe/fe-core/src/main/java/org/apache/doris/catalog/FunctionSet.java
@@ -242,6 +242,70 @@ public class FunctionSet<T> {
                     "3maxIN9doris_udf11LargeIntValEEEvPNS2_15FunctionContextERKT_PS6_")
                .build();
 
+    private static final Map<Type, String> ANY_INIT_SYMBOL =
+            ImmutableMap.<Type, String>builder()
+                    .put(Type.BOOLEAN,
+                            "8any_initIN9doris_udf10BooleanValEEEvPNS2_15FunctionContextEPT_")
+                    .put(Type.TINYINT,
+                            "8any_initIN9doris_udf10TinyIntValEEEvPNS2_15FunctionContextEPT_")
+                    .put(Type.SMALLINT,
+                            "8any_initIN9doris_udf11SmallIntValEEEvPNS2_15FunctionContextEPT_")
+                    .put(Type.INT,
+                            "8any_initIN9doris_udf6IntValEEEvPNS2_15FunctionContextEPT_")
+                    .put(Type.BIGINT,
+                            "8any_initIN9doris_udf9BigIntValEEEvPNS2_15FunctionContextEPT_")
+                    .put(Type.FLOAT,
+                            "8any_initIN9doris_udf8FloatValEEEvPNS2_15FunctionContextEPT_")
+                    .put(Type.DOUBLE,
+                            "8any_initIN9doris_udf9DoubleValEEEvPNS2_15FunctionContextEPT_")
+                    // .put(Type.CHAR,
+                    //     "3anyIN9doris_udf9StringValEEEvPNS2_15FunctionContextERKT_PS6_")
+                    .put(Type.VARCHAR,
+                            "8any_initIN9doris_udf9StringValEEEvPNS2_15FunctionContextEPT_")
+                    .put(Type.STRING,
+                            "8any_initIN9doris_udf9StringValEEEvPNS2_15FunctionContextEPT_")
+                    .put(Type.DATE,
+                            "8any_initIN9doris_udf11DateTimeValEEEvPNS2_15FunctionContextEPT_")
+                    .put(Type.DATETIME,
+                            "8any_initIN9doris_udf11DateTimeValEEEvPNS2_15FunctionContextEPT_")
+                    .put(Type.DECIMALV2,
+                            "8any_initIN9doris_udf12DecimalV2ValEEEvPNS2_15FunctionContextEPT_")
+                    .put(Type.LARGEINT,
+                            "8any_initIN9doris_udf11LargeIntValEEEvPNS2_15FunctionContextEPT_")
+                    .build();
+
+    private static final Map<Type, String> ANY_UPDATE_SYMBOL =
+            ImmutableMap.<Type, String>builder()
+                    .put(Type.BOOLEAN,
+                            "3anyIN9doris_udf10BooleanValEEEvPNS2_15FunctionContextERKT_PS6_")
+                    .put(Type.TINYINT,
+                            "3anyIN9doris_udf10TinyIntValEEEvPNS2_15FunctionContextERKT_PS6_")
+                    .put(Type.SMALLINT,
+                            "3anyIN9doris_udf11SmallIntValEEEvPNS2_15FunctionContextERKT_PS6_")
+                    .put(Type.INT,
+                            "3anyIN9doris_udf6IntValEEEvPNS2_15FunctionContextERKT_PS6_")
+                    .put(Type.BIGINT,
+                            "3anyIN9doris_udf9BigIntValEEEvPNS2_15FunctionContextERKT_PS6_")
+                    .put(Type.FLOAT,
+                            "3anyIN9doris_udf8FloatValEEEvPNS2_15FunctionContextERKT_PS6_")
+                    .put(Type.DOUBLE,
+                            "3anyIN9doris_udf9DoubleValEEEvPNS2_15FunctionContextERKT_PS6_")
+                    // .put(Type.CHAR,
+                    //    "3anyIN9doris_udf9StringValEEEvPNS2_15FunctionContextERKT_PS6_")
+                    .put(Type.VARCHAR,
+                            "3anyIN9doris_udf9StringValEEEvPNS2_15FunctionContextERKT_PS6_")
+                    .put(Type.STRING,
+                            "3anyIN9doris_udf9StringValEEEvPNS2_15FunctionContextERKT_PS6_")
+                    .put(Type.DATE,
+                            "3anyIN9doris_udf11DateTimeValEEEvPNS2_15FunctionContextERKT_PS6_")
+                    .put(Type.DATETIME,
+                            "3anyIN9doris_udf11DateTimeValEEEvPNS2_15FunctionContextERKT_PS6_")
+                    .put(Type.DECIMALV2,
+                            "3anyIN9doris_udf12DecimalV2ValEEEvPNS2_15FunctionContextERKT_PS6_")
+                    .put(Type.LARGEINT,
+                            "3anyIN9doris_udf11LargeIntValEEEvPNS2_15FunctionContextERKT_PS6_")
+                    .build();
+
     private static final Map<Type, Type> MULTI_DISTINCT_SUM_RETURN_TYPE =
              ImmutableMap.<Type, Type>builder()
                     .put(Type.TINYINT, Type.BIGINT)
@@ -1701,6 +1765,27 @@ public class FunctionSet<T> {
                     minMaxSerializeOrFinalize, minMaxGetValue,
                     null, minMaxSerializeOrFinalize, true, true, false, true));
 
+            // Any
+            addBuiltin(AggregateFunction.createBuiltin("any",
+                    Lists.newArrayList(t), t, t, prefix + ANY_INIT_SYMBOL.get(t),
+                    prefix + ANY_UPDATE_SYMBOL.get(t),
+                    prefix + ANY_UPDATE_SYMBOL.get(t),
+                    minMaxSerializeOrFinalize, minMaxGetValue,
+                    null, minMaxSerializeOrFinalize, true, true, false));
+            // vectorized
+            addBuiltin(AggregateFunction.createBuiltin("any", Lists.newArrayList(t), t, t, null, null, null, null, null,
+                    null, null, true, false, false, true));
+            // Any_Value
+            addBuiltin(AggregateFunction.createBuiltin("any_value",
+                    Lists.newArrayList(t), t, t, prefix + ANY_INIT_SYMBOL.get(t),
+                    prefix + ANY_UPDATE_SYMBOL.get(t),
+                    prefix + ANY_UPDATE_SYMBOL.get(t),
+                    minMaxSerializeOrFinalize, minMaxGetValue,
+                    null, minMaxSerializeOrFinalize, true, true, false));
+            // vectorized
+            addBuiltin(AggregateFunction.createBuiltin("any_value", Lists.newArrayList(t), t, t, null, null, null, null,
+                    null, null, null, true, false, false, true));
+
             // vectorized
             for (Type kt : Type.getSupportedTypes()) {
                 if (kt.isNull()) {
diff --git a/regression-test/data/query_p0/aggregate/aggregate.out b/regression-test/data/query_p0/aggregate/aggregate.out
index fdc1bc11f4..f571fd92a5 100644
--- a/regression-test/data/query_p0/aggregate/aggregate.out
+++ b/regression-test/data/query_p0/aggregate/aggregate.out
@@ -123,6 +123,9 @@ TESTING	AGAIN
 6000	other	\N
 8996	other	98.8777
 
+-- !aggregate --
+12	12.25	String1	1999-01-08	1999-01-08T02:05:06	1999-01-08	1999-01-08T02:05:06	\N	1999-01-08T02:05:06.111111	true	\N	123456789012345678.900123456
+
 -- !aggregate1 --
 \N	\N
 -32767	2147484649
diff --git a/regression-test/suites/query_p0/aggregate/aggregate.groovy b/regression-test/suites/query_p0/aggregate/aggregate.groovy
index 9ed8e37903..513b98b34a 100644
--- a/regression-test/suites/query_p0/aggregate/aggregate.groovy
+++ b/regression-test/suites/query_p0/aggregate/aggregate.groovy
@@ -45,6 +45,31 @@ suite("aggregate") {
             )
         """
 
+    def tableName2 = "datetype2"
+
+    sql """ DROP TABLE IF EXISTS ${tableName2} """
+    sql """
+            CREATE TABLE IF NOT EXISTS ${tableName2} (
+                c_bigint bigint,
+                c_double double,
+                c_string string,
+                c_date date,
+                c_timestamp datetime,
+                c_date_1 datev2,
+                c_timestamp_1 datetimev2,
+                c_timestamp_2 datetimev2(3),
+                c_timestamp_3 datetimev2(6),
+                c_boolean boolean,
+                c_short_decimal decimal(5,2),
+                c_long_decimal decimal(27,9)
+            )
+            DUPLICATE KEY(c_bigint)
+            DISTRIBUTED BY HASH(c_bigint) BUCKETS 1
+            PROPERTIES (
+              "replication_num" = "1"
+            )
+        """
+
     streamLoad {
         // you can skip declare db, because a default db already specify in ${DORIS_HOME}/conf/regression-conf.groovy
         // db 'regression_test'
@@ -79,6 +104,8 @@ suite("aggregate") {
         }
     }
 
+    sql "insert into ${tableName2} values (12, 12.25, 'String1', '1999-01-08', '1999-01-08 02:05:06', '1999-01-08', '1999-01-08 02:05:06.111111', null, '1999-01-08 02:05:06.111111', 'true', null, 12345678901234567890.0123456789);"
+
     sql " sync "
     qt_aggregate """ select max(upper(c_string)), min(upper(c_string)) from ${tableName} """
     qt_aggregate """ select avg(c_bigint), avg(c_double) from ${tableName} """
@@ -136,6 +163,10 @@ suite("aggregate") {
                     'again'
                     ELSE 'other' end
                  """
+    
+    qt_aggregate """ select any(c_bigint), any(c_double),any(c_string), any(c_date), any(c_timestamp),any_value(c_date_1), any(c_timestamp_1), 
+                 any_value(c_timestamp_2), any(c_timestamp_3) , any(c_boolean), any(c_short_decimal), any(c_long_decimal)from ${tableName2} """
+
 
     sql "use test_query_db"
     List<String> fields = ["k1", "k2", "k3", "k4", "k5", "k6", "k10", "k11", "k7", "k8", "k9"]


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org