unlock unlimited code runs for $79, limited time →
NOSSLETTER.techLIVE
back to archive

[FLINK-40472][python] Support Arrow vectorized UDFs in DataFrame API

Language: Java+1432 -246feature
concepts demonstrated
Apache Arrow integrationVectorized user-defined functions (UDFs)Python decorators and annotationsData serialization and schema validation
The Issue & Context

Prior to this change, Python UDFs in Flink's DataFrame API did not support Arrow vectorized execution, limiting performance and compatibility with pyarrow compute operations on columnar batches.

Root Cause Analysis

The existing Python UDF framework lacked integration with Arrow data structures and did not distinguish between general, pandas, and Arrow UDF types, preventing direct Arrow batch processing and efficient serialization.

Solution Strategy & Architectural Pattern

Implemented synchronous Arrow vectorized scalar UDFs by extending the Python DataFrame API and Table API to recognize Arrow UDFs, enhanced the calculation splitting and map merging logic, and upgraded the Arrow operator, worker protocol, and coder to handle native Arrow batches while maintaining pandas defaults. Added support for nested and whole-row arguments, result normalization, and schema validation, along with comprehensive testing across Python and Java components.

Key Takeaway for Contributors

Integrating Arrow vectorized UDFs into Flink's Python API significantly improves UDF execution efficiency and compatibility with pyarrow compute operations, demonstrating the value of leveraging native Arrow data structures for high-performance data processing in distributed frameworks.