Skip to content

Fix ORC filter pushdown dropping rows for TIMESTAMP columns when the writer or reader time zone is not UTC - #131274

Merged
Algunenano merged 2 commits into
ClickHouse:masterfrom
Algunenano:orc-timestamp-pushdown-reader-timezone
Nov 17, 2026
Merged

Algunenano merged 2 commits into
ClickHouse:masterfrom
Algunenano:orc-timestamp-pushdown-reader-timezone

Conversation

@Algunenano

@Algunenano Algunenano commented Nov 13, 2026 •

Copy link
Copy Markdown
Member

Closes: #129944

The native ORC reader keeps the wall clock of TIMESTAMP values in the reader time zone, but the stripe, row group and bloom filter statistics, and the filter literals, are UTC instants. With input_format_orc_filter_push_down enabled, a predicate on such a column could prune rows that match. The reader now skips pruning on TIMESTAMP leaves unless both the writer time zone of the stripe and the reader time zone (input_format_orc_reader_time_zone_name) are UTC or GMT. IS NULL predicates still prune. The file-level statistics never prune TIMESTAMP leaves, because the writer time zone is stored per stripe.

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 the native ORC reader returning fewer rows than expected for filters on TIMESTAMP columns when input_format_orc_filter_push_down is enabled and the reader or writer time zone is not UTC.


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

Version info

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

The reader keeps the wall clock of `TIMESTAMP` values in the reader time zone, while the statistics, bloom filters and filter literals are UTC instants, so the pushdown could drop matching rows. Skip the pruning unless the writer and reader time zones are both `UTC` or `GMT`.

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

clickhouse-gh Bot commented Nov 13, 2026 •

Copy link
Copy Markdown
Contributor

Workflow [PR], commit [eec5ede]

Summary: ✅


AI Review

Summary

The change prevents the native ORC reader from dropping matching TIMESTAMP rows by disabling value-based pruning when the writer or reader time zone may make the statistics incomparable. File-level pruning conservatively skips timestamp comparisons, while null predicates and other column types retain pruning. Reviewed the complete diff at eec5ede238e68f134f9e170631d194e3432f4517, the surrounding reader and predicate code, and prior discussion. No actionable findings.

Missing context / blind spots
  • ⚠️ Runtime validation was unavailable locally because there is no ClickHouse binary or build directory. The visible head CI report has no ORC stateless results yet; full CI should run 05629_orc_timestamp_filter_push_down_time_zones.
Final Verdict

Status: ✅ Approve

@clickhouse-gh clickhouse-gh Bot added pr-bugfix Pull request with bugfix, not backported by default comp-formats Input/output formats (CSV/JSON/Parquet/ORC/Arrow/Protobuf/etc.). labels Nov 13, 2026
@clickhouse-gh

clickhouse-gh Bot commented Nov 13, 2026 •

Copy link
Copy Markdown
Contributor

Build profile diff (arm_release)

Comparing eec5ede23 with master 1ece88b8f (stripped binary size, per-symbol sizes and ThinLTO time; 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

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

Job report

@clickhouse-gh clickhouse-gh Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

AI review approves this commit, see the AI Review comment.

@Algunenano
Algunenano added this pull request to the merge queue Nov 16, 2026
Merged via the queue into ClickHouse:master with commit 180384b Nov 17, 2026
192 checks passed
@Algunenano
Algunenano deleted the orc-timestamp-pushdown-reader-timezone branch November 17, 2026 03:59
@robot-ch-test-poll3 robot-ch-test-poll3 added the pr-synced-to-cloud The PR is synced to the cloud repo label Nov 17, 2026
@clickgapai

Copy link
Copy Markdown
Contributor

@Algunenano — ClickGap found the following in this PR:

Close anything that's wrong or already addressed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

comp-formats Input/output formats (CSV/JSON/Parquet/ORC/Arrow/Protobuf/etc.). pr-bugfix Pull request with bugfix, not backported by default 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.

ORC TIMESTAMP pushdown ignores reader time zone, drops matching rows

3 participants