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

   Part of #20625.
   
   ### Problem
   A partition column that a timestamp-based or custom key generator writes 
with the `TIMESTAMP` partition type is stored in the data files as its schema 
type, but its partition path holds the value formatted by 
`hoodie.keygen.timebased.output.dateformat`. For example, with 
`partition_field_date BIGINT`, `hoodie.keygen.timebased.timestamp.type = 
'EPOCHMILLISECONDS'` and `output.dateformat = 'yyyy-MM-dd'`, the data files 
hold `1749168000000` and the path holds `partition_field_date=2025-06-06`.
   
   | | Value returned for `partition_field_date` | Source |
   |---|---|---|
   | Spark | `1749168000000` (bigint) | data files: 
`HoodieHadoopFsRelationFactory` reads the key generator's timestamp partition 
columns from the files (`variableTimestampKeygenPartitionCols`, 
`partitionColumnsToRead`); the file index uses the formatted path only for 
pruning |
   | Trino | `'2025-06-06'` (varchar) | the partition path, through the 
metastore partition key |
   
   Hive sync registers such a partition key with the field's schema type 
(`HiveSchemaUtil.getPartitionKeyType`), here `bigint`, which cannot hold the 
formatted path values. The connector's tests register it as `string` 
(`ResourceHudiTablesInitializer`, table `hudi_custom_keygen_pt_v8_mor`; 
`TestHudiSmokeTest.testHudiCustomKeygenEpochMillisPartitionedTables` notes the 
path value is returned).
   
   ### Direction
   - Type and read the column as Spark does: its Hudi schema type, value from 
the data files.
   - Prune with the table's key generator settings: format an equality or IN 
predicate on the raw value with `hoodie.keygen.timebased.*` to select partition 
paths; use ranges only when the output format orders the same way as the value, 
and otherwise skip pruning on that column.
   - Leave partition columns of other key generators unchanged.
   
   ### Exit criteria
   - `hudi_custom_keygen_pt_v8_mor` returns the raw `bigint` values, as Spark 
does.
   - A filter on the raw value prunes partitions, with a split-count assertion.
   - Timestamp-based and custom key generator tables both covered.
   


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