From 1a64e339ef5d2022ad0d415f9ce89ba1cf821501 Mon Sep 17 00:00:00 2001 From: Michael-J-Ward Date: Wed, 24 Jul 2024 18:01:10 -0500 Subject: [PATCH 1/3] fix: expose the fluent API fn for approx_distinct instead of the module Fixes: https://github.com/apache/datafusion/issues/11643 --- datafusion/functions-aggregate/src/lib.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/datafusion/functions-aggregate/src/lib.rs b/datafusion/functions-aggregate/src/lib.rs index b39b1955bb07..32ca05b8cdd9 100644 --- a/datafusion/functions-aggregate/src/lib.rs +++ b/datafusion/functions-aggregate/src/lib.rs @@ -90,7 +90,7 @@ use std::sync::Arc; /// Fluent-style API for creating `Expr`s pub mod expr_fn { - pub use super::approx_distinct; + pub use super::approx_distinct::approx_distinct; pub use super::approx_median::approx_median; pub use super::approx_percentile_cont::approx_percentile_cont; pub use super::approx_percentile_cont_with_weight::approx_percentile_cont_with_weight; From 7affbb187c458c4d7ec25bcbd5184864cfb43cfc Mon Sep 17 00:00:00 2001 From: Michael-J-Ward Date: Wed, 24 Jul 2024 20:26:13 -0500 Subject: [PATCH 2/3] add approx_distinct to roundtrip_expr_api test --- datafusion/proto/tests/cases/roundtrip_logical_plan.rs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/datafusion/proto/tests/cases/roundtrip_logical_plan.rs b/datafusion/proto/tests/cases/roundtrip_logical_plan.rs index 25223c3731be..5ffb303f16f7 100644 --- a/datafusion/proto/tests/cases/roundtrip_logical_plan.rs +++ b/datafusion/proto/tests/cases/roundtrip_logical_plan.rs @@ -67,7 +67,7 @@ use datafusion_expr::{ }; use datafusion_functions_aggregate::average::avg_udaf; use datafusion_functions_aggregate::expr_fn::{ - array_agg, avg, bit_and, bit_or, bit_xor, bool_and, bool_or, corr, + approx_distinct, array_agg, avg, bit_and, bit_or, bit_xor, bool_and, bool_or, corr }; use datafusion_functions_aggregate::string_agg::string_agg; use datafusion_proto::bytes::{ @@ -717,6 +717,7 @@ async fn roundtrip_expr_api() -> Result<()> { var_pop(lit(2.2)), stddev(lit(2.2)), stddev_pop(lit(2.2)), + approx_distinct(lit(2)), approx_median(lit(2)), approx_percentile_cont(lit(2), lit(0.5)), approx_percentile_cont_with_weight(lit(2), lit(1), lit(0.5)), From f660161084298a20a6b1e44c7b42819864d5b0c1 Mon Sep 17 00:00:00 2001 From: Michael-J-Ward Date: Wed, 24 Jul 2024 20:47:11 -0500 Subject: [PATCH 3/3] lint: cargo fmt --- datafusion/proto/tests/cases/roundtrip_logical_plan.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/datafusion/proto/tests/cases/roundtrip_logical_plan.rs b/datafusion/proto/tests/cases/roundtrip_logical_plan.rs index 5ffb303f16f7..811b4f86b7ec 100644 --- a/datafusion/proto/tests/cases/roundtrip_logical_plan.rs +++ b/datafusion/proto/tests/cases/roundtrip_logical_plan.rs @@ -67,7 +67,7 @@ use datafusion_expr::{ }; use datafusion_functions_aggregate::average::avg_udaf; use datafusion_functions_aggregate::expr_fn::{ - approx_distinct, array_agg, avg, bit_and, bit_or, bit_xor, bool_and, bool_or, corr + approx_distinct, array_agg, avg, bit_and, bit_or, bit_xor, bool_and, bool_or, corr, }; use datafusion_functions_aggregate::string_agg::string_agg; use datafusion_proto::bytes::{