cshuo opened a new pull request, #18953: URL: https://github.com/apache/hudi/pull/18953
…flink1.20 ### Describe the issue this Pull Request addresses The `hudi-flink1.20.x` module's `ParquetSplitReaderUtil` and its nested-type vector readers (`ArrayColumnReader`, `MapColumnReader`, `RowColumnReader`, `ArrayGroupReader`, and the `HeapArrayGroupColumnVector`) used Hudi's older, ad-hoc nested-Parquet decoding logic. Flink 2.1 line has since adopted a more robust Dremel-style striping/assembly reader (FLINK-35702) for `ARRAY`/`MAP`/`MULTISET`/`ROW` columns, which correctly handles repetition/definition levels, deeply nested structures, and missing/evolved fields. This PR backports that Dremel-based nested reader implementation to `hudi-flink1.20.x` so the module benefits from the same correctness improvements and stays aligned with the newer Flink versions Hudi already supports. ### Summary and Changelog The entire change is a verbatim copy of the corresponding files from hudi-flink1.19.x into hudi-flink1.20.x. - Vendors the Dremel-style nested Parquet reader from Apache Flink 2.1 (FLINK-35702) into `hudi-flink1.20.x`, adding `NestedColumnReader`, `NestedPrimitiveColumnReader`, and the `ParquetField`/`ParquetGroupField`/`ParquetPrimitiveField` type model under `vector/type`. - Adds supporting position-tracking utilities: `CollectionPosition`, `LevelDelegation`, `RowPosition` (under `vector/position`), and `BooleanArrayList`, `IntArrayList`, `LongArrayList`, `NestedPositionUtil` (under `utils`) for tracking repetition/definition levels during striping/assembly. - Removes the legacy nested-type readers `ArrayColumnReader`, `ArrayGroupReader`, `MapColumnReader`, `RowColumnReader`, and the `HeapArrayGroupColumnVector`/`ColumnarGroupArrayData`/`ColumnarGroupMapData`/`ColumnarGroupRowData` vector classes, replacing them with the new Dremel-based reader and `HeapArrayVector`/`HeapMapColumnVector`/`HeapRowColumnVector`. - Reworks `ParquetSplitReaderUtil` to build a `ParquetField` tree per split via a new `buildFieldsList(List, List, MessageColumnIO)` helper and to delegate `ARRAY`/`MAP`/`MULTISET`/`ROW` columns to `NestedColumnReader`, while keeping Hudi's specialized primitive readers (`Int64TimestampColumnReader`, `FixedLenBytesColumnReader`, `HeapDecimalVector`) for top-level primitives unchanged. - Generalizes `createVectorFromConstant` (now `public`) to build constant/null-filled vectors for `ARRAY`, `MAP`, `MULTISET`, and `ROW` types (including recursively-constructed `HeapRowColumnVector` children), used both for partition-column injection and for filling missing nested fields with nulls so the Dremel assembler can pass through those slots. - Extends `HeapMapColumnVector`, `HeapRowColumnVector`, and `ParquetDecimalVector` with new constructors/accessors needed by the new reader path, and adds `MULTISET` and `TIMESTAMP_WITH_LOCAL_TIME_ZONE` handling alongside existing logical types. - Adds an overloaded `createColumnReader(..., ParquetField)` entry point and marks the previous primitive-only `createColumnReader` overload as `@Deprecated`, forwarding to the new field-aware path. - Adds new unit tests: `TestHeapColumnVectorAccessors`, `TestParquetDecimalVector`, `TestParquetDataColumnReaderFactory`, and `TestParquetGroupField`. ### Impact Reading `ARRAY`, `MAP`, `MULTISET`, and `ROW` (including nested/repeated) columns from Parquet via `hudi-flink1.20.x` now goes through the Dremel-style striping/assembly reader instead of the previous custom nested readers. Top-level primitive column reading is unchanged. No changes to public table/connector APIs. ### Risk Level medium - this replaces the core nested-type (ARRAY/MAP/MULTISET/ROW) Parquet column reading path in `hudi-flink1.20.x`, touching read correctness for any table with nested columns on Flink 1.20. New unit tests (`TestHeapColumnVectorAccessors`, `TestParquetDecimalVector`, `TestParquetDataColumnReaderFactory`, `TestParquetGroupField`) cover the new vector accessors, decimal handling, reader factory, and field-tree construction; broader end-to-end validation with nested-column Flink tables on Flink 1.20 is recommended before merge. ### Documentation Update none ### Contributor's checklist - [ ] Read through [contributor's guide](https://hudi.apache.org/contribute/how-to-contribute) - [ ] Enough context is provided in the sections above - [ ] Adequate tests were added if applicable -- 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]
