Repository navigation
[1017] Write Delta Kernel timestamp stats in micros for millisecond columns - #1018
Merged
the-other-tim-brown merged 7 commits intoNov 28, 2026
Merged
Conversation
…olumns XTable stores TIMESTAMP and TIMESTAMP_NTZ column stats as millis or micros since epoch, depending on the field's TIMESTAMP_PRECISION. DeltaKernelDataFileUpdatesExtractor passed the value to Kernel's timestamp literals, which take micros, without checking the precision. For a millisecond column, such as a Hudi timestamp-millis field, the Kernel target wrote min and max 1000 times too small, in January 1970. Delta readers skip files with these stats, so a filter on the column returned no rows. The Standalone target already converts by precision. Convert millis to micros before building the literal. Fixes apache#1017
So the tests also compile once apache#1012 makes numNulls Long.
Resolves the import conflict with apache#1012 in TestDeltaKernelDataFileUpdatesExtractor by keeping both the JsonNode and ObjectMapper imports.
…re one ObjectMapper Check the timestamp-millis filter in testVariousOperationsDeltaKernelTarget instead of a separate IT, and use one ObjectMapper for the test class.
the-other-tim-brown
approved these changes
Nov 28, 2026
Contributor
|
Thanks @Indian-boult |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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:TIMESTAMPandTIMESTAMP_NTZstats are converted to micros when the field'sTIMESTAMP_PRECISIONisMILLIS. Other precisions are unchanged.TestDeltaKernelDataFileUpdatesExtractor#testTimestampStatsUseFieldPrecision: min and max forTIMESTAMPandTIMESTAMP_NTZ, with millis and micros precision, compared with the expected instants and with the Standalone stats.ITConversionController#testVariousOperationsDeltaKernelTargetalso checks a filter on the Hudi table'stimestamp-milliscolumn, so a filtered Spark Delta read on that column must return the same rows as the source.Verify this pull request
This change added tests and can be verified as follows:
TestDeltaKernelDataFileUpdatesExtractor#testTimestampStatsUseFieldPrecisionfails onmain(Kernel minValues.ts_millis was 1970-01-20T19:08:18.030Z) and passes with the fix.ITConversionController#testVariousOperationsDeltaKernelTargetfails onmainin all four cases at the new filter check, with 57 rows from the source and 0 from the Kernel target, and passes with the fix../mvnw -pl xtable-core testruns 597 tests with 0 failures and 3 skipped.ITDeltaKernelConversionSourceandITConversionControllerpassed on the earlier commits, and the fourtestVariousOperationsDeltaKernelTargetcases pass on the latest one.Tables already written by the Kernel target keep the old stats on files that were already synced. Deleting the target
_delta_logand running a full sync rewrites them.