voonhous opened a new issue, #21074: URL: https://github.com/apache/hudi/issues/21074
Part of #17764. Split from #20757; independent of #21073. ### Problem `HudiAvroSerializer` converts between pages and Avro records from metastore types. It has no conversion for several `HoodieSchema` types and fails on some decimals from Avro log blocks. Its replacement is driven by the field's `HoodieSchema` and the column's `TrinoTypeMapper` type. ### Scope No behavior change. - `HoodieSchemaAvroSerializer`: per-field converters compiled once from the field's schema and Trino type, with a switch over `HoodieSchemaType` with no default branch. `serialize` writes Avro-native values (`Utf8`, `ByteBuffer`, `GenericFixed`, ...) so records survive the Avro binary round trip of payload merges. `buildRecordInPage` accepts Avro-native values and the java.time / `BigDecimal` / `UUID` values of a record decoded with logical-type conversions. `toAvro` / `toBlock` are public. - `HudiUtil.toSchemaTypedColumnHandle` and `toMetadataHiveType` (the Hive type a schema-typed handle carries when no metastore column supplies one). - First user: the archived timeline reader (`TrinoParquetFileReader`). The LSM timeline schema is string, bytes and int only, so handles type the same as with `toColumnHandle`; the `SqlVarbinary` to `ByteBuffer` patch-up goes away. String fields arrive as `Utf8`, which every consumer reads through `toString`. - `TrinoTypeMapper` leaves record fields that can only hold null out of a row type, at any depth. The mapper is not used by the read path yet. - The merge path stays on `HudiAvroSerializer`: the new serializer rejects metastore-typed columns (e.g. `bigint` under a timestamp field) until columns are typed from the schema. ### Exit criteria - `TestHoodieSchemaAvroSerializer`: round trip for every `HoodieSchemaType`, nested at any depth, nulls, decimals rescaled to the column scale, strings as `Utf8`. - `TestHudiUtilColumnHandles` (schema-typed handles, metadata Hive types) and `TestTrinoTypeMapper` (null-only fields). - Archived timeline tests green. -- 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]
