ray icon indicating copy to clipboard operation
ray copied to clipboard

[Data] Map operator input metrics retain zero-row bundles after dispatch

Open Pengkun-ZHU opened this issue 6 days ago • 0 comments

What happened + What you expected to happen

What happened: We use an offline Ray Data pipeline to build a perception evaluation set from autonomous-driving fleet logs. A CPU stage reads brake telemetry and selects camera clips from the seconds around each hard brake. A separate GPU stage labels the selected clips. The CPU stage sends one block per driving segment, so a segment with no hard brake still delivers a block, but with zero rows.

What was expected: Every original input bundle recorded as queued should be reported for dequeue exactly once, including zero-row bundles. This should not change the rows sent to the task.

Why it matters: Hard brakes are rare: if only 500 of 100,000 segments contain a hard brake, the job can label all the right clips while retaining 99,500 stale entries. Those entries hold references to filtered empty blocks, not 99,500 segments of raw video in GPU memory.

Versions / Dependencies

Ray version: a6e4077b3ba7 OS: Ubuntu 24.04, Linux 6.18.54, x86-64 Python: 3.14.4 Bazel: 7.5.0 GCC: 15.2.0

Reproduction script

from ray.data._internal.execution.bundle_queue import EstimateSize, RebundleQueue
from ray.data.tests.unit.test_bundler import _make_ref_bundles_for_unit_test

# One block per input bundle, with row counts [0, 0, 1].
inputs, _ = _make_ref_bundles_for_unit_test([[[]], [[]], [[1]]])
queue = RebundleQueue(EstimateSize(1))
for bundle in inputs:
    queue.add(bundle)

ready, originals = queue.get_next_with_original()
assert ready.num_rows() == 1  # Passes: the task input is correct.

reported = [i for i, b in enumerate(inputs) if any(b is orig for orig in originals)]
assert reported == [0, 1, 2], reported  # Fails: [2]

Issue Severity

Medium: It is a significant difficulty but I can work around it.

Pengkun-ZHU avatar Nov 30 '26 07:11 Pengkun-ZHU