Skip to content

*: disallow using Iterator::zip#33472

Merged
petrosagg merged 9 commits intoMaterializeInc:mainfrom
petrosagg:forbid-iterator-zip
Sep 4, 2025
Merged

*: disallow using Iterator::zip#33472
petrosagg merged 9 commits intoMaterializeInc:mainfrom
petrosagg:forbid-iterator-zip

Conversation

@petrosagg
Copy link
Copy Markdown
Contributor

@petrosagg petrosagg commented Aug 30, 2025

Motivation

As discussed recently with the cluster team, Iterator::zip can be a footgun when early stopping isn't anticipated or desirable. This PR marks the method as disallowed and switches all uses to Itertools::zip_eq which panics if the two iterators are not the same length.

During this process one bug was found! The fix is in the first commit.

The subsequent commits are in descending order of "boring", with the last two being simply adding the required use itertools::Itertools statements and adding the deny rule. Those are also quite a bit of the diff so I highly recommend reviewing commit by commit.

Tips for reviewer

Checklist

  • This PR has adequate test coverage / QA involvement has been duly considered. (trigger-ci for additional test/nightly runs)
  • This PR has an associated up-to-date design doc, is a design doc (template), or is sufficiently small to not require a design.
  • If this PR evolves an existing $T ⇔ Proto$T mapping (possibly in a backwards-incompatible way), then it is tagged with a T-proto label.
  • If this PR will require changes to cloud orchestration or tests, there is a companion cloud PR to account for those changes that is tagged with the release-blocker label (example).
  • If this PR includes major user-facing behavior changes, I have pinged the relevant PM to schedule a changelog post.

@petrosagg petrosagg force-pushed the forbid-iterator-zip branch 7 times, most recently from a4fdd52 to 8555f40 Compare September 1, 2025 16:45
@petrosagg petrosagg marked this pull request as ready for review September 1, 2025 16:55
@petrosagg petrosagg requested review from a team, ggevay and teskje as code owners September 1, 2025 16:55
@petrosagg petrosagg requested a review from aljoscha September 1, 2025 16:55
@petrosagg petrosagg force-pushed the forbid-iterator-zip branch 2 times, most recently from b95cb87 to 10649ab Compare September 1, 2025 17:03
Copy link
Copy Markdown
Contributor

@def- def- left a comment

Choose a reason for hiding this comment

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

Test changes lgtm

Copy link
Copy Markdown
Member

@antiguru antiguru left a comment

Choose a reason for hiding this comment

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

Looks good, and has surprisingly few special cases!

Signed-off-by: Petros Angelatos <petrosagg@gmail.com>
The resulting iterator of `.zip_eq` does not implement
`DoubleEndedIterator`.
Signed-off-by: Petros Angelatos <petrosagg@gmail.com>
Signed-off-by: Petros Angelatos <petrosagg@gmail.com>
Signed-off-by: Petros Angelatos <petrosagg@gmail.com>
Signed-off-by: Petros Angelatos <petrosagg@gmail.com>
@petrosagg petrosagg merged commit 6f4571e into MaterializeInc:main Sep 4, 2025
130 checks passed
@petrosagg petrosagg deleted the forbid-iterator-zip branch September 4, 2025 12:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants