You are viewing a plain text version of this content. The canonical link for it is here.
Posted to github@arrow.apache.org by "HippoBaro (via GitHub)" <gi...@apache.org> on 2026/09/28 19:03:12 UTC
[PR] fix(parquet): add early rejection of unsupported encodings [arrow-rs]
HippoBaro opened a new pull request, #11266:
URL: https://github.com/apache/arrow-rs/pull/11266
# Which issue does this PR close?
<!--
We generally require a GitHub issue to be filed for all bug fixes and enhancements and this helps us generate change logs for our releases. You can link an issue to this PR using the GitHub syntax.
-->
- Closes #11265.
# Rationale for this change
<!--
Why are you proposing this change? If this is already explained clearly in the issue then this section is not needed.
Explaining clearly why changes are proposed helps reviewers understand your changes and offer better suggestions for fixes.
-->
The writer accepts some encoding and physical-type combinations that no encoder can represent correctly. Invalid configurations can therefore fail only when values are written, when a dictionary falls back, or when a reader encounters the output.
# What changes are included in this PR?
<!--
There is no need to duplicate the description in the issue here but it is sometimes worth providing a summary of the individual changes in this PR.
-->
- Define the supported value-encoding matrix explicitly.
- Validate encoding and physical-type combinations at encoder construction, including the Arrow byte-array fallback path.
- Reject invalid dictionary fallback configurations even when the fallback would never be used.
- Add a construction-time validation matrix covering physical types, writer versions, and dictionary settings, and update existing error expectations.
Supported encodings and their wire representations are unchanged.
# Are these changes tested?
<!--
We typically require tests for all PRs in order to:
1. Prevent the code from being accidentally broken by subsequent changes
2. Serve as another way to document the expected behavior of the code
If tests are not included in your PR, please explain why (for example, are they covered by existing tests)?
If this PR claims a performance improvement, please include evidence such as benchmark results.
-->
Yes. The tests cover the supported encoding matrix at column construction, with dictionary encoding both enabled and disabled and with both Parquet writer versions. The Arrow writer regression now expects the invalid DOUBLE/DELTA_BINARY_PACKED configuration to fail earlier.
# Are there any user-facing changes?
<!--
If there are user-facing changes then we may require documentation to be updated before approving the PR.
If there are any breaking changes to public APIs, please call them out.
-->
Yes. Unsupported encoding configurations are rejected when the physical column encoder is constructed, before values reach that encoder. Invalid dictionary fallbacks are rejected even if the column would remain dictionary-encoded.
This deliberately changes failure timing and error messages for invalid configurations. It does not change supported encodings, valid output, or public API signatures.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: github-unsubscribe@arrow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] fix(parquet): add early rejection of unsupported encodings [arrow-rs]
Posted by "etseidl (via GitHub)" <gi...@apache.org>.
etseidl merged PR #11266:
URL: https://github.com/apache/arrow-rs/pull/11266
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: github-unsubscribe@arrow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] fix(parquet): add early rejection of unsupported encodings [arrow-rs]
Posted by "etseidl (via GitHub)" <gi...@apache.org>.
etseidl commented on code in PR #11266:
URL: https://github.com/apache/arrow-rs/pull/11266#discussion_r4127162535
##########
parquet/src/arrow/arrow_writer/byte_array.rs:
##########
@@ -148,6 +148,10 @@ impl FallbackEncoder {
WriterVersion::PARQUET_2_0 => Encoding::DELTA_BYTE_ARRAY,
});
+ crate::encodings::encoding::validate_column_encoding(
Review Comment:
calling this is duplicating the default arm of the following match. Other than standardizing messages I don't know that this is strictly necessary. And it means if we add a new byte array encoding, we have to modify this check in two places.
If we keep it anyway, let's no fully qualify it.
##########
parquet/src/encodings/encoding/mod.rs:
##########
@@ -175,6 +176,52 @@ pub(crate) mod private {
}
}
+fn unsupported_column_encoding(encoding: Encoding, physical_type: Type) -> ParquetError {
+ if encoding == Encoding::ALP {
Review Comment:
why is ALP the only special case here. for instance, BIT_PACKED is not supported at all, but now the error message will be it isn't supported for type X, which sort of implies it _is_ supported for some other type.
Since this is only called right before entering a match on encoding, why don't we just shore up the type checking in those matches, so there's a single place where this stuff is encoded/enforced.
##########
parquet/src/encodings/encoding/mod.rs:
##########
@@ -849,23 +896,39 @@ mod tests {
// supported encodings
create_and_check_encoder::<Int32Type>(0, Encoding::PLAIN, None);
create_and_check_encoder::<Int32Type>(0, Encoding::DELTA_BINARY_PACKED, None);
- create_and_check_encoder::<Int32Type>(0, Encoding::DELTA_LENGTH_BYTE_ARRAY, None);
- create_and_check_encoder::<Int32Type>(0, Encoding::DELTA_BYTE_ARRAY, None);
Review Comment:
I see your point though...why did this ever pass?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: github-unsubscribe@arrow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] fix(parquet): add early rejection of unsupported encodings [arrow-rs]
Posted by "HippoBaro (via GitHub)" <gi...@apache.org>.
HippoBaro commented on code in PR #11266:
URL: https://github.com/apache/arrow-rs/pull/11266#discussion_r4129336793
##########
parquet/src/encodings/encoding/mod.rs:
##########
@@ -175,6 +176,52 @@ pub(crate) mod private {
}
}
+fn unsupported_column_encoding(encoding: Encoding, physical_type: Type) -> ParquetError {
+ if encoding == Encoding::ALP {
Review Comment:
Ugh. Apologies for the ALP thing, ALP was merged recently, and this code dates from before, and I may have used an agent to rebase since... :shame-nun:
I’ve removed that validation layer and added the missing type checks directly to the encoding-selection matches. `BIT_PACKED` again reports: `Encoding BIT_PACKED is not supported`, without suggesting that another physical type would work. Dictionary encodings also retain: `Cannot initialize this encoding through this function.`
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: github-unsubscribe@arrow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] fix(parquet): add early rejection of unsupported encodings [arrow-rs]
Posted by "HippoBaro (via GitHub)" <gi...@apache.org>.
HippoBaro commented on code in PR #11266:
URL: https://github.com/apache/arrow-rs/pull/11266#discussion_r4129321032
##########
parquet/src/arrow/arrow_writer/byte_array.rs:
##########
@@ -148,6 +148,10 @@ impl FallbackEncoder {
WriterVersion::PARQUET_2_0 => Encoding::DELTA_BYTE_ARRAY,
});
+ crate::encodings::encoding::validate_column_encoding(
Review Comment:
Makes sense. Removed the additional call 🙇
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: github-unsubscribe@arrow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] fix(parquet): add early rejection of unsupported encodings [arrow-rs]
Posted by "HippoBaro (via GitHub)" <gi...@apache.org>.
HippoBaro commented on PR #11266:
URL: https://github.com/apache/arrow-rs/pull/11266#issuecomment-5883108973
> Thanks @HippoBaro, long time no see 👋.
Thanks @etseidl, good to be back!
> Maybe I'm missing something, but I think rather than adding the new validation function (which to me seems like a maintenance headache), why don't we just add type checking to `get_encoder` implementations?
Agreed. I’ve removed the separate validator and moved the physical-type checks into the existing encoder factory matches. I’ve also strengthened the tests to check factory errors directly, alongside the column-construction matrix covering both writer versions and dictionary settings.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: github-unsubscribe@arrow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org