[AURON #1850] Add ArrowFieldWriter and FlinkArrowWriter for basic types#2079
Merged
Tartarus0zm merged 2 commits intoapache:masterfrom Mar 10, 2026
Merged
Conversation
…for Flink Arrow conversion Introduce the generic ArrowFieldWriter<T> base class and 12 concrete type writers that convert Flink RowData/ArrayData fields to Arrow vectors. The design follows Flink's official flink-python module (ArrowFieldWriter + forRow/forArray dual-mode pattern), as requested during Part 1 review. Writers added: - Numeric: Int, TinyInt, SmallInt, BigInt, Float, Double - Non-numeric: Boolean, VarChar, VarBinary, Decimal, Date, Null Each writer (except NullWriter) has two inner classes for RowData and ArrayData access, instantiated via static forRow()/forArray() factory methods. Includes unit tests: IntWriterTest (5), BasicWritersTest (20), NonNumericWritersTest (12) — 37 tests total.
…hods FlinkArrowWriter orchestrates per-column ArrowFieldWriters to write Flink RowData into an Arrow VectorSchemaRoot. Lifecycle: create() -> write(row)* -> finish() -> reset(). Add createArrowFieldWriterForRow/ForArray factory methods in FlinkArrowUtils that dispatch writer creation based on Arrow vector type (instanceof chain). Both are package-private as they are only used by FlinkArrowWriter.create(). Includes integration tests (7): all-types write, null handling, multi-row batches, reset, empty batch, zero columns, unsupported type. Total: 53 tests across 4 test classes, all passing.
Tartarus0zm
approved these changes
Mar 10, 2026
Contributor
Tartarus0zm
left a comment
There was a problem hiding this comment.
thanks for your contribute!
LGTM
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Which issue does this PR close?
Partially addresses #1850 (Part 2a of the Flink RowData to Arrow conversion).
Rationale for this change
Per AIP-1, the Flink integration data path requires converting Flink
RowDatainto ArrowVectorSchemaRootfor export to the native engine (DataFusion/Rust). This PR implements the writer layer for basic types, following Flink's officialflink-pythonArrow implementation as requested during Part 1 review (#1959).What changes are included in this PR?
Commit 1: ArrowFieldWriter base class + 12 type writers (16 files, +2181 lines)
ArrowFieldWriter<IN>— Generic abstract base class using template method pattern (write()→doWrite()+ count++), aligned with Flink'sflink-pythonArrowFieldWriter.writers/sub-package, each withforRow()/forArray()dual-mode factory methods:IntWriter,TinyIntWriter,SmallIntWriter,BigIntWriter,FloatWriter,DoubleWriterBooleanWriter,VarCharWriter,VarBinaryWriter,DecimalWriter,DateWriter,NullWriterNullWriter) has twopublic static finalinner classes (XxxWriterForRow/XxxWriterForArray) because Flink'sRowDataandArrayDatahave no common getter interface.NullWriter: No inner classes needed,doWrite()is empty (NullVector values are inherently null)DecimalWriter: Takes precision/scale parameters, includesfitBigDecimal()validation before writing (aligned with Flink'sfromBigDecimallogic)IntWriterTest(5),BasicWritersTest(20),NonNumericWritersTest(12) — 37 testsCommit 2: FlinkArrowWriter orchestrator + factory methods (3 files, +482 lines)
FlinkArrowWriter— Orchestrates per-columnArrowFieldWriter<RowData>[]to write FlinkRowDatainto ArrowVectorSchemaRoot. Lifecycle:create()→write(row)*→finish()→reset().FlinkArrowUtils—createArrowFieldWriterForRow()/createArrowFieldWriterForArray()dispatch writer creation based on Arrow vector type (instanceof chain). Both are package-private.FlinkArrowWriterTest(7) — all-types write, null handling, multi-row batches, reset, empty batch, zero columns, unsupported type. Total: 53 tests, all passing.Scope
This PR covers basic types only. Time, Timestamp, and complex types (Array/Map/Row) will be in Part 2b.
Are there any user-facing changes?
No. Internal API for Flink integration.
How was this patch tested?
53 tests across 4 test classes:
./build/mvn test -Pflink-1.18 -Pspark-3.5 -Pscala-2.12 \ -pl auron-flink-extension/auron-flink-runtime -am -DskipBuildNativeResult: 53 pass, 0 failures.