Skip to content

Commit 186ba4c

Browse files
authored
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
1 parent 7fa7689 commit 186ba4c

File tree

6 files changed

+21
-15
lines changed

6 files changed

+21
-15
lines changed

datafusion/expr/src/logical_plan/builder.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1288,7 +1288,7 @@ pub fn build_join_schema(
12881288
///
12891289
/// This allows MySQL style selects like
12901290
/// `SELECT col FROM t WHERE pk = 5` if col is unique
1291-
fn add_group_by_exprs_from_dependencies(
1291+
pub fn add_group_by_exprs_from_dependencies(
12921292
mut group_expr: Vec<Expr>,
12931293
schema: &DFSchemaRef,
12941294
) -> Result<Vec<Expr>> {

datafusion/physical-plan/src/aggregates/mod.rs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -48,9 +48,9 @@ use datafusion_physical_expr::{
4848

4949
use itertools::Itertools;
5050

51-
mod group_values;
51+
pub mod group_values;
5252
mod no_grouping;
53-
mod order;
53+
pub mod order;
5454
mod row_hash;
5555
mod topk;
5656
mod topk_stream;
@@ -925,7 +925,7 @@ pub fn concat_slices<T: Clone>(lhs: &[T], rhs: &[T]) -> Vec<T> {
925925
///
926926
/// A `LexRequirement` instance, which is the requirement that satisfies all the
927927
/// aggregate requirements. Returns an error in case of conflicting requirements.
928-
fn get_finer_aggregate_exprs_requirement(
928+
pub fn get_finer_aggregate_exprs_requirement(
929929
aggr_exprs: &mut [Arc<dyn AggregateExpr>],
930930
group_by: &PhysicalGroupBy,
931931
eq_properties: &EquivalenceProperties,
@@ -998,7 +998,7 @@ fn get_finer_aggregate_exprs_requirement(
998998
/// The expressions are different depending on `mode`:
999999
/// * Partial: AggregateExpr::expressions
10001000
/// * Final: columns of `AggregateExpr::state_fields()`
1001-
fn aggregate_expressions(
1001+
pub fn aggregate_expressions(
10021002
aggr_expr: &[Arc<dyn AggregateExpr>],
10031003
mode: &AggregateMode,
10041004
col_idx_base: usize,
@@ -1051,9 +1051,9 @@ fn merge_expressions(
10511051
})
10521052
}
10531053

1054-
pub(crate) type AccumulatorItem = Box<dyn Accumulator>;
1054+
pub type AccumulatorItem = Box<dyn Accumulator>;
10551055

1056-
fn create_accumulators(
1056+
pub fn create_accumulators(
10571057
aggr_expr: &[Arc<dyn AggregateExpr>],
10581058
) -> Result<Vec<AccumulatorItem>> {
10591059
aggr_expr
@@ -1064,7 +1064,7 @@ fn create_accumulators(
10641064

10651065
/// returns a vector of ArrayRefs, where each entry corresponds to either the
10661066
/// final value (mode = Final, FinalPartitioned and Single) or states (mode = Partial)
1067-
fn finalize_aggregation(
1067+
pub fn finalize_aggregation(
10681068
accumulators: &mut [AccumulatorItem],
10691069
mode: &AggregateMode,
10701070
) -> Result<Vec<ArrayRef>> {

datafusion/physical-plan/src/aggregates/order/full.rs

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ use datafusion_expr::EmitTo;
5454
/// `0..12` can be emitted. Note that `13` can not yet be emitted as
5555
/// there may be more values in the next batch with the same group_id.
5656
#[derive(Debug)]
57-
pub(crate) struct GroupOrderingFull {
57+
pub struct GroupOrderingFull {
5858
state: State,
5959
}
6060

@@ -142,3 +142,9 @@ impl GroupOrderingFull {
142142
std::mem::size_of::<Self>()
143143
}
144144
}
145+
146+
impl Default for GroupOrderingFull {
147+
fn default() -> Self {
148+
Self::new()
149+
}
150+
}

datafusion/physical-plan/src/aggregates/order/mod.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -25,12 +25,12 @@ mod full;
2525
mod partial;
2626

2727
use crate::InputOrderMode;
28-
pub(crate) use full::GroupOrderingFull;
29-
pub(crate) use partial::GroupOrderingPartial;
28+
pub use full::GroupOrderingFull;
29+
pub use partial::GroupOrderingPartial;
3030

3131
/// Ordering information for each group in the hash table
3232
#[derive(Debug)]
33-
pub(crate) enum GroupOrdering {
33+
pub enum GroupOrdering {
3434
/// Groups are not ordered
3535
None,
3636
/// Groups are ordered by some pre-set of the group keys
@@ -117,7 +117,7 @@ impl GroupOrdering {
117117
}
118118

119119
/// Return the size of memory used by the ordering state, in bytes
120-
pub(crate) fn size(&self) -> usize {
120+
pub fn size(&self) -> usize {
121121
std::mem::size_of::<Self>()
122122
+ match self {
123123
GroupOrdering::None => 0,

datafusion/physical-plan/src/aggregates/order/partial.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ use std::sync::Arc;
6060
/// order) recent group index
6161
///```
6262
#[derive(Debug)]
63-
pub(crate) struct GroupOrderingPartial {
63+
pub struct GroupOrderingPartial {
6464
/// State machine
6565
state: State,
6666

datafusion/physical-plan/src/filter.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -347,7 +347,7 @@ struct FilterExecStream {
347347
baseline_metrics: BaselineMetrics,
348348
}
349349

350-
pub(crate) fn batch_filter(
350+
pub fn batch_filter(
351351
batch: &RecordBatch,
352352
predicate: &Arc<dyn PhysicalExpr>,
353353
) -> Result<RecordBatch> {

0 commit comments

Comments
 (0)