Skip to content

GH-55571: [C++][Parquet] Honor configured column encoding on dictionary fallback - #55689

Open
ryanvickr wants to merge 1 commit into
apache:mainfrom
ryanvickr:gh-55571-fallback-encoding
Open

ryanvickr wants to merge 1 commit into
apache:mainfrom
ryanvickr:gh-55571-fallback-encoding

Conversation

@ryanvickr

Copy link
Copy Markdown

Rationale for this change

When dictionary encoding is enabled, WriterProperties::Builder::encoding rejects dictionary encodings as fallback encodings, yet the column writer ignores the configured encoding and always falls back to PLAIN when the dictionary overflows or Arrow dictionary chunks differ. Incompatible encoding/type combinations on dictionary-enabled columns also go unnoticed until fallback happens at runtime.

What changes are included in this PR?

  • Preserve the configured non-dictionary encoding when dictionary encoding is enabled and use it instead of PLAIN on dictionary fallback.
  • Construct non-PLAIN fallback encoders upfront on writer creation so incompatible encodings fail immediately rather than mid-write.
  • Update the WriterProperties::Builder::encoding docstrings to match.

Are these changes tested?

Yes, added unit tests for dictionary fallback with non-PLAIN encodings (V1/V2 pages, spaced/unspaced writes, and Arrow dictionary arrays) and for upfront rejection of incompatible encodings.

Are there any user-facing changes?

Yes. Columns with both dictionary encoding enabled and an explicit encoding set now fall back to that encoding instead of PLAIN, and incompatible fallback encodings now fail on writer creation.

Was AI used for this PR?

In accordance to the AI generation guidelines, please disclose below whether and how AI was used in this PR.

Used AI to help draft unit tests and check edge cases.

PR code and description written by:

  • Human
  • AI

Reviewed before submission by:

  • Human
  • AI
  • Not reviewed

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant