apache/beam · error · ValueError

SplitAtFraction test completed vacuously: no non-trivial…

Error message

SplitAtFraction test completed vacuously: no non-trivial split fractions found

What it means

Similar to the vacuous-success guard: if every successful split was trivial (primary or residual empty), the exhaustive test learned nothing, so it raises this ValueError. A non-trivial split requires both primary and residual ranges to contain at least one item.

Solutions

  1. Fix try_split to reject splits at or beyond the range boundaries instead of clamping to them, and require start < split < stop.
  2. Test with a source/range containing several items so interior fractions exist.
  3. Use OffsetRangeTracker or another reference implementation to compare behavior.
  4. Reduce record granularity so fractions between 0 and 1 map to distinct interior positions.

Example fix

// before
split = min(self.stop, max(self.start, proposed))  # allows trivial splits
// after
if proposed <= self.start or proposed >= self.stop:
  return None
split = proposed
Defensive patterns

Strategy: validation

Validate before calling

stats = source.split_at_fraction(0.5)
if stats is not None and (stats[0] == start or stats[1] == stop):
    pytest.skip('splits are only trivial; exhaustive test would be vacuous')

Try / catch

try:
    assert_split_at_fraction_exhaustive(source, start, stop)
except ValueError as e:
    if 'no non-trivial split fractions' in str(e):
        pytest.fail(f'all successful splits are trivial: {e}')

Prevention

When it happens

Trigger: Calling assert_split_at_fraction_exhaustive where all successful splits occur only at fraction 0 or 1 (or at boundaries), yielding trivial primaries/residuals.

Common situations: Source whose try_split clamps split positions to range ends; RangeTracker allowing splits exactly at start/stop; two-item sources where interior fractions all fail; granularity of positions larger than the item count.

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/ccf1322c0855571d. Report an issue: GitHub.

Appendix: source

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

    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:
      # This will not happen all the time. Otherwise previous test will fail
      # due to vacuousness.
      continue

    num_trials = 0

View on GitHub (pinned to 12126d8942)