scio
scio copied to clipboard
Fix/union all empty list
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.unionAllnow throws anIllegalArgumentExceptionwith a clear message pointing users toScioContext.unionAllfor 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.unionAllto provide descriptive error message for empty input - Added comprehensive test coverage for both
SCollection.unionAllandScioContext.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.unionAllcontinues 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