Skip to content

fix(parquet): derive boundary_order from the bounds in the column index - #12480

Open
yshcz wants to merge 1 commit into
apache:mainfrom
yshcz:fix/parquet-boundary-order
Open

yshcz wants to merge 1 commit into
apache:mainfrom
yshcz:fix/parquet-boundary-order

Conversation

@yshcz

@yshcz yshcz commented Nov 26, 2026

Copy link
Copy Markdown

Which issue does this PR close?

Rationale for this change

See #12479.

What changes are included in this PR?

The column writer no longer tracks boundary_order page by page. When the column chunk is closed, it derives the order from min_values and max_values of the built column index, skipping null pages. The comparison is the same as compare_greater; for BYTE_ARRAY and FIXED_LEN_BYTE_ARRAY the same Float16, decimal, or byte-wise comparison is applied to the bytes in the index. A pub(crate) setter is added to ColumnIndexMetaData.

For columns whose bounds are not truncated, the result is the same as before.

Are these changes tested?

Yes. Two new tests fail without the fix: test_column_index_boundary_order_of_truncated_values writes the data from #12479 with ArrowWriter and expects UNORDERED, and test_boundary_order_of_truncated_values covers a truncated binary upper bound whose increment carries. test_boundary_order_logical_type also gets a decimal case.

Are there any significant user-facing changes?

No

AI usage disclosure

All of the code was written by Claude Mythos 5.2, and I reviewed it myself.

…ndex

The column writer decided `boundary_order` by comparing the actual min
and max of each page, while the column index holds truncated lower and
upper bounds. Truncation can change the order of the values:

- a UTF-8 string is cut at a character boundary, so two strings can keep
  a different number of bytes
- a truncated upper bound is incremented, and the increment can carry

The writer could then record `ASCENDING` or `DESCENDING` for bounds that
are not in that order.

The order is now derived when the column chunk is closed, from the
bounds that the column index holds.

Co-Authored-By: Claude Mythos 5.2 <noreply@anthropic.com>
@boring-cyborg boring-cyborg Bot added the parquet parquet crate label Nov 26, 2026

This branch has not been deployed

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

Labels

parquet parquet crate

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Incorrect boundary_order in the Parquet column index when min/max values are truncated

1 participant