Skip to content

[bulk_executor] fix: add --persegment support to scancount (#92) - #49

Closed
relentlesscol wants to merge 2 commits into
mainfrom
col/fix-92-scancount-persegment
Closed

[bulk_executor] fix: add --persegment support to scancount (#92)#49
relentlesscol wants to merge 2 commits into
mainfrom
col/fix-92-scancount-persegment

Conversation

@relentlesscol

Copy link
Copy Markdown
Owner

Summary

  • Adds DictAccumulator(AccumulatorParam) to correctly propagate per-segment counts from Spark executors to the driver (plain dicts don't work in Spark's distributed model)
  • Adds per_segment_accumulator parameter to _count_data which records {segment_id: count} after each segment completes
  • When --persegment flag is set, run() creates the accumulator and prints a per-segment breakdown after the total

Issues addressed

Test plan

  • All 11 new tests in test_scancount_persegment.py pass (DictAccumulator merging, _count_data integration, run() output)
  • All 1336 existing tests continue to pass (zero regressions)
  • Backward compatibility: without --persegment, output is unchanged

Unit tests assert:
- DictAccumulator (AccumulatorParam subclass) exists for per-segment
  count propagation via Spark Accumulators (not plain dicts)
- _count_data adds segment count to per_segment_accumulator
- run() creates DictAccumulator when --persegment is set
- run() prints per-segment counts when --persegment is set
- Backward compat: no per-segment output without the flag

E2e test (tests/e2e/commands/test_scancount_persegment_smoke.py):
- Runs real Glue scancount --persegment against a transient table
- Verifies per-segment output lines appear and sum to total
…labs#92)

Implements per-segment item count reporting for scancount using a Spark
Accumulator (DictAccumulator) to correctly propagate counts from
executors to the driver. Plain dicts don't work in Spark's distributed
model — only Accumulators do.

Changes:
- Add DictAccumulator(AccumulatorParam) that merges segment count dicts
- Add per_segment_accumulator parameter to _count_data
- Create per-segment accumulator in run() when persegment=True
- Print per-segment breakdown after total count
@relentlesscol

Copy link
Copy Markdown
Owner Author

Closing as stale — fork-internal PR against the fork's own main. Branch is retained; reopen if this work resumes.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant