Skip to content

Shuffler extractor - #499

Open
andrewdalpino wants to merge 2 commits into
3.1from
shuffler
Open

andrewdalpino wants to merge 2 commits into
3.1from
shuffler

Conversation

@andrewdalpino

Copy link
Copy Markdown
Member

Shuffle records as they are streaming using Fisher-Yates sampling.

@andrewdalpino
andrewdalpino requested review from a team and a lite review from Copilot September 15, 2026 00:01

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🟡 Changes recommended

Validate non-positive bufferSize values and correct the documented constructor type.

Get a fresh assessment by requesting another Copilot review.

Pull request overview

Adds a bounded-buffer Shuffler extractor for streaming record randomization.

Changes:

  • Implements buffered Fisher–Yates-style shuffling.
  • Adds deterministic behavior and preservation tests.
  • Documents the extractor and adds it to navigation.
File summaries
File Summary
tests/Extractors/ShufflerTest.php Adds shuffle behavior tests.
src/Extractors/Shuffler.php Adds the streaming shuffler implementation; bufferSize validation is required.
mkdocs.yml Registers the documentation page.
docs/extractors/shuffler.md Documents the extractor; update the parameter type from Traversable to iterable.
Review details

Suppressed comments (1)

docs/extractors/shuffler.md:16

  • The constructor declares iterable $iterator and the accompanying test passes a plain array, but this parameter table advertises Traversable. That omits a valid input form from the new class's public documentation; please change this type to iterable to match the signature.
| 1 | iterator | | Traversable | The base iterator. |
  • Files reviewed: 4/4 changed files
  • Comments generated: 1
  • Review effort level: Lite

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment on lines +47 to +51
public function __construct(iterable $iterator, int $bufferSize = 256)
{
$this->iterator = $iterator;
$this->bufferSize = $bufferSize;
}
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