You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@gluten.apache.org by lg...@apache.org on 2026/04/07 10:21:45 UTC
(gluten) branch main updated: [GLUTEN-11849][CH] Fix diff for var_samp returns NaN instead of NULL when effective row count < 2 (#11850)
This is an automated email from the ASF dual-hosted git repository.
lgbo pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/gluten.git
The following commit(s) were added to refs/heads/main by this push:
new 6383199ae8 [GLUTEN-11849][CH] Fix diff for var_samp returns NaN instead of NULL when effective row count < 2 (#11850)
6383199ae8 is described below
commit 6383199ae8c52f7baa03ca1c49f8de32b1230911
Author: exmy <xu...@gmail.com>
AuthorDate: Tue Apr 7 18:21:39 2026 +0800
[GLUTEN-11849][CH] Fix diff for var_samp returns NaN instead of NULL when effective row count < 2 (#11850)
Co-authored-by: xumingyong <xu...@bigo.sg>
---
.../org/apache/gluten/execution/GlutenClickHouseTPCHSuite.scala | 8 ++++++++
cpp-ch/local-engine/Parser/AggregateFunctionParser.cpp | 4 +++-
2 files changed, 11 insertions(+), 1 deletion(-)
diff --git a/backends-clickhouse/src/test/scala/org/apache/gluten/execution/GlutenClickHouseTPCHSuite.scala b/backends-clickhouse/src/test/scala/org/apache/gluten/execution/GlutenClickHouseTPCHSuite.scala
index b4cefc3a77..a853cf7e4c 100644
--- a/backends-clickhouse/src/test/scala/org/apache/gluten/execution/GlutenClickHouseTPCHSuite.scala
+++ b/backends-clickhouse/src/test/scala/org/apache/gluten/execution/GlutenClickHouseTPCHSuite.scala
@@ -427,6 +427,14 @@ class GlutenClickHouseTPCHSuite extends MergeTreeSuite {
}
+ test("var_samp returns null instead of NaN") {
+ val sql1 = "select var_samp(id) from range(1)"
+ val sql2 = "select covar_samp(id, id) from range(1)"
+
+ compareResultsAgainstVanillaSpark(sql1, true, { _ => })
+ compareResultsAgainstVanillaSpark(sql2, true, { _ => })
+ }
+
test("existence join") {
spark.sql("create table t1(a int, b int) using parquet")
spark.sql("create table t2(a int, b int) using parquet")
diff --git a/cpp-ch/local-engine/Parser/AggregateFunctionParser.cpp b/cpp-ch/local-engine/Parser/AggregateFunctionParser.cpp
index 696f5352f2..5bc055d08e 100644
--- a/cpp-ch/local-engine/Parser/AggregateFunctionParser.cpp
+++ b/cpp-ch/local-engine/Parser/AggregateFunctionParser.cpp
@@ -219,7 +219,9 @@ const DB::ActionsDAG::Node * AggregateFunctionParser::convertNodeTypeIfNeeded(
const DB::ActionsDAG::Node * AggregateFunctionParser::convertNanToNullIfNeed(
const CommonFunctionInfo & func_info, const DB::ActionsDAG::Node * func_node, DB::ActionsDAG & actions_dag) const
{
- if (getCHFunctionName(func_info) != "corr" || !func_node->result_type->isNullable())
+ const auto function_name = getCHFunctionName(func_info);
+ if ((function_name != "corr" && function_name != "varSamp" && function_name != "covarSamp")
+ || !func_node->result_type->isNullable())
return func_node;
/// result is nullable.
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@gluten.apache.org
For additional commands, e-mail: commits-help@gluten.apache.org