voonhous opened a new issue, #21078:
URL: https://github.com/apache/hudi/issues/21078

   Part of #17764. Split from #20757. Needs #21073, #21074, #21075, #21076, 
#21077.
   
   ### Problem
   Data columns are typed from the metastore, a lossy copy of the Hudi schema. 
Spark and Flink type them from the table's `HoodieSchema`.
   
   ### Scope
   - `HudiMetadata` / `HudiUtil.withSchemaColumnTypes`: data columns retyped 
with `TrinoTypeMapper`; partition columns keep their metastore types. Column 
listings (`streamRelationColumns`, `getTableColumnMetadata`) stay on metastore 
types, as on master (see #<7>).
   - The merge path moves to `HoodieSchemaAvroSerializer`; `HudiAvroSerializer` 
and its test are removed.
   - Base-file reads apply `ParquetReadConversions` with the table schema: 
UUID, VECTOR, and misstated timestamp units. With `support_timestamp` off, Hive 
sync registers timestamps as bigint, so master reads such files as raw longs; 
once typed as timestamps they must be repaired in this same change, or a bare 
INT64 under a timestamp fails and a #14161 file reads 1000x off.
   - Statistics guard for UUID columns: a UUID predicate is not pushed into the 
statistics or bloom filter of a column stored as text.
   - Index lookups (record-level and secondary, through `constructRecordKeys`) 
skip key columns of type `time`, `timestamp`, `timestamp with time zone` and 
`uuid`, whose key text from the Trino value does not match the writer's. Other 
types keep master's behavior.
   
   Type changes (the connector is unreleased):
   
   | Hudi type (Hive sync type) | Trino type before | Trino type after |
   |---|---|---|
   | string (`char(n)`, `varchar(n)` from DDL) | `char(n)`, `varchar(n)` | 
`varchar` |
   | int (`tinyint`, `smallint` from DDL) | `tinyint`, `smallint` | `integer` |
   | uuid (`binary`) | `varbinary` | `uuid` |
   | time (`int`, `bigint`) | `integer`, `bigint` | `time(3)`, `time(6)` |
   | timestamp (`bigint`, or `timestamp`) | `bigint`, `timestamp(9)` | 
`timestamp(3)`, `timestamp(6)`, with time zone when UTC-adjusted |
   | vector (`binary`) | `varbinary` | `array(real)`, `array(double)`, 
`array(tinyint)` |
   
   A UTC-adjusted timestamp reads as an instant, as Spark writes it. Flink 
stores its wall-clock `TIMESTAMP(p)` UTC-adjusted, so a Flink table's 
timestamps read as that wall-clock time at UTC. `char(n)` columns read as 
`varchar`, so stored trailing spaces count in comparisons. `DESCRIBE` reads the 
schema from `.hoodie`, so a table registered in the metastore but deleted from 
storage fails to describe, like `SELECT`.
   
   Known gaps after this change:
   - Listings show metastore types while `DESCRIBE` shows schema types, until 
#<7>.
   - Index lookups on the skipped key types do not prune, until #<8>.
   - `timestamp with time zone` predicates do not prune row groups, until #<9>.
   - `time(3)` / `time(6)` predicates do not prune row groups (they did as 
`integer` / `bigint`); needs a follow-up.
   
   ### Exit criteria
   - All-types fixture (every `HoodieSchemaType`, uuids in lists and maps) 
reads on the base-only and merge paths.
   - Event-time merges ordered on a decimal and a timestamp; Avro log decimals.
   - A table with mislabeled timestamps in its base and log files reads 
correctly.
   - Smoke, connector and `ITTestTrinoCustomType` expectations updated to the 
table above.


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

Reply via email to