You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@doris.apache.org by zh...@apache.org on 2019/11/01 05:07:45 UTC

[incubator-doris] branch master updated: Modify the lower bound of percentile_approx compression param to 2048 (#2111)

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

zhaoc pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-doris.git


The following commit(s) were added to refs/heads/master by this push:
     new 713e046  Modify the lower bound of percentile_approx compression param to 2048 (#2111)
713e046 is described below

commit 713e04624fa9cd6ce255d3ee60f496d2240078b1
Author: shengyunyao <sh...@126.com>
AuthorDate: Fri Nov 1 13:07:39 2019 +0800

    Modify the lower bound of percentile_approx compression param to 2048 (#2111)
---
 be/src/exprs/aggregate_functions.cpp                              | 2 +-
 .../sql-functions/aggregate-functions/percentile_approx.md        | 8 ++++----
 .../sql-functions/aggregate-functions/percentile_approx_EN.md     | 6 +++---
 3 files changed, 8 insertions(+), 8 deletions(-)

diff --git a/be/src/exprs/aggregate_functions.cpp b/be/src/exprs/aggregate_functions.cpp
index 6ae307f..084f37b 100644
--- a/be/src/exprs/aggregate_functions.cpp
+++ b/be/src/exprs/aggregate_functions.cpp
@@ -195,7 +195,7 @@ void AggregateFunctions::percentile_approx_init(FunctionContext* ctx, StringVal*
     const AnyVal* digest_compression = ctx->get_constant_arg(2);
     if (digest_compression != nullptr) {
         double compression = reinterpret_cast<const DoubleVal*>(digest_compression)->val;
-        if (compression > 0 && compression < 10000) {
+        if (compression >= 2048 && compression <= 10000) {
             dst->ptr = (uint8_t*) new PercentileApproxState(compression);
             return;
         }
diff --git a/docs/documentation/cn/sql-reference/sql-functions/aggregate-functions/percentile_approx.md b/docs/documentation/cn/sql-reference/sql-functions/aggregate-functions/percentile_approx.md
index 5d91110..72def25 100755
--- a/docs/documentation/cn/sql-reference/sql-functions/aggregate-functions/percentile_approx.md
+++ b/docs/documentation/cn/sql-reference/sql-functions/aggregate-functions/percentile_approx.md
@@ -7,8 +7,8 @@
 
 返回第p个百分位点的近似值,p的值介于0到1之间
 
-compression参数是可选项,可设置范围是(0, 10000),值越大,精度越高,内存消耗越大,计算耗时越长。
-compression参数未指定或设置的值在(0, 10000)范围外,以10000的默认值运行
+compression参数是可选项,可设置范围是[2048, 10000],值越大,精度越高,内存消耗越大,计算耗时越长。
+compression参数未指定或设置的值在[2048, 10000]范围外,以10000的默认值运行
 
 该函数使用固定大小的内存,因此对于高基数的列可以使用更少的内存,可用于计算tp99等统计值
 
@@ -21,9 +21,9 @@ MySQL > select `table`, percentile_approx(cost_time,0.99) from log_statis group
 | test     |                                54.22 |
 +----------+--------------------------------------+
 
-MySQL > select `table`, percentile_approx(cost_time,0.99, 100) from log_statis group by `table`;
+MySQL > select `table`, percentile_approx(cost_time,0.99, 4096) from log_statis group by `table`;
 +---------------------+---------------------------+
-| table    | percentile_approx(`cost_time`, 0.99, 100) |
+| table    | percentile_approx(`cost_time`, 0.99, 4096.0) |
 +----------+--------------------------------------+
 | test     |                                54.21 |
 +----------+--------------------------------------+
diff --git a/docs/documentation/en/sql-reference/sql-functions/aggregate-functions/percentile_approx_EN.md b/docs/documentation/en/sql-reference/sql-functions/aggregate-functions/percentile_approx_EN.md
index d4e3dbb..0ec10ae 100644
--- a/docs/documentation/en/sql-reference/sql-functions/aggregate-functions/percentile_approx_EN.md
+++ b/docs/documentation/en/sql-reference/sql-functions/aggregate-functions/percentile_approx_EN.md
@@ -6,7 +6,7 @@
 
 Return the approximation of the point p, where the value of P is between 0 and 1.
 
-Compression param is optional and can be setted to a value in the range of (0, 10000). The bigger compression you set, the more precise result and more time cost you will get. If it is not setted or not setted in the correct range, PERCENTILE_APPROX function will run with a default compression param of 10000.
+Compression param is optional and can be setted to a value in the range of [2048, 10000]. The bigger compression you set, the more precise result and more time cost you will get. If it is not setted or not setted in the correct range, PERCENTILE_APPROX function will run with a default compression param of 10000.
 
 This function uses fixed size memory, so less memory can be used for columns with high cardinality, and can be used to calculate statistics such as tp99.
 
@@ -18,9 +18,9 @@ MySQL > select `table`, percentile_approx(cost_time,0.99) from log_statis group
 +----------+--------------------------------------+
 | test     |                                54.22 |
 +----------+--------------------------------------+
-MySQL > select `table`, percentile_approx(cost_time,0.99, 100) from log_statis group by `table`;
+MySQL > select `table`, percentile_approx(cost_time,0.99, 4096) from log_statis group by `table`;
 +---------------------+---------------------------+
-| table    | percentile_approx(`cost_time`, 0.99, 100) |
+| table    | percentile_approx(`cost_time`, 0.99, 4096.0) |
 +----------+--------------------------------------+
 | test     |                                54.21 |
 +----------+--------------------------------------+


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