Skip to content

Fix int96 overflow in parquet reader - #127401

Merged
scanhex12 merged 5 commits into
masterfrom
fix-parquet-int96-overflow-behavior
Oct 31, 2026
Merged

scanhex12 merged 5 commits into
masterfrom
fix-parquet-int96-overflow-behavior

Conversation

@scanhex12

@scanhex12 scanhex12 commented Oct 22, 2026 •

Copy link
Copy Markdown
Member

Changelog category (leave one):

  • Bug Fix (user-visible misbehavior in an official stable release)

Changelog entry (a user-readable short description of the changes that goes into CHANGELOG.md):

Fix int96 overflow in parquet reader.


Workflow [PR]
Sync PR [sync-upstream/pr/127401]

Version info

  • Merged into: 26.11.1.981-master (included in 26.11 and later)

…mestamps

`Int96Converter::convertColumn` threw unconditionally when a timestamp did not
fit into `Int64` nanoseconds, ignoring `date_time_overflow_behavior`. Databricks
writes `0001-01-01` (julian day 1721426) as a default value, so tables with such
columns were unreadable through `DataLakeCatalog` even with
`date_time_overflow_behavior = 'saturate'`.

With `saturate`, values are now clamped to the `DateTime64(9)` range. `throw` and
`ignore` keep the previous behavior.

Related: ClickHouse/support-escalation#8450

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@clickhouse-gh

clickhouse-gh Bot commented Oct 22, 2026 •

Copy link
Copy Markdown
Contributor

Workflow [PR], commit [15d6a9e]

Summary: ✅


AI Review

Summary

The PR makes Parquet INT96 decoding honor date_time_overflow_behavior = 'saturate', while preserving exceptions for overflowing values under throw and ignore. Computing the complete timestamp in Int128 also preserves representable timestamps on the lower boundary day. The previous inline finding is addressed, with a focused regression test added. No unresolved or new actionable findings remain for commit 15d6a9e17ed3b33d2d5d23a23fb203d92ed95ad8.

Missing context / blind spots
  • ⚠️ The latest CI reports do not yet contain execution results for 05443_parquet_int96_date_time_overflow_behavior and 05444_parquet_int96_lower_boundary. No local ClickHouse binary or build directory is available. A Parquet-enabled CI run of these tests would close this execution gap; the fast test build excludes them.
Final Verdict

Status: ✅ Approve. No code changes requested; the added Parquet regressions still need successful CI execution.

@clickhouse-gh clickhouse-gh Bot added the pr-bugfix Pull request with bugfix, not backported by default label Oct 22, 2026
`DateTime64(9)` covers the whole `Int64` range, so in-range values need no
clamping and an overflowing value saturates to the `Int64` minimum or maximum.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@clickhouse-gh clickhouse-gh Bot added the comp-parquet-reader-v3 Issues related to the native Parquet reader. label Oct 22, 2026
@clickhouse-gh

clickhouse-gh Bot commented Oct 22, 2026 •

Copy link
Copy Markdown
Contributor

Build profile diff (arm_release)

Comparing 15d6a9e17 with master 932de8840 (stripped binary size, per-symbol sizes and ThinLTO time; object sizes against the warmup build of 7566d4f6d; compile times per translation unit against the most recent warmup build that recompiled it).

✅ No significant changes.

Binary sizes

programs/clickhouse-stripped: smaller than the master baseline by the known offset between the two builds, so the difference is not shown. A delta that differs from the offset by more than 50% of it is shown, in either direction.

The official master build is compiled with -g and a pull request build is not, and XRay counts debug instructions towards its instrumentation threshold, so master instruments thousands of functions more and its binary is ~0.4% larger no matter what the pull request does.

Compile time of recompiled translation units

19 translation units recompiled, 184 s compile time in total, 19 of them have a recent master baseline.

Job report

@alexey-milovidov alexey-milovidov changed the title Fix in96 overflow in parquet reader Fix int96 overflow in parquet reader Oct 23, 2026
…ower boundary day

`00900_long_parquet_load_2` reads every file in `data_parquet` with default settings, and
`05443_int96_out_of_range.parquet` intentionally throws `VALUE_IS_OUT_OF_RANGE_OF_DATA_TYPE` then,
so the test failed with "having exception in stdout" in every `arm_binary` stateless job.

Add `05444_parquet_int96_lower_boundary`: an `INT96` value of `1677-09-21 12:00:00`
(julian day 2333836, time of day 43200000000000 ns). Midnight of that day does not fit into
`Int64` nanoseconds, but the full value -9223329600000000000 does, so it must be read exactly
with both `saturate` and `throw`. Before the `Int128` computation it was saturated to the
`Int64` minimum or rejected.

CI report: https://s3.amazonaws.com/clickhouse-test-reports/praktika.html?PR=127401&sha=0c99f04f738aa24ba8d71873d4f0a62bd6ea6511&name_0=PR&name_1=Stateless%20tests%20%28arm_binary%2C%20parallel%29
PR: #127401

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
@scanhex12

Copy link
Copy Markdown
Member Author

@grantholly-clickhouse thanks for the fixes

@scanhex12
scanhex12 enabled auto-merge October 29, 2026 07:38
@grantholly-clickhouse

grantholly-clickhouse commented Oct 29, 2026 •

Copy link
Copy Markdown
Contributor

I tried to get the sync PR to re-run by closing the PR and deleting the branch, but it looks like that didn't fix it: https://github.com/ClickHouse/clickhouse-private/pull/83162

Could I get some help getting this unblocked @scanhex12 ? CI is otherwise green.

@scanhex12
scanhex12 disabled auto-merge October 31, 2026 20:13
@scanhex12
scanhex12 added this pull request to the merge queue Oct 31, 2026
Merged via the queue into master with commit 802411f Oct 31, 2026
178 checks passed
@scanhex12
scanhex12 deleted the fix-parquet-int96-overflow-behavior branch October 31, 2026 20:55
@robot-ch-test-poll robot-ch-test-poll added the pr-synced-to-cloud The PR is synced to the cloud repo label Oct 31, 2026
@scanhex12 scanhex12 added the pr-must-backport Pull request should be backported intentionally. Use this label with great care! label Oct 31, 2026
@robot-ch-test-poll robot-ch-test-poll added the pr-must-backport-synced The `*-must-backport` labels are synced into the cloud Sync PR label Oct 31, 2026
clickhouse-gh Bot added a commit that referenced this pull request Nov 1, 2026
Backport #127401 to 26.10: Fix int96 overflow in parquet reader
PedroTadim added a commit that referenced this pull request Nov 2, 2026
Cherry pick #127401 to 26.9: Fix int96 overflow in parquet reader
PedroTadim added a commit that referenced this pull request Nov 2, 2026
Cherry pick #127401 to 26.8: Fix int96 overflow in parquet reader
PedroTadim added a commit that referenced this pull request Nov 2, 2026
Cherry pick #127401 to 26.3: Fix int96 overflow in parquet reader
@robot-ch-test-poll robot-ch-test-poll added the pr-backports-created Backport PRs are successfully created, it won't be processed by CI script anymore label Nov 2, 2026
clickhouse-gh Bot added a commit that referenced this pull request Nov 2, 2026
Backport #127401 to 26.8: Fix int96 overflow in parquet reader
clickhouse-gh Bot added a commit that referenced this pull request Nov 2, 2026
Backport #127401 to 26.9: Fix int96 overflow in parquet reader
PedroTadim added a commit that referenced this pull request Nov 3, 2026
Backport #127401 to 26.3: Fix int96 overflow in parquet reader
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

comp-parquet-reader-v3 Issues related to the native Parquet reader. pr-backports-created Backport PRs are successfully created, it won't be processed by CI script anymore pr-bugfix Pull request with bugfix, not backported by default pr-must-backport Pull request should be backported intentionally. Use this label with great care! pr-must-backport-synced The `*-must-backport` labels are synced into the cloud Sync PR pr-synced-to-cloud The PR is synced to the cloud repo

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants