apache/beam · error · ValueError

SplitAtFraction test completed vacuously: no successful…

Error message

SplitAtFraction test completed vacuously: no successful split fractions found

What it means

After exhaustively trying all split fractions, if not a single fraction produced a successful split, the test verified nothing and completes vacuously, so the harness raises this ValueError. It prevents silently passing tests where the source never splits at all.

Solutions

  1. Implement/fix RangeTracker.try_split so it returns a valid split position when the fraction lands inside the remaining range.
  2. Test with a known-good RangeTracker (e.g. OffsetRangeTracker) to confirm the harness works with your source.
  3. Check that positions advance during reading so the remaining range at split time is non-empty.
  4. If never splitting is intended, don't use the exhaustive test — assert MUST_FAIL behavior explicitly instead.

Example fix

// before
def try_split(self, fraction):
  return None  # never splits
// after
def try_split(self, fraction):
  split = self.start + int(fraction * (self.stop - self.start))
  if split <= self.start or split >= self.stop:
    return None
  return self.position_range_tracker.try_split(split)
Defensive patterns

Strategy: validation

Validate before calling

probe = source.split_at_fraction(0.5)  # or via a RangeTracker
if probe is None:
    pytest.skip('source never splits; exhaustive test would be vacuous')

Try / catch

try:
    assert_split_at_fraction_exhaustive(source, start, stop)
except ValueError as e:
    if 'no successful split fractions' in str(e):
        pytest.fail(f'source never splits — check try_split: {e}')

Prevention

When it happens

Trigger: Calling assert_split_at_fraction_exhaustive on a source whose split_at_fraction always returns None (never splits) for every fraction and every number of items read before the split.

Common situations: Custom source with an unimplemented or always-failing try_split; RangeTracker that rejects all splits due to a miscomputed remaining range; source frozen at a single unsplitable unit (e.g. one compressed block).

Understand the failure class

Background: EmptyResultError / "no results found": when an API or scraper succeeds but returns zero rows — this error's family across 9 libraries.

Related errors


AI-assisted analysis of apache/beam@12126d8942 (2026-09-13). Data as JSON: /api/errors/7e522af06b140cbb. Report an issue: GitHub.

Appendix: source

Thrown at sdks/python/apache_beam/io/source_test_utils.py:612

  any_successful_fractions = False
  any_non_trivial_fractions = False

  for i in range(len(expected_items)):
    stats = SplitFractionStatistics([], [])

    assert_split_at_fraction_binary(
        source, expected_items, i, 0.0, None, 1.0, None, stats)

    if stats.successful_fractions:
      any_successful_fractions = True
    if stats.non_trivial_fractions:
      any_non_trivial_fractions = True

    all_non_trivial_fractions.append(stats.non_trivial_fractions)

  if not any_successful_fractions:
    raise ValueError(
        'SplitAtFraction test completed vacuously: no '
        'successful split fractions found')

  if not any_non_trivial_fractions:
    raise ValueError(
        'SplitAtFraction test completed vacuously: no non-trivial split '
        'fractions found')

  if not perform_multi_threaded_test:
    return

  num_total_trials = 0
  for i in range(len(expected_items)):
    non_trivial_fractions = [2.0]  # 2.0 is larger than any valid fraction.
    non_trivial_fractions.extend(all_non_trivial_fractions[i])
    min_non_trivial_fraction = min(non_trivial_fractions)

    if min_non_trivial_fraction == 2.0:

View on GitHub (pinned to 12126d8942)