Skip to content

[iceberg] Fix TIMESTAMP(3) bound decoding in IcebergConversions#8231

Merged
JingsongLi merged 1 commit into
apache:masterfrom
q8webmaster:fix/iceberg-timestamp-manifest-micros
Jun 14, 2026
Merged

[iceberg] Fix TIMESTAMP(3) bound decoding in IcebergConversions#8231
JingsongLi merged 1 commit into
apache:masterfrom
q8webmaster:fix/iceberg-timestamp-manifest-micros

Conversation

@q8webmaster

@q8webmaster q8webmaster commented Jun 14, 2026

Copy link
Copy Markdown
Contributor

Problem

IcebergConversions.timestampFromBytes decoded the manifest INT64 bound with Timestamp.fromEpochMillis for precision == 3, but the Iceberg manifest always stores timestamps as INT64 microseconds regardless of precision. For precision 4–6 the same method already used Timestamp.fromMicros correctly, making the precision-3 branch inconsistent.

The practical consequence is that reading a precision-3 timestamp bound back from a manifest returns a value 1000× too large, and if that inflated value is subsequently passed through Timestamp.toMicros() it causes ArithmeticException: long overflow in Math.multiplyExact.

Fix

Use Timestamp.fromMicros for all supported precisions in timestampFromBytes.

Changes

  • IcebergConversions.java: timestampFromBytes uses fromMicros for all precisions (removes the precision == 3 special-case)
  • IcebergConversionsTimestampTest.java: provideTimestampToPaimonCases updated to supply microsecond values for the precision-3 test cases

…pFromBytes

For precision == 3, timestampFromBytes decoded the manifest INT64 value with
Timestamp.fromEpochMillis, treating it as milliseconds. The Iceberg manifest
always stores timestamps as microseconds (INT64 MICROS per spec §4.1.7).
The precision 4-6 path already used fromMicros correctly.

Use fromMicros for all supported precisions and update test cases to supply
microsecond values for the precision-3 assertions.
@JingsongLi

Copy link
Copy Markdown
Contributor

+1

@JingsongLi JingsongLi merged commit 552ad0f into apache:master Jun 14, 2026
12 checks passed
@q8webmaster q8webmaster deleted the fix/iceberg-timestamp-manifest-micros branch June 15, 2026 17:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants