scio icon indicating copy to clipboard operation
scio copied to clipboard

Fix/union all empty list

Open Anipaleja opened this issue 8 months ago • 0 comments

Summary

Improves error handling for SCollection.unionAll when called with empty collections by providing a clear, actionable error message that guides users to the appropriate API.

Problem

The SCollection.unionAll method throws an unclear exception when called with an empty collection, leaving users confused about the correct approach. Meanwhile, ScioContext.unionAll properly handles empty collections but users weren't aware of this alternative.

Solution

  • Enhanced error message: SCollection.unionAll now throws an IllegalArgumentException with a clear message pointing users to ScioContext.unionAll for empty-safe operations
  • Improved API consistency: Both methods now have well-defined, documented behavior
  • Better user experience: Users get immediate guidance on the correct API to use

Changes

  • Updated SCollection.unionAll to provide descriptive error message for empty input
  • Added comprehensive test coverage for both SCollection.unionAll and ScioContext.unionAll
  • Tests verify error message content and proper handling of single/multiple collections

Testing

  • Added unit tests for empty collection error case
  • Added tests for single and multiple collection scenarios
  • Verified ScioContext.unionAll continues to handle empty collections correctly
  • All existing tests pass

Backwards Compatibility

This change is backwards compatible - it only improves the error message for a previously failing case. No existing working code is affected.

Related Issues

Fixes #1092

Anipaleja avatar Jul 01 '25 22:07 Anipaleja