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 <[email protected]>
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 <[email protected]>
---
 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: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to