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

   ### 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 🐞
   
   The default Delta target (Delta Standalone) writes `TIMESTAMP` and 
`TIMESTAMP_NTZ` column stats as `yyyy-MM-dd HH:mm:ss` in UTC 
(`DeltaValueConverter.convertToDeltaColumnStatValue`). Spark Delta and Delta 
Kernel write `2026-11-14T00:39:18.926Z`. Delta readers use `minValues` and 
`maxValues` to skip files, so the XTable format gives wrong results in two ways:
   
   1. The max can be up to 999 ms below the true max. Delta adds only 1 ms to a 
timestamp max before skipping, to cover truncation to millis. A filter `ts > X` 
with X in the gap skips a file that has matching rows.
   2. The `TIMESTAMP` stats have no offset, so Spark parses them in the session 
time zone. East of UTC the max moves earlier, west of UTC the min moves later, 
by the UTC offset. Filters near either end skip files with matching rows. Delta 
Kernel readers fail to parse the stats.
   
   To reproduce, with Spark 3.4.2 and Delta 2.4.0:
   
   1. Create an Iceberg table `(id INT, ts TIMESTAMP)` with two rows in one 
file: `2026-11-14T00:39:17.250Z` and `2026-11-14T00:39:18.926789Z`.
   2. Sync it to Delta with `ConversionController` and the default Delta target.
   3. Read the Delta table with Spark and compare the row count with the source.
   
   | Session time zone | Filter | Source | Delta target |
   | --- | --- | --- | --- |
   | UTC | `ts > timestamp_micros(1794616758926788)` (max minus 1 us) | 1 | 0 |
   | Asia/Kolkata | `ts > timestamp_micros(1794613158926789)` (max minus 1 
hour) | 2 | 0 |
   | America/Los_Angeles | `ts < timestamp_micros(1794620357250000)` (min plus 
1 hour) | 2 | 0 |
   
   With `spark.databricks.delta.stats.skipping=false` the Delta target returns 
the same rows as the source. The stats in the Delta log are `"2026-11-14 
00:39:17"` and `"2026-11-14 00:39:18"`. With 
`xtable.delta.target.use_kernel=true` the stats are 
`"2026-11-14T00:39:17.250Z"` and `"2026-11-14T00:39:18.926Z"`, and every count 
matches the source.
   
   A Delta Kernel 4.0.0 scan with a filter on `ts` fails on the Standalone 
target with `Text '2026-11-14 00:39:18' could not be parsed at index 10`.
   
   Expected behavior: the Delta target writes timestamp stats with milliseconds 
and a UTC offset, as Spark Delta and Delta Kernel do, and filtered reads return 
the same rows as the source in any session time zone.
   
   ### 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