Fix MAX on hive partition column after file pruning (#25629) by avakili-voleon · Pull Request #25690 · duckdb/duckdb · GitHub
Skip to content

Fix MAX on hive partition column after file pruning (#25629) - #25690

Merged
Mytherin merged 2 commits into
duckdb:v2.0-cyanopterafrom
avakili-voleon:fix-hive-max-prune-one-file
Sep 15, 2026
Merged

Mytherin merged 2 commits into
duckdb:v2.0-cyanopterafrom
avakili-voleon:fix-hive-max-prune-one-file

Conversation

@avakili-voleon

@avakili-voleon avakili-voleon commented Sep 14, 2026 •

Copy link
Copy Markdown
Contributor

Fixes #25629

  • Fix a crash/assert when MAX/MIN runs on a hive partition column after file pruning leaves a single parquet file
  • Hive partition columns can have storage indices outside the parquet file schema; thus we get rid of the assert the code was making and guard GetColumnStatistics and MinMaxIsExact instead of asserting on bounds (same pattern as parquet_multi_file_info.cpp)
  • Add a small regression test in parquet_hive.test for MAX on hive date columns after pruning
  • fork PR with CI (mostly) green: Fix MAX/MIN on hive partition column after file pruning avakili-voleon/duckdb#2

When hive partitioning prunes down to a single file, aggregate optimization
can request statistics for partition columns that are not present in the
parquet file schema. Guard against out-of-bounds column indices instead of
asserting, and add a regression test for MAX on a hive date column.

Fixes duckdb#25629
@duckdb-draftbot
duckdb-draftbot marked this pull request as draft September 14, 2026 14:03
Keep this branch limited to the hive partition MAX fix.
@avakili-voleon
avakili-voleon marked this pull request as ready for review September 14, 2026 15:06
@Mytherin
Mytherin enabled auto-merge September 15, 2026 07:10
@Mytherin

Copy link
Copy Markdown
Member

@Mytherin
Mytherin added this pull request to the merge queue Sep 15, 2026
Merged via the queue into duckdb:v2.0-cyanoptera with commit 4b1dfb8 Sep 15, 2026
76 of 78 checks passed
Mytherin added a commit that referenced this pull request Sep 16, 2026
…25766)

Cherry-pick of #25690 onto `v1.5-variegata`.

On 1.5.x, MAX/MIN on a hive partition column still crashes/asserts when
file pruning leaves a single parquet file. Hive partition columns can
have storage indices outside the parquet file schema. Guard
`GetColumnStatistics` and `MinMaxIsExact` instead of asserting on
bounds.

Original: #25690
Fork PR with CI run : avakili-voleon#4
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.

MAX on a hive partition column crashes when prune leaves one file

2 participants