You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@doris.apache.org by ya...@apache.org on 2021/12/30 02:24:46 UTC

[incubator-doris] branch master updated: [fix] change percentile_approx return from nan to null (#7512)

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

yangzhg 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 7357089  [fix] change percentile_approx return from nan to null (#7512)
7357089 is described below

commit 7357089e4e68301a187fec50667fd9a67b125f3d
Author: weizuo93 <we...@apache.org>
AuthorDate: Thu Dec 30 10:24:35 2021 +0800

    [fix] change percentile_approx return from nan to null (#7512)
    
    Change function percentile_approx return value from nan to null (like hive.) to ensure that return value of function percentile_approxcan be parsed by JDBC successfully.
    Co-authored-by: weizuo <we...@xiaomi.com>
---
 be/src/exprs/aggregate_functions.cpp | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/be/src/exprs/aggregate_functions.cpp b/be/src/exprs/aggregate_functions.cpp
index 231a0fd..1f8db84 100644
--- a/be/src/exprs/aggregate_functions.cpp
+++ b/be/src/exprs/aggregate_functions.cpp
@@ -347,7 +347,11 @@ DoubleVal AggregateFunctions::percentile_approx_finalize(FunctionContext* ctx,
     double result = percentile->digest->quantile(quantile);
 
     delete percentile;
-    return DoubleVal(result);
+    if (isnan(result)) {
+        return DoubleVal(result).null();
+    } else {
+        return DoubleVal(result);
+    }
 }
 
 struct AvgState {

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