Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 20 additions & 16 deletions datafusion/core/tests/physical_optimizer/partition_statistics.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@

#[cfg(test)]
mod test {
use insta::assert_snapshot;
use std::sync::Arc;

use arrow::array::{Int32Array, RecordBatch};
Expand Down Expand Up @@ -606,21 +607,21 @@ mod test {
.build()
.map(Arc::new)?];

let aggregate_exec_partial = Arc::new(AggregateExec::try_new(
AggregateMode::Partial,
group_by.clone(),
aggr_expr.clone(),
vec![None],
Arc::clone(&scan),
scan_schema.clone(),
)?) as _;

let mut plan_string = get_plan_string(&aggregate_exec_partial);
let _ = plan_string.swap_remove(1);
let expected_plan = vec![
"AggregateExec: mode=Partial, gby=[id@0 as id, 1 + id@0 as expr], aggr=[COUNT(c)]",
];
assert_eq!(plan_string, expected_plan);
let aggregate_exec_partial: Arc<dyn ExecutionPlan> =
Arc::new(AggregateExec::try_new(
AggregateMode::Partial,
group_by.clone(),
aggr_expr.clone(),
vec![None],
Arc::clone(&scan),
scan_schema.clone(),
)?) as _;

let plan_string = get_plan_string(&aggregate_exec_partial).swap_remove(0);
assert_snapshot!(
plan_string,
@"AggregateExec: mode=Partial, gby=[id@0 as id, 1 + id@0 as expr], aggr=[COUNT(c)]"
);

let p0_statistics = aggregate_exec_partial.partition_statistics(Some(0))?;

Expand Down Expand Up @@ -710,7 +711,10 @@ mod test {
)?) as _;

let agg_plan = get_plan_string(&agg_partial).remove(0);
assert_eq!("AggregateExec: mode=Partial, gby=[id@0 as id, 1 + id@0 as expr], aggr=[COUNT(c)]",agg_plan);
assert_snapshot!(
agg_plan,
@"AggregateExec: mode=Partial, gby=[id@0 as id, 1 + id@0 as expr], aggr=[COUNT(c)]"
);

let empty_stat = Statistics {
num_rows: Precision::Exact(0),
Expand Down