This is an automated email from the ASF dual-hosted git repository.
alamb pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/datafusion.git
The following commit(s) were added to refs/heads/main by this push:
new 186ba4c3ae Minor: make some physical-plan properties public (#12022)
186ba4c3ae is described below
commit 186ba4c3ae642ac470ff26142e89051e9b333dc9
Author: Matt Green <[email protected]>
AuthorDate: Sat Aug 17 03:46:55 2024 -0700
Minor: make some physical-plan properties public (#12022)
* Minor: make some physical-plan properties public
* add Default for GroupOrderingFull
* make groups and null_expr private again
* remove pub label
---
datafusion/expr/src/logical_plan/builder.rs | 2 +-
datafusion/physical-plan/src/aggregates/mod.rs | 14 +++++++-------
datafusion/physical-plan/src/aggregates/order/full.rs | 8 +++++++-
datafusion/physical-plan/src/aggregates/order/mod.rs | 8 ++++----
datafusion/physical-plan/src/aggregates/order/partial.rs | 2 +-
datafusion/physical-plan/src/filter.rs | 2 +-
6 files changed, 21 insertions(+), 15 deletions(-)
diff --git a/datafusion/expr/src/logical_plan/builder.rs
b/datafusion/expr/src/logical_plan/builder.rs
index 2e53a68285..f9769560b2 100644
--- a/datafusion/expr/src/logical_plan/builder.rs
+++ b/datafusion/expr/src/logical_plan/builder.rs
@@ -1288,7 +1288,7 @@ pub fn build_join_schema(
///
/// This allows MySQL style selects like
/// `SELECT col FROM t WHERE pk = 5` if col is unique
-fn add_group_by_exprs_from_dependencies(
+pub fn add_group_by_exprs_from_dependencies(
mut group_expr: Vec<Expr>,
schema: &DFSchemaRef,
) -> Result<Vec<Expr>> {
diff --git a/datafusion/physical-plan/src/aggregates/mod.rs
b/datafusion/physical-plan/src/aggregates/mod.rs
index 4d39eff42b..89d4c452cc 100644
--- a/datafusion/physical-plan/src/aggregates/mod.rs
+++ b/datafusion/physical-plan/src/aggregates/mod.rs
@@ -48,9 +48,9 @@ use datafusion_physical_expr::{
use itertools::Itertools;
-mod group_values;
+pub mod group_values;
mod no_grouping;
-mod order;
+pub mod order;
mod row_hash;
mod topk;
mod topk_stream;
@@ -925,7 +925,7 @@ pub fn concat_slices<T: Clone>(lhs: &[T], rhs: &[T]) ->
Vec<T> {
///
/// A `LexRequirement` instance, which is the requirement that satisfies all
the
/// aggregate requirements. Returns an error in case of conflicting
requirements.
-fn get_finer_aggregate_exprs_requirement(
+pub fn get_finer_aggregate_exprs_requirement(
aggr_exprs: &mut [Arc<dyn AggregateExpr>],
group_by: &PhysicalGroupBy,
eq_properties: &EquivalenceProperties,
@@ -998,7 +998,7 @@ fn get_finer_aggregate_exprs_requirement(
/// The expressions are different depending on `mode`:
/// * Partial: AggregateExpr::expressions
/// * Final: columns of `AggregateExpr::state_fields()`
-fn aggregate_expressions(
+pub fn aggregate_expressions(
aggr_expr: &[Arc<dyn AggregateExpr>],
mode: &AggregateMode,
col_idx_base: usize,
@@ -1051,9 +1051,9 @@ fn merge_expressions(
})
}
-pub(crate) type AccumulatorItem = Box<dyn Accumulator>;
+pub type AccumulatorItem = Box<dyn Accumulator>;
-fn create_accumulators(
+pub fn create_accumulators(
aggr_expr: &[Arc<dyn AggregateExpr>],
) -> Result<Vec<AccumulatorItem>> {
aggr_expr
@@ -1064,7 +1064,7 @@ fn create_accumulators(
/// returns a vector of ArrayRefs, where each entry corresponds to either the
/// final value (mode = Final, FinalPartitioned and Single) or states (mode =
Partial)
-fn finalize_aggregation(
+pub fn finalize_aggregation(
accumulators: &mut [AccumulatorItem],
mode: &AggregateMode,
) -> Result<Vec<ArrayRef>> {
diff --git a/datafusion/physical-plan/src/aggregates/order/full.rs
b/datafusion/physical-plan/src/aggregates/order/full.rs
index c15538e8ab..e86d767747 100644
--- a/datafusion/physical-plan/src/aggregates/order/full.rs
+++ b/datafusion/physical-plan/src/aggregates/order/full.rs
@@ -54,7 +54,7 @@ use datafusion_expr::EmitTo;
/// `0..12` can be emitted. Note that `13` can not yet be emitted as
/// there may be more values in the next batch with the same group_id.
#[derive(Debug)]
-pub(crate) struct GroupOrderingFull {
+pub struct GroupOrderingFull {
state: State,
}
@@ -142,3 +142,9 @@ impl GroupOrderingFull {
std::mem::size_of::<Self>()
}
}
+
+impl Default for GroupOrderingFull {
+ fn default() -> Self {
+ Self::new()
+ }
+}
diff --git a/datafusion/physical-plan/src/aggregates/order/mod.rs
b/datafusion/physical-plan/src/aggregates/order/mod.rs
index 1d94d56df1..483150ee61 100644
--- a/datafusion/physical-plan/src/aggregates/order/mod.rs
+++ b/datafusion/physical-plan/src/aggregates/order/mod.rs
@@ -25,12 +25,12 @@ mod full;
mod partial;
use crate::InputOrderMode;
-pub(crate) use full::GroupOrderingFull;
-pub(crate) use partial::GroupOrderingPartial;
+pub use full::GroupOrderingFull;
+pub use partial::GroupOrderingPartial;
/// Ordering information for each group in the hash table
#[derive(Debug)]
-pub(crate) enum GroupOrdering {
+pub enum GroupOrdering {
/// Groups are not ordered
None,
/// Groups are ordered by some pre-set of the group keys
@@ -117,7 +117,7 @@ impl GroupOrdering {
}
/// Return the size of memory used by the ordering state, in bytes
- pub(crate) fn size(&self) -> usize {
+ pub fn size(&self) -> usize {
std::mem::size_of::<Self>()
+ match self {
GroupOrdering::None => 0,
diff --git a/datafusion/physical-plan/src/aggregates/order/partial.rs
b/datafusion/physical-plan/src/aggregates/order/partial.rs
index f8fd86ff8b..73a157f3aa 100644
--- a/datafusion/physical-plan/src/aggregates/order/partial.rs
+++ b/datafusion/physical-plan/src/aggregates/order/partial.rs
@@ -60,7 +60,7 @@ use std::sync::Arc;
/// order) recent group index
///```
#[derive(Debug)]
-pub(crate) struct GroupOrderingPartial {
+pub struct GroupOrderingPartial {
/// State machine
state: State,
diff --git a/datafusion/physical-plan/src/filter.rs
b/datafusion/physical-plan/src/filter.rs
index 568987b147..6aba3d8177 100644
--- a/datafusion/physical-plan/src/filter.rs
+++ b/datafusion/physical-plan/src/filter.rs
@@ -347,7 +347,7 @@ struct FilterExecStream {
baseline_metrics: BaselineMetrics,
}
-pub(crate) fn batch_filter(
+pub fn batch_filter(
batch: &RecordBatch,
predicate: &Arc<dyn PhysicalExpr>,
) -> Result<RecordBatch> {
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]