Indian-boult opened a new issue, #1017:
URL: https://github.com/apache/incubator-xtable/issues/1017

   ### Search before asking
   
   - [X] I had searched in the 
[issues](https://github.com/apache/incubator-xtable/issues?q=is%3Aissue) and 
found no similar issues.
   
   ### Please describe the bug 🐞
   
   `DeltaKernelDataFileUpdatesExtractor.convertToLiteral` passes `TIMESTAMP` 
and `TIMESTAMP_NTZ` stats straight to `Literal.ofTimestamp` and 
`Literal.ofTimestampNtz`, which take micros since epoch. XTable stores these 
stats as millis or micros, depending on the field's `TIMESTAMP_PRECISION`. For 
a millisecond column the Kernel target writes min and max values 1000 times too 
small, in January 1970. Delta readers use these stats to skip files, so a 
filter on the column can return no rows.
   
   The Delta Standalone target converts by precision 
(`DeltaValueConverter.convertToDeltaColumnStatValue`), so this is a difference 
between the two targets. Millisecond stats come from the Hudi source (Avro 
`timestamp-millis`, `local-timestamp-millis`), the Paimon source 
(`TIMESTAMP(3)`) and the Parquet source (`TIMESTAMP(MILLIS)`). The Kernel 
target is used when `xtable.delta.target.use_kernel=true`, and 
`xtable-spark-runtime` turns it on by itself on Spark 3.5 and newer.
   
   To reproduce, with Spark 3.4.2 and Delta 2.4.0:
   
   1. Create a Hudi COW table with a `timestamp-millis` column, for example 
with `TestJavaHudiTable.forStandardSchema` (`timestamp_millis_nullable_field`), 
and insert 200 rows.
   2. Sync it to Delta with `ConversionController`, once with 
`xtable.delta.target.use_kernel=true` and once without, into two directories.
   3. Read each Delta table with Spark and the filter 
`timestamp_millis_nullable_field >= timestamp_millis(<a time inside the data 
range>)`.
   
   | | Rows matching the filter | Rows without a filter |
   | --- | --- | --- |
   | Hudi source | 68 | 200 |
   | Standalone target | 68 | 200 |
   | Kernel target | 0 | 200 |
   
   Stats in the Kernel target's Delta log for that column: 
`[1970-01-21T18:30:16.656Z, 1970-01-21T18:34:32.633Z]`. The data is from 
2026-11-14 to 2026-11-16.
   
   Expected behavior: the Kernel target writes the same timestamp stats as the 
Standalone target, and the filtered read returns 68 rows.
   
   ### Are you willing to submit PR?
   
   - [X] I am willing to submit a PR!
   
   ### Code of Conduct
   
   - [X] I agree to follow this project's [Code of 
Conduct](https://www.apache.org/foundation/policies/conduct)
   


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