Skip to content

Commit d127973

Browse files
Chen-Yuan-LaiIan LaiCheng-Yuan-Laialambblaginin
authored
Migrate core test to insta part 3 (apache#16978)
## Which issue does this PR close? <!-- We generally require a GitHub issue to be filed for all bug fixes and enhancements and this helps us generate change logs for our releases. You can link an issue to this PR using the GitHub syntax. For example `Closes #123` indicates that this PR will close issue #123. --> - Part of apache#15791 . ## Rationale for this change <!-- Why are you proposing this change? If this is already explained clearly in the issue then this section is not needed. Explaining clearly why changes are proposed helps reviewers understand your changes and offer better suggestions for fixes. --> Related apache#16324 apache#16617 ## What changes are included in this PR? <!-- There is no need to duplicate the description in the issue here but it is sometimes worth providing a summary of the individual changes in this PR. --> ## Are these changes tested? <!-- We typically require tests for all PRs in order to: 1. Prevent the code from being accidentally broken by subsequent changes 2. Serve as another way to document the expected behavior of the code If tests are not included in your PR, please explain why (for example, are they covered by existing tests)? --> ## Are there any user-facing changes? <!-- If there are user-facing changes then we may require documentation to be updated before approving the PR. --> <!-- If there are any breaking changes to public APIs, please add the `api change` label. --> No --------- Co-authored-by: Ian Lai <Ian.Lai@senao.com> Co-authored-by: Cheng-Yuan-Lai <a186235@g,ail.com> Co-authored-by: Andrew Lamb <andrew@nerdnetworks.org> Co-authored-by: blaginin <dmitrii@blaginin.me>
1 parent 144f155 commit d127973

File tree

1 file changed

+20
-16
lines changed

1 file changed

+20
-16
lines changed

datafusion/core/tests/physical_optimizer/partition_statistics.rs

Lines changed: 20 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717

1818
#[cfg(test)]
1919
mod test {
20+
use insta::assert_snapshot;
2021
use std::sync::Arc;
2122

2223
use arrow::array::{Int32Array, RecordBatch};
@@ -606,21 +607,21 @@ mod test {
606607
.build()
607608
.map(Arc::new)?];
608609

609-
let aggregate_exec_partial = Arc::new(AggregateExec::try_new(
610-
AggregateMode::Partial,
611-
group_by.clone(),
612-
aggr_expr.clone(),
613-
vec![None],
614-
Arc::clone(&scan),
615-
scan_schema.clone(),
616-
)?) as _;
617-
618-
let mut plan_string = get_plan_string(&aggregate_exec_partial);
619-
let _ = plan_string.swap_remove(1);
620-
let expected_plan = vec![
621-
"AggregateExec: mode=Partial, gby=[id@0 as id, 1 + id@0 as expr], aggr=[COUNT(c)]",
622-
];
623-
assert_eq!(plan_string, expected_plan);
610+
let aggregate_exec_partial: Arc<dyn ExecutionPlan> =
611+
Arc::new(AggregateExec::try_new(
612+
AggregateMode::Partial,
613+
group_by.clone(),
614+
aggr_expr.clone(),
615+
vec![None],
616+
Arc::clone(&scan),
617+
scan_schema.clone(),
618+
)?) as _;
619+
620+
let plan_string = get_plan_string(&aggregate_exec_partial).swap_remove(0);
621+
assert_snapshot!(
622+
plan_string,
623+
@"AggregateExec: mode=Partial, gby=[id@0 as id, 1 + id@0 as expr], aggr=[COUNT(c)]"
624+
);
624625

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

@@ -710,7 +711,10 @@ mod test {
710711
)?) as _;
711712

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

715719
let empty_stat = Statistics {
716720
num_rows: Precision::Exact(0),

0 commit comments

Comments
 (0)