[Refactor] Unify batch producers via AdapterBackedProducer
Maintainers usually reply within 2 days
Assessment
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Newbie friendliness
- 55/100
- Issue type
- Refactor
- Clarity
- Clearly specified
- Activity status
- Quiet
- Tech stack
- rust
- Domain
- data-engineering
Research direction
Start in qdp-core/src/pipeline_runner.rs and compare the three existing producer implementations and their shared buffer behavior. Add coverage for bit-identical output on the same seed/data, then run tests/parquet_f32.rs, tests/reader.rs, and the existing pipeline tests. Done means the adapter-backed producer replaces or fully delegates the three originals without changing produced values.
Written by the indexing model from the issue text.
Description
What
Replace the three batch producers (SyntheticProducer, InMemoryProducer, StreamingProducer in qdp-core/src/pipeline_runner.rs) with a single AdapterBackedProducer<A> parameterized by a small per-source adapter, since their produce() bodies are ~80% identical.
Why
The three producers each copy the same recycle-or-allocate buffer pattern and overall produce() structure, with only the per-source step (generate synthetic / read in-memory / read streaming) actually differing. That shared 80% is duplicated maintenance and a drift risk. Factoring the common path into one generic producer with thin adapters keeps the hot loop in one place.
How
- Extract the shared buffer logic into
fn reuse_or_alloc<T: FloatElem>(recycled, len) -> Vec<T>. - Define minimal adapters —
SyntheticAdapter,InMemoryAdapter,StreamingAdapter— each implementing only the source-specific step. - Implement
AdapterBackedProducer<A>(whereAis an adapter) for theBatchProducertrait, replacing the three existing structs. - Require bit-identical output versus the legacy producers, verified by test on the same seed/data — this is a behavior-preserving refactor.
- Leave the streaming buffer's
Vec::drainas-is unless the assignee also takes E3 (then combine).
Out of scope: VecDeque buffer optimization (E3) unless combined by the same assignee, any change to produced values.
Acceptance criteria:
- Test: new producer output matches the old producer bit-for-bit on identical seed/data
- The streaming Parquet coverage in
tests/parquet_f32.rs(ParquetStreamingReader) and the streaming reader tests intests/reader.rspass unchanged - The three original producer structs are removed (or fully delegated)
- All existing pipeline tests pass
- Dominant language
- Rust
- Stars
- 2.3k
- Forks
- 1k
- Avg merge
- 2d 20h
- Merged PRs (30d)
- 7
Getting set up
Starts the project's dev container in your browser, under your own GitHub account.
- No Dockerfile or Docker Compose file
- Has a pull request template
- Read the contributing guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from apache/mahout
-
[Bug] Amazon Braket get_final_state_vector() changes the circuit, so execute_circuit() fails afterwardsPossibly taken @Howardisme claimed this 48 days ago. Openbug enhancement
Difficulty 2/5 1-3 hours Newbie friendliness 80/100
apache/mahout#1538 · 1 comment ·
Maintainers usually reply within 2 days
-
[Bug] Reusing a parameter name on two gates fails on Qiskit only (name conflict adding parameter)Possibly taken @Imad2702 claimed this 50 days ago. Openbug enhancement good-first-issue qumat
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
apache/mahout#1509 · 2 comments ·
Maintainers usually reply within 2 days
-
[Bug] Cirq backend ignores the initialized simulator and creates its own cirq.Simulator()Possibly taken @Howardisme claimed this 49 days ago. Openbug enhancement good-first-issue qumat
Difficulty 2/5 1-3 hours Newbie friendliness 66/100
apache/mahout#1508 · 1 comment · 1 assignee ·
Maintainers usually reply within 2 days
-
[Bug] Unknown backend_name leaks ModuleNotFoundError instead of a clear ValueErrorPossibly taken @Asterisk-Hunter claimed this 38 days ago. Openbug enhancement good-first-issue qumat
Difficulty 2/5 1-3 hours Newbie friendliness 62/100
apache/mahout#1506 · 5 comments ·
Maintainers usually reply within 2 days
-
bug docs enhancement question
Difficulty 5/5 Over a week Newbie friendliness 35/100
Maintainers usually reply within 2 days
Similar issues
-
chat compiler P1
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
HerringtonDarkholme/hd-lang#2793 ·
Maintainers usually reply within 1 day
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
Maintainers usually reply within 1 day
-
security-advisory
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
MinBZK/regelrecht#2173 ·
-
ci
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
jonathanong/no-mistakes#5804 ·
-
triage: failed
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
oxc-project/tsrs#1277 · 1 comment ·
Maintainers usually reply within 1 day