[Bug] Rust-backed QDP file loader ignores the configured batch limit

Open
#1,468 2 comments 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 2 days

@KirtiRamchandani is already working on this.

Since Nov 20, 2026.

  • #1589 by @KirtiRamchandani — open

Assessment

Difficulty
3/5
Estimated time
1-2 days
Newbie friendliness
72/100
Issue type
Bug
Clarity
Clearly specified
Activity status
Quiet
Tech stack
numpy, python, rust
Domain
backend, data

Research direction

Trace the Python wrapper for QuantumDataLoader.batches and the Rust-backed file loader, focusing on where batch_limit is passed. Reproduce the issue with the provided NumPy file example, then verify that file-backed iteration stops at the configured batch count without changing other sources.

Written by the indexing model from the issue text.

Description

bug docs good-first-issue
What

QuantumDataLoader.batches(total, size) documents total as the maximum number of batches emitted for file sources. The Rust-backed file loader ignores that value and consumes the entire file because the Python wrapper always passes batch_limit=None to the native loader.

Steps to reproduce:

import numpy as np
from qumat_qdp import QuantumDataLoader

np.save("vectors.npy", np.eye(4, dtype=np.float64))

loader = (
    QuantumDataLoader()
    .backend("rust")
    .qubits(2)
    .batches(1, size=2)
    .source_file("vectors.npy")
)

print(len(list(loader)))

Actual result:

2

Expected result:

1

Iteration should never emit more than the configured number of batches for file-backed sources.

Environment
  • OS: Linux
  • Python version: 3.12.12
  • Qumat version: 0.7.0.dev0 (qumat-qdp 0.3.0.dev0)
  • GPU: NVIDIA GeForce RTX 4090
Dominant language
Rust
Stars
2.3k
Forks
1k
Avg merge
2d 20h
Merged PRs (30d)
7

Getting set up

Open in Codespaces

Starts the project's dev container in your browser, under your own GitHub account.

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from apache/mahout

All issues in apache/mahout

Similar issues

More Rust issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.