You are viewing a plain text version of this content. The canonical link for it is here.
Posted to github@arrow.apache.org by "Jefffrey (via GitHub)" <gi...@apache.org> on 2023/12/01 11:20:16 UTC
[PR] Parquet: don't truncate f16/decimal min/max stats [arrow-rs]
Jefffrey opened a new pull request, #5154:
URL: https://github.com/apache/arrow-rs/pull/5154
# 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. For example `Closes #123` indicates that this PR will close issue #123.
-->
Closes #5075
# 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.
-->
All logical types with `BYTE_ARRAY`/`FIXED_LEN_BYTE_ARRAY` underlying physical types share the sort order as their physical type, that being unsigned byte-wise comparison, except for `Float16` and `Decimal`. Applying the truncation logic to their min/max statistics can therefore lead to inaccurate statistics.
# 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.
-->
Add check before truncating min/max statistics to ensure `Decimal` and `Float16` columns don't get truncated.
# 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 add the `breaking change` label.
-->
--
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] Parquet: don't truncate f16/decimal min/max stats [arrow-rs]
Posted by "tustvold (via GitHub)" <gi...@apache.org>.
tustvold commented on PR #5154:
URL: https://github.com/apache/arrow-rs/pull/5154#issuecomment-1840643702
What about in write_column_metadata?
--
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] Parquet: don't truncate f16/decimal min/max stats [arrow-rs]
Posted by "Jefffrey (via GitHub)" <gi...@apache.org>.
Jefffrey commented on code in PR #5154:
URL: https://github.com/apache/arrow-rs/pull/5154#discussion_r1415480333
##########
parquet/src/column/writer/mod.rs:
##########
@@ -948,7 +964,9 @@ impl<'a, E: ColumnValueEncoder> GenericColumnWriter<'a, E> {
.with_min_is_exact(!did_truncate_min),
)
}
- Statistics::FixedLenByteArray(stats) if stats.has_min_max_set() => {
+ Statistics::FixedLenByteArray(stats)
+ if (stats.has_min_max_set() && self.can_truncate_value()) =>
+ {
Review Comment:
> What about in write_column_metadata?
This covers the truncation in `write_column_metadata(..)`
--
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] Parquet: don't truncate f16/decimal min/max stats [arrow-rs]
Posted by "tustvold (via GitHub)" <gi...@apache.org>.
tustvold merged PR #5154:
URL: https://github.com/apache/arrow-rs/pull/5154
--
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] Parquet: don't truncate f16/decimal min/max stats [arrow-rs]
Posted by "Jefffrey (via GitHub)" <gi...@apache.org>.
Jefffrey commented on PR #5154:
URL: https://github.com/apache/arrow-rs/pull/5154#issuecomment-1835922634
For reference parquet-mr has similar logic, difference being instead of opting out of truncation for Decimal, they enforce that types need to opt-in:
https://github.com/apache/parquet-mr/blob/97e6ba8e8343a7274e530a83496a7933cc5ffc01/parquet-column/src/main/java/org/apache/parquet/internal/column/columnindex/BinaryTruncator.java#L182-L225
Which has similar effect in ensuring Decimal isn't truncated
(Float16 support isn't yet merged in for parquet-mr, but they aren't changing that logic in the Float16 PR so presumably will also not do truncation: https://github.com/apache/parquet-mr/pull/1142)
--
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] Parquet: don't truncate f16/decimal min/max stats [arrow-rs]
Posted by "Jefffrey (via GitHub)" <gi...@apache.org>.
Jefffrey commented on PR #5154:
URL: https://github.com/apache/arrow-rs/pull/5154#issuecomment-1840624682
> Is this the only place we perform truncation, or do we also need to do something similar for the ColumnChunkMetadata statistics?
Those were the only places that called the truncate min/max functions
--
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