Indian-boult opened a new pull request, #1018:
URL: https://github.com/apache/incubator-xtable/pull/1018

   Fixes #1017
   
   ## What is the purpose of the pull request
   
   The Delta Kernel target wrote the column stats of millisecond timestamp 
columns as if they were micros, so min and max landed in January 1970. Delta 
readers skip files using those stats, so a filter on the column returned no 
rows. This PR converts millis to micros before building the Kernel literal, as 
the Delta Standalone target already does. Part of the work before Kernel 
becomes the default Delta target (#886).
   
   ## Brief change log
   
   - `DeltaKernelDataFileUpdatesExtractor`: `TIMESTAMP` and `TIMESTAMP_NTZ` 
stats are converted to micros when the field's `TIMESTAMP_PRECISION` is 
`MILLIS`. Other precisions are unchanged.
   - 
`TestDeltaKernelDataFileUpdatesExtractor#testTimestampStatsUseFieldPrecision`: 
min and max for `TIMESTAMP` and `TIMESTAMP_NTZ`, with millis and micros 
precision, compared with the expected instants and with the Standalone stats.
   - `ITDeltaKernelConversionTarget`: syncs a Hudi table with a 
`timestamp-millis` column to Delta with the Kernel target and with the 
Standalone target, then checks that a filtered Spark Delta read on that column 
returns the same rows as the source for both.
   
   ## Verify this pull request
   
   This change added tests and can be verified as follows:
   
   - 
`TestDeltaKernelDataFileUpdatesExtractor#testTimestampStatsUseFieldPrecision` 
fails on `main` (`Kernel minValues.ts_millis was 1970-01-20T19:08:18.030Z`) and 
passes with the fix.
   - `ITDeltaKernelConversionTarget` fails on `main` (Kernel target 0 rows, 
source and Standalone target 68) and passes with the fix.
   - `./mvnw -pl xtable-core test`: 582 run, 0 failures, 3 skipped.
   - `ITDeltaKernelConversionSource`, `ITDeltaKernelConversionTarget` and 
`ITConversionController#testVariousOperationsDeltaKernelTarget` pass.
   
   Tables already written by the Kernel target keep the old stats on files that 
were already synced. Deleting the target `_delta_log` and running a full sync 
rewrites them.
   ```
   
   ## Comment for #886
   
   ```markdown
   Found another Kernel target difference from Standalone while checking the 
prerequisites. The Kernel target writes the stats of millisecond timestamp 
columns (Hudi `timestamp-millis`, Paimon `TIMESTAMP(3)`, Parquet 
`TIMESTAMP(MILLIS)`) as micros, so min and max land in 1970 and Spark Delta 
skips every file on a filter over that column. On a Hudi table the filtered 
read returned 0 rows from the Kernel target and 68 from the source and the 
Standalone target. Reported in #N, fix in #M.


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