Fix timestamp precision#1931
Merged
polyzos merged 3 commits intoapache:mainapache/fluss:mainfrom Nov 5, 2025
buvb:fix-timestamp-precision-1843buvb/fluss:fix-timestamp-precision-1843Copy head branch name to clipboard
Merged
Fix timestamp precision#1931polyzos merged 3 commits intoapache:mainapache/fluss:mainfrom buvb:fix-timestamp-precision-1843buvb/fluss:fix-timestamp-precision-1843Copy head branch name to clipboard
polyzos merged 3 commits intoapache:mainapache/fluss:mainfrom
buvb:fix-timestamp-precision-1843buvb/fluss:fix-timestamp-precision-1843Copy head branch name to clipboard
Conversation
polyzos
approved these changes
Nov 5, 2025
Ugbot
pushed a commit
to Ugbot/fluss
that referenced
this pull request
Apr 26, 2026
* fix:Enhance the timestamp conversion function, support precision parameters and add truncation methods * fix:Precision test file * [client][hotfix] Add Javadoc for TimestampPojo test class
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.
Purpose
Linked issue: close #1843
This PR fixes a precision handling bug in
PojoToRowConverterwhere timestamp values were not being truncated according to the schema-defined precision when converting POJO objects to internal rows.fix log
Problem:
PojoToRowConverterdid not respect theprecisionparameter defined inTIMESTAMP_WITHOUT_TIME_ZONEandTIMESTAMP_WITH_LOCAL_TIME_ZONEtypes when converting POJO fields to row valuesRowToPojoConverter, which correctly uses precision when reading valuesSolution:
createFieldConverter()inPojoToRowConverterto extract precision fromDataTypefor timestamp fieldsconvertTimestampNtzValue()andconvertTimestampLtzValue()methods to accept and use precision parametertruncateToTimestampPrecision(LocalDateTime, int)- truncatesLocalDateTimeto specified precisiontruncateToTimestampPrecision(Instant, int)- truncatesInstantto specified precisiontruncateNanos(int, int)- core truncation logic that calculates the divisor based on precisionTests
Unit Tests:
PojoToRowConverterTest#testTimestampPrecision3- Validates precision 3 (milliseconds) truncationPojoToRowConverterTest#testTimestampPrecision6- Validates precision 6 (microseconds) truncationPojoToRowConverterTest#testTimestampPrecision9- Validates precision 9 (nanoseconds) preserves full precisionPojoToRowConverterTest#testTimestampPrecisionRoundTrip- Validates POJO → Row → POJO round-trip consistency