This is an automated email from the ASF dual-hosted git repository.

panxiaolei 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 a11e0e3bc4 [Bug](agg) fix QUANTILE_UNION many problems (#23181)
a11e0e3bc4 is described below

commit a11e0e3bc4115196d6059a2b0066bb03dc77e8be
Author: Pxl <[email protected]>
AuthorDate: Mon Aug 21 10:04:27 2023 +0800

    [Bug](agg) fix QUANTILE_UNION many problems (#23181)
    
    fix QUANTILE_UNION many problems
---
 .../aggregate_function_quantile_state.cpp               |   3 ++-
 be/src/vec/functions/function_quantile_state.cpp        |   8 +++-----
 .../sql-reference/Data-Types/QUANTILE_STATE.md          |   4 ++--
 .../sql-reference/Data-Types/QUANTILE_STATE.md          |   4 ++--
 .../main/java/org/apache/doris/analysis/ColumnDef.java  |   7 ++++---
 .../org/apache/doris/analysis/FunctionCallExpr.java     |   2 +-
 .../org/apache/doris/analysis/CreateTableStmtTest.java  |   4 ++--
 .../data/datatype_p0/bitmap/test_bitmap_int.out         | Bin 316 -> 315 bytes
 8 files changed, 16 insertions(+), 16 deletions(-)

diff --git 
a/be/src/vec/aggregate_functions/aggregate_function_quantile_state.cpp 
b/be/src/vec/aggregate_functions/aggregate_function_quantile_state.cpp
index 10be5a6357..314ab5c37b 100644
--- a/be/src/vec/aggregate_functions/aggregate_function_quantile_state.cpp
+++ b/be/src/vec/aggregate_functions/aggregate_function_quantile_state.cpp
@@ -38,7 +38,8 @@ AggregateFunctionPtr 
create_aggregate_function_quantile_state_union(const std::s
 }
 
 void 
register_aggregate_function_quantile_state(AggregateFunctionSimpleFactory& 
factory) {
-    factory.register_function("quantile_union", 
create_aggregate_function_quantile_state_union);
+    factory.register_function_both("quantile_union",
+                                   
create_aggregate_function_quantile_state_union);
 }
 
 } // namespace doris::vectorized
\ No newline at end of file
diff --git a/be/src/vec/functions/function_quantile_state.cpp 
b/be/src/vec/functions/function_quantile_state.cpp
index dc31f9227c..71409f9332 100644
--- a/be/src/vec/functions/function_quantile_state.cpp
+++ b/be/src/vec/functions/function_quantile_state.cpp
@@ -269,11 +269,9 @@ public:
         }
         float percent_arg_value = percent_arg->get_value<Float32>();
         if (percent_arg_value < 0 || percent_arg_value > 1) {
-            std::stringstream ss;
-            ss << "the input argument of percentage: " << percent_arg_value
-               << " is not valid, must be in range [0,1] ";
-            LOG(WARNING) << ss.str();
-            return Status::InternalError(ss.str());
+            return Status::InternalError(
+                    "the input argument of percentage: {} is not valid, must 
be in range [0,1] ",
+                    percent_arg_value);
         }
 
         res.reserve(input_rows_count);
diff --git a/docs/en/docs/sql-manual/sql-reference/Data-Types/QUANTILE_STATE.md 
b/docs/en/docs/sql-manual/sql-reference/Data-Types/QUANTILE_STATE.md
index ea505e63fe..ad0ab8fffd 100644
--- a/docs/en/docs/sql-manual/sql-reference/Data-Types/QUANTILE_STATE.md
+++ b/docs/en/docs/sql-manual/sql-reference/Data-Types/QUANTILE_STATE.md
@@ -48,7 +48,7 @@ related functions:
        The larger the value, the higher the precision of quantile 
approximation calculations, the greater the memory consumption, and the longer 
the calculation time.
        An unspecified or set value for the compression parameter is outside 
the range [2048, 10000], run with the default value of 2048
 
-    QUANTILE_PERCENT(QUANTILE_STATE):
+    QUANTILE_PERCENT(QUANTILE_STATE, percent):
        This function converts the intermediate result variable 
(QUANTILE_STATE) of the quantile calculation into a specific quantile value
 
     
@@ -64,7 +64,7 @@ In this way the config will be reset after the FE process 
restarts. For permanen
     
 
 ### example
-    select QUANTILE_PERCENT(QUANTILE_UNION(v1)) from test_table group by k1, 
k2, k3;
+    select QUANTILE_PERCENT(QUANTILE_UNION(v1), 0.5) from test_table group by 
k1, k2, k3;
     
 
 ### keywords
diff --git 
a/docs/zh-CN/docs/sql-manual/sql-reference/Data-Types/QUANTILE_STATE.md 
b/docs/zh-CN/docs/sql-manual/sql-reference/Data-Types/QUANTILE_STATE.md
index 09a86dca40..7c66681e1a 100644
--- a/docs/zh-CN/docs/sql-manual/sql-reference/Data-Types/QUANTILE_STATE.md
+++ b/docs/zh-CN/docs/sql-manual/sql-reference/Data-Types/QUANTILE_STATE.md
@@ -44,13 +44,13 @@ under the License.
       compression参数是可选项,可设置范围是[2048, 10000],值越大,后续分位数近似计算的精度越高,内存消耗越大,计算耗时越长。 
       compression参数未指定或设置的值在[2048, 10000]范围外,以2048的默认值运行
 
-      QUANTILE_PERCENT(QUANTILE_STATE):
+      QUANTILE_PERCENT(QUANTILE_STATE, percent):
       此函数将分位数计算的中间结果变量(QUANTILE_STATE)转化为具体的分位数数值
 
     
 
 ### example
-    select QUANTILE_PERCENT(QUANTILE_UNION(v1)) from test_table group by k1, 
k2, k3;
+    select QUANTILE_PERCENT(QUANTILE_UNION(v1), 0.5) from test_table group by 
k1, k2, k3;
     
 
 ### notice
diff --git a/fe/fe-core/src/main/java/org/apache/doris/analysis/ColumnDef.java 
b/fe/fe-core/src/main/java/org/apache/doris/analysis/ColumnDef.java
index 2ae7a04335..349be4e45e 100644
--- a/fe/fe-core/src/main/java/org/apache/doris/analysis/ColumnDef.java
+++ b/fe/fe-core/src/main/java/org/apache/doris/analysis/ColumnDef.java
@@ -338,13 +338,14 @@ public class ColumnDef {
         }
 
         // disable Bitmap Hll type in keys, values without aggregate function.
-        if (type.isBitmapType() || type.isHllType()) {
+        if (type.isBitmapType() || type.isHllType() || 
type.isQuantileStateType()) {
             if (isKey) {
-                throw new AnalysisException("Key column can not set bitmap or 
hll type:" + name);
+                throw new AnalysisException("Key column can not set complex 
type:" + name);
             }
             if (aggregateType == null) {
-                throw new AnalysisException("Bitmap and hll type have to use 
aggregate function" + name);
+                throw new AnalysisException("complex type have to use 
aggregate function: " + name);
             }
+            isAllowNull = false;
         }
 
         // A column is a key column if and only if isKey is true.
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 f83c9ce967..cac7ec392a 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
@@ -939,7 +939,7 @@ public class FunctionCallExpr extends Expr {
 
         if (fnName.getFunction().equalsIgnoreCase(FunctionSet.QUANTILE_UNION)) 
{
             if (children.size() != 1) {
-                throw new AnalysisException(fnName + "function could only have 
one child");
+                throw new AnalysisException(fnName + " function could only 
have one child");
             }
             Type inputType = getChild(0).getType();
             if (!inputType.isQuantileStateType()) {
diff --git 
a/fe/fe-core/src/test/java/org/apache/doris/analysis/CreateTableStmtTest.java 
b/fe/fe-core/src/test/java/org/apache/doris/analysis/CreateTableStmtTest.java
index a44c16b071..0c0eec2c53 100644
--- 
a/fe/fe-core/src/test/java/org/apache/doris/analysis/CreateTableStmtTest.java
+++ 
b/fe/fe-core/src/test/java/org/apache/doris/analysis/CreateTableStmtTest.java
@@ -314,7 +314,7 @@ public class CreateTableStmtTest {
         CreateTableStmt stmt = new CreateTableStmt(false, false, tblNameNoDb, 
cols, "olap",
                 new KeysDesc(KeysType.AGG_KEYS, colsName), null, new 
RandomDistributionDesc(10), null, null, "");
         expectedEx.expect(AnalysisException.class);
-        expectedEx.expectMessage("Key column can not set bitmap or hll 
type:col3");
+        expectedEx.expectMessage("Key column can not set complex type:col3");
         stmt.analyze(analyzer);
 
         cols.remove(bitmap);
@@ -324,7 +324,7 @@ public class CreateTableStmtTest {
         stmt = new CreateTableStmt(false, false, tblNameNoDb, cols, "olap", 
new KeysDesc(KeysType.AGG_KEYS, colsName),
                 null, new RandomDistributionDesc(10), null, null, "");
         expectedEx.expect(AnalysisException.class);
-        expectedEx.expectMessage("Key column can not set bitmap or hll 
type:col3");
+        expectedEx.expectMessage("Key column can not set complex type:col3");
         stmt.analyze(analyzer);
     }
 
diff --git a/regression-test/data/datatype_p0/bitmap/test_bitmap_int.out 
b/regression-test/data/datatype_p0/bitmap/test_bitmap_int.out
index 7a91338cde..d8101b7706 100644
Binary files a/regression-test/data/datatype_p0/bitmap/test_bitmap_int.out and 
b/regression-test/data/datatype_p0/bitmap/test_bitmap_int.out differ


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to