Skip to content

PHPLIB-609: Allow CachingIterator to handle Iterators with non-unique keys #896

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
Mar 24, 2022

Conversation

aleksandr-rudo
Copy link
Contributor

@aleksandr-rudo aleksandr-rudo commented Mar 4, 2022

@jmikola jmikola self-requested a review March 8, 2022 21:37
Copy link
Member

@jmikola jmikola left a comment

Choose a reason for hiding this comment

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

Additionally, please add a new test case to CachingIteratorTest that shows the class can now support iterators that return duplicate keys. The existing helper methods in that class (e.g. getTraversable) might not be usable for that purpose, but you can likely get by with creating a generator. For example:

$duplicateKeyGenerator = function() {
    yield 0 => 'a';
    yield 0 => 'b';
    yield 0 => 'c';
};

Copy link
Member

@jmikola jmikola left a comment

Choose a reason for hiding this comment

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

One suggestion to rename the count test and add testIterationNonUniqueKeys. I think we'll be good after that.

Copy link
Member

@jmikola jmikola left a comment

Choose a reason for hiding this comment

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

LGTM, but please hold off on merging until I branch v1.12.

The one build failure is unrelated to this change and is due to upstream changes in MongoDB 6.0. I added a comment in PHPLIB-810 to track it.

@jmikola jmikola merged commit 3049b5d into mongodb:master Mar 24, 2022
@jmikola jmikola changed the title PHPLIB-609: Allow CachingIterator to handle Iterators with non-unique… PHPLIB-609: Allow CachingIterator to handle Iterators with non-unique keys Mar 24, 2022
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.

2 participants