ForeverAngry opened a new pull request, #2459:
URL: https://github.com/apache/iceberg-python/pull/2459

   <!--
   Thanks for opening a pull request!
   -->
   
   <!-- In the case this PR will resolve an issue, please replace 
${GITHUB_ISSUE_ID} below with the actual Github issue id. -->
   <!-- Closes #${GITHUB_ISSUE_ID} -->
   
   # Rationale for this change
   
   Hey there! ๐Ÿš€ This PR introduces **native Vortex file format support** to 
PyIceberg, making it the **first major data processing library** to support 
this next-generation columnar format alongside Parquet!  This has been a big 
learning opportunity for me, to dive deeper into pyiceberg, as well as file 
formats. I hope folks find this interesting!  
   
   ## What is Vortex?
   
   [Vortex](https://docs.vortex.dev/) is a cutting-edge columnar file format 
designed for high-performance analytics, offering:
   
   - **๐ŸŽ๏ธ 100x faster random access** reads vs. Parquet
   - **โšก 2.5x faster analytical queries** in our benchmarks  
   - **๐Ÿ—œ๏ธ Similar compression ratios** to Parquet
   - **๐Ÿ“Š Advanced filtering capabilities** with predicate pushdown
   
   ## What's Added
   
   โœ… **Complete Integration** - Native `.vortex` file support throughout 
PyIceberg  
   โœ… **Full Feature Parity** - All operations work identically to Parquet files 
 
   โœ… **Production Ready** - Comprehensive error handling and optimization  
   โœ… **Advanced Filtering** - Complete PyArrow-based filtering with predicate 
pushdown  
   โœ… **Streaming Support** - Optimized RecordBatchReader for large datasets  
   โœ… **Schema Compatibility** - Seamless conversion between Iceberg and Vortex 
schemas  
   
   ### Key Implementation Features
   
   - **Smart Batch Optimization**: Adaptive batch sizing based on dataset 
characteristics
   - **Multi-path Read Strategy**: Direct URL reading, direct file opening, and 
fallback temp file copy
   - **Memory Optimization**: Custom allocator optimizations for Vortex 
performance  
   - **Streaming Architecture**: Uses official Vortex RecordBatchReader API for 
large datasets
   - **Comprehensive Caching**: File handle caching for repeated reads
   
   ## Performance Results ๐Ÿ“ˆ
   
   Based on our extensive benchmark suite 
([`tests/benchmark/README.md`](tests/benchmark/README.md)):
   
   | Metric | Vortex Performance | vs Parquet |
   |--------|-------------------|------------|
   | **Write Speed** | ~1.07M rows/sec | Similar |
   | **Read Speed** | ~66M rows/sec | **2.5x faster** |
   | **Compression** | Similar ratios | Comparable |
   | **Filtered Queries** | Superior performance | **1.2x - 2.4x faster** |
   
   ### Benchmark Commands
   
   ```bash
   # Quick performance check
   python tests/benchmark/vortex_benchmark.py --quick
   
   # Full comprehensive benchmark  
   python tests/benchmark/vortex_benchmark.py --full
   
   # Large scale test (15M+ rows)
   python tests/benchmark/vortex_benchmark.py --large
   ```
   
   ## Implementation Details
   
   ### Core Files Added/Modified
   
   - **vortex.py** - Complete Vortex I/O implementation
   - **pyarrow.py** - Integration with PyArrow write pipeline  
   - **test_vortex.py** - Comprehensive test suite
   - **benchmark** - Performance benchmarking suite
   - **test_add_vortex_files.py** - Integration tests
   
   ### Architecture Highlights
   
   ```python
   # Example usage - works just like Parquet!
   table.add_files(["data.vortex"])  # Add Vortex files
   table.scan().to_arrow()           # Read with filtering/projection
   ```
   
   The implementation follows official [Vortex API 
documentation](https://docs.vortex.dev/api/python/io) patterns and includes 
optimizations inspired by their RepeatedScan and Dataset APIs.
   
   ## Are these changes tested?
   
   Absolutely! ๐Ÿงช This includes one of the most comprehensive file format test 
suites:
   
   - **โœ… 20+ unit tests** covering all read/write operations
   - **โœ… Integration tests** with real Iceberg tables  
   - **โœ… Performance benchmark suite** with automated instrumentation
   - **โœ… Error handling tests** for edge cases and fallbacks
   - **โœ… Schema compatibility tests** for complex nested types
   - **โœ… Filtering and projection tests** with PyArrow expressions
   
   ### Test Coverage
   
   ```bash
   # Run Vortex-specific tests
   pytest tests/io/test_vortex.py -v
   pytest tests/integration/test_add_vortex_files.py -v
   
   # Run benchmarks  
   python tests/benchmark/vortex_benchmark.py --quick
   ```
   
   ## Are there any user-facing changes?
   
   Yes, but they're all **additive**! ๐ŸŽ‰
   
   ### New Features for Users
   
   1. **Native Vortex File Support**: Users can now use `.vortex` files 
anywhere they use `.parquet`
   2. **Performance Benefits**: Faster analytical queries, especially with 
filtering
   3. **New Installation Option**: `pip install 'pyiceberg[vortex]'` 
   
   ### Backwards Compatibility
   
   - **โœ… Zero breaking changes** - all existing Parquet workflows unchanged
   - **โœ… Optional dependency** - Vortex support only active when `vortex-data` 
installed
   - **โœ… Graceful fallbacks** - informative errors when Vortex unavailable
   
   ### Usage Examples
   
   ```python
   # Works exactly like Parquet files!
   from pyiceberg.catalog import load_catalog
   
   catalog = load_catalog("my_catalog") 
   table = catalog.load_table("my_namespace.my_table")
   
   # Add Vortex files (new!)
   table.add_files(["s3://bucket/data.vortex"])
   
   # All existing operations work  
   df = table.scan().to_pandas()                    # Full scan
   df = table.scan().filter(...).to_pandas()       # Filtered scan  
   df = table.scan().select("col1", "col2").to_pandas()  # Projected scan
   ```
   
   This makes PyIceberg the first major lakehouse library to offer users a 
choice between Parquet and Vortex formats based on their performance needs! ๐Ÿ†
   
   <!-- In the case of user-facing changes, please add the changelog label. -->
   
   


-- 
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]

Reply via email to