Skip to content

Update itertools requirement from 0.13 to 0.14 #13965

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Jan 3, 2025
Merged
Show file tree
Hide file tree
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
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ futures = "0.3"
half = { version = "2.2.1", default-features = false }
hashbrown = { version = "0.14.5", features = ["raw"] }
indexmap = "2.0.0"
itertools = "0.13"
itertools = "0.14"
log = "^0.4"
object_store = { version = "0.11.0", default-features = false }
parking_lot = "0.12"
Expand Down
31 changes: 20 additions & 11 deletions datafusion-cli/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -1208,7 +1208,7 @@ fn ensure_distribution(
// We store the updated children in `new_children`.
let children = izip!(
children.into_iter(),
plan.required_input_ordering().iter(),
plan.required_input_ordering(),
Copy link
Member

@jonahgao jonahgao Jan 2, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The new version of itertools will expand izip! to

          {
                let iter = ::itertools::__std_iter::IntoIterator::into_iter(
                    children.into_iter(),
                );
                let iter = ::itertools::__std_iter::Iterator::zip(
                    iter,
                    plan.required_input_ordering().iter(),
                );
                let iter = ::itertools::__std_iter::Iterator::zip(
                    iter,
                    plan.maintains_input_order(),
                );
                let iter = ::itertools::__std_iter::Iterator::zip(
                    iter,
                    repartition_status_flags.into_iter(),
                );
                ::itertools::__std_iter::Iterator::map(
                    iter,
                    |(((a, b), b), b)| (a, b, b, b),
                )
            }

plan.required_input_ordering().iter() creates a temporary value which is freed while still in use later.

It was previously expanded as

::itertools::__std_iter::IntoIterator::into_iter(
                    children.into_iter(),
                )
                .zip(plan.required_input_ordering().iter())
                .zip(plan.maintains_input_order())
                .zip(repartition_status_flags.into_iter())
                .map(|(((a, b), b), b)| (a, b, b, b))

Related upstream PR: rust-itertools/itertools#943

plan.maintains_input_order(),
repartition_status_flags.into_iter()
)
Expand Down Expand Up @@ -1275,7 +1275,7 @@ fn ensure_distribution(
let ordering_satisfied = child
.plan
.equivalence_properties()
.ordering_satisfy_requirement(required_input_ordering);
.ordering_satisfy_requirement(&required_input_ordering);
if (!ordering_satisfied || !order_preserving_variants_desirable)
&& child.data
{
Expand Down
12 changes: 6 additions & 6 deletions datafusion/core/src/physical_optimizer/sanity_checker.rs
Original file line number Diff line number Diff line change
Expand Up @@ -131,18 +131,18 @@ pub fn check_plan_sanity(
check_finiteness_requirements(Arc::clone(&plan), optimizer_options)?;

for ((idx, child), sort_req, dist_req) in izip!(
plan.children().iter().enumerate(),
plan.required_input_ordering().iter(),
plan.required_input_distribution().iter()
plan.children().into_iter().enumerate(),
plan.required_input_ordering(),
plan.required_input_distribution(),
) {
let child_eq_props = child.equivalence_properties();
if let Some(sort_req) = sort_req {
if !child_eq_props.ordering_satisfy_requirement(sort_req) {
if !child_eq_props.ordering_satisfy_requirement(&sort_req) {
let plan_str = get_plan_string(&plan);
return plan_err!(
"Plan: {:?} does not satisfy order requirements: {}. Child-{} order: {}",
plan_str,
format_physical_sort_requirement_list(sort_req),
format_physical_sort_requirement_list(&sort_req),
idx,
child_eq_props.oeq_class
);
Expand All @@ -151,7 +151,7 @@ pub fn check_plan_sanity(

if !child
.output_partitioning()
.satisfy(dist_req, child_eq_props)
.satisfy(&dist_req, child_eq_props)
{
let plan_str = get_plan_string(&plan);
return plan_err!(
Expand Down
Loading