kaustuvnandy opened a new pull request, #2423: URL: https://github.com/apache/iceberg-python/pull/2423
# Add comprehensive unit tests for Table.count() method ## Rationale for this change This PR introduces unit tests for the `count()` method in PyIceberg's `DataScan` class to ensure reliable row counting functionality across different scenarios. The tests validate the method's behavior when: - Counting rows in tables with data - Handling empty tables - Processing large datasets with multiple file tasks These tests improve code coverage and provide confidence in the count operation's correctness, which is essential for data validation and analytics workflows. ## Implementation Details The tests use mocking to simulate different table states and file planning scenarios without requiring actual Iceberg table infrastructure. This approach ensures fast, isolated unit tests that focus purely on the count logic. **Test Coverage:** - `test_count_basic()`: Validates counting with a single file task containing 42 records - `test_count_empty()`: Ensures proper handling of empty tables (0 records) - `test_count_large()`: Tests aggregation across multiple file tasks (1M+ records) ## Are these changes tested? Yes, this PR adds comprehensive unit tests with mocked dependencies to verify the `count()` method behavior across multiple scenarios. ## Are there any user-facing changes? No user-facing changes. This PR only adds internal test coverage for existing functionality. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected] --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
