You are viewing a plain text version of this content. The canonical link for it is here.
Posted to github@arrow.apache.org by "alamb (via GitHub)" <gi...@apache.org> on 2024/08/15 17:03:24 UTC
[PR] Write null counts in parquet files when they are present [arrow-rs]
alamb opened a new pull request, #6257:
URL: https://github.com/apache/arrow-rs/pull/6257
# Which issue does this PR close?
Closes https://github.com/apache/arrow-rs/issues/6256
# Rationale for this change
See https://github.com/apache/arrow-rs/issues/6256.
Current behavior:
* parquet-rs writer always has the null count when writing statistics, but writes `None` to thrift when the null count is zero
* parquet-rs reader treats a missing null count (`None`) as `Some(0)` (aka that it is known there are no nulls)
THis is inconsistent with the parquet spec as well as what parquet-java and parquet-cpp do
# What changes are included in this PR?
* Update parquet reader/writer to follow the spec
* Add error checking for values that are too large to fit into `i64`
* documented that older versions of parquet-rs wrote `None`.
* added tests
# Are there any user-facing changes?
Yes
Changes
* parquet-rs writer always writes `Some(..)` to thrift
* parquet-rs reader correctly returns `None` (aka that it is unknown if there are nulls)
* documented that older versions of parquet-rs wrote none.
This change means the generated parquet files are slightly larger (as now they encode `Some(0)` for null counts) but the behavior is more correct and consistent.
<!--
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] Write null counts in parquet files when they are present [arrow-rs]
Posted by "alamb (via GitHub)" <gi...@apache.org>.
alamb commented on PR #6257:
URL: https://github.com/apache/arrow-rs/pull/6257#issuecomment-2299349311
@etseidl I wonder if you have any thoughts on this code / the writing of null counts
--
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] Write null counts in parquet files when they are present [arrow-rs]
Posted by "etseidl (via GitHub)" <gi...@apache.org>.
etseidl commented on PR #6257:
URL: https://github.com/apache/arrow-rs/pull/6257#issuecomment-2372070302
> That is a (very) good idea -- I will plan to do that when I can find some time
@alamb Let me know if you'd like some help with this. I have spare cycles right now.
--
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] Write null counts in parquet files when they are present [arrow-rs]
Posted by "etseidl (via GitHub)" <gi...@apache.org>.
etseidl commented on PR #6257:
URL: https://github.com/apache/arrow-rs/pull/6257#issuecomment-2315831294
> Unless someone else has time to review this PR and thinks it should go into 53.0.0 (#6016) my personal preference would be to merge this PR early in the next major release cycle (e.g. 54.0.0) so it gets maximum bake / testing time before release
I've looked this PR over several times and haven't found any issues with it. The only thing giving me pause is this https://github.com/apache/parquet-format/pull/449#discussion_r1730336950
It seems java and cpp ignore the definition levels and write Some(0) regardless, so I'm fine with merging this and worrying about micro optimizations down the road (in step with the rest of the parquet community).
--
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] Write null counts in parquet files when they are present [arrow-rs]
Posted by "alamb (via GitHub)" <gi...@apache.org>.
alamb commented on PR #6257:
URL: https://github.com/apache/arrow-rs/pull/6257#issuecomment-2322885746
Thank you @etseidl -- I think
1. given the potential for this PR to cause unintended consequences
2. we haven't acutally had any bug reports related to this issue,
3. the `53.0.0` release is imminent and has several people waiting on features
I am not going to merge this PR until after we have released 53.0.0
--
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] Write null counts in parquet files when they are present [arrow-rs]
Posted by "etseidl (via GitHub)" <gi...@apache.org>.
etseidl commented on code in PR #6257:
URL: https://github.com/apache/arrow-rs/pull/6257#discussion_r1863962798
##########
parquet/src/file/statistics.rs:
##########
@@ -416,9 +429,20 @@ impl Statistics {
/// Returns number of null values for the column, if known.
/// Note that this includes all nulls when column is part of the complex type.
///
- /// Note this API returns Some(0) even if the null count was not present
- /// in the statistics.
- /// See <https://github.com/apache/arrow-rs/pull/6216/files>
+ /// Note: Versions of this library prior to `53.0.0` returned 0 if the null count was
+ /// not available. This method returns `None` in that case.
+ ///
+ /// Also, versions of this library prior to `53.0.0` did not store the null count in the
Review Comment:
```suggestion
/// Also, versions of this library prior to `53.1.0` did not store the null count in the
```
The write changes just missed the 53.0.0 cutoff it seems.
--
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] Write null counts in parquet files when they are present [arrow-rs]
Posted by "etseidl (via GitHub)" <gi...@apache.org>.
etseidl commented on code in PR #6257:
URL: https://github.com/apache/arrow-rs/pull/6257#discussion_r1863843755
##########
parquet/src/file/statistics.rs:
##########
@@ -416,9 +429,20 @@ impl Statistics {
/// Returns number of null values for the column, if known.
/// Note that this includes all nulls when column is part of the complex type.
///
- /// Note this API returns Some(0) even if the null count was not present
- /// in the statistics.
- /// See <https://github.com/apache/arrow-rs/pull/6216/files>
+ /// Note: Versions of this library prior to `53.0.0` returned 0 if the null count was
Review Comment:
```suggestion
/// Note: Versions of this library prior to `54.0.0` returned 0 if the null count was
```
--
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] Write null counts in parquet files when they are present [arrow-rs]
Posted by "etseidl (via GitHub)" <gi...@apache.org>.
etseidl commented on PR #6257:
URL: https://github.com/apache/arrow-rs/pull/6257#issuecomment-3416444387
Just to beat this dead horse some more, I left the current behavior during the thrift remodel.
--
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] Write null counts in parquet files when they are present [arrow-rs]
Posted by "etseidl (via GitHub)" <gi...@apache.org>.
etseidl commented on PR #6257:
URL: https://github.com/apache/arrow-rs/pull/6257#issuecomment-2499259785
Gentle bump...do we want to merge this now?
--
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] Write null counts in parquet files when they are present [arrow-rs]
Posted by "etseidl (via GitHub)" <gi...@apache.org>.
etseidl commented on PR #6257:
URL: https://github.com/apache/arrow-rs/pull/6257#issuecomment-2501672492
Not my call, but I would just throw out there that with this change, there is still a way to get the old behavior if desired. But without this change, there is no way for a user to figure out if `null_count` is truly `0` or is not present. Food for thought.
--
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] Write null counts in parquet files when they are present [arrow-rs]
Posted by "alamb (via GitHub)" <gi...@apache.org>.
alamb commented on PR #6257:
URL: https://github.com/apache/arrow-rs/pull/6257#issuecomment-2366765273
I go back and forth on this PR -- it isn't technically an API change in the sense of a breaking API change, but also it changes the content of written parquet files. Arguable the content better matches the parquet spec, I am just really worried about unintended consequences of doing this
Maybe I am overly concerned.
--
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] Write null counts in parquet files when they are present [arrow-rs]
Posted by "alamb (via GitHub)" <gi...@apache.org>.
alamb commented on PR #6257:
URL: https://github.com/apache/arrow-rs/pull/6257#issuecomment-2500413771
I am still quite worried about the subtle semantic implications of this change -- see for example the discussion on
- https://github.com/apache/datafusion/issues/13525
This is the kind of change that could easily lead to lots of debugging / head scratching I think, and even worse would be hard to catch with tests as it would only affect files written in the past
So I am torn, to be honest
--
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] Write null counts in parquet files when they are present [arrow-rs]
Posted by "Michael-J-Ward (via GitHub)" <gi...@apache.org>.
Michael-J-Ward commented on code in PR #6257:
URL: https://github.com/apache/arrow-rs/pull/6257#discussion_r1720152019
##########
parquet/src/file/statistics.rs:
##########
@@ -244,20 +257,21 @@ pub fn from_thrift(
pub fn to_thrift(stats: Option<&Statistics>) -> Option<TStatistics> {
let stats = stats?;
- // record null counts if greater than zero.
- //
- // TODO: This should be Some(0) if there are no nulls.
- // see https://github.com/apache/arrow-rs/pull/6216/files
+ // record null count if it can fit in i64
let null_count = stats
.null_count_opt()
- .map(|value| value as i64)
- .filter(|&x| x > 0);
Review Comment:
I was intrigued, so went to do some code archaeology, but that `filter` was only introduced a few days ago in #6216, by you! :smile:
For 6 years before it was:
```rust
null_count: if stats.has_nulls() {
Some(stats.null_count() as
} else {
None
},
```
Your commit:
https://github.com/apache/arrow-rs/pull/6216/commits/7d4e65076f9b1ea61f6931a670436cc08f4f629a
Prior code:
https://github.com/apache/arrow-rs/blame/25bfccca58ff219d9f59ba9f4d75550493238a4f/parquet/src/file/statistics.rs#L228-L242
--
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] Write null counts in parquet files when they are present [arrow-rs]
Posted by "etseidl (via GitHub)" <gi...@apache.org>.
etseidl commented on PR #6257:
URL: https://github.com/apache/arrow-rs/pull/6257#issuecomment-2299396590
> @etseidl I wonder if you have any thoughts on this code / the writing of null counts
Sorry, I was away when this discussion started (interesting things always happen when I'm on vacation 😉). I think this PR is heading the right direction. Writing `Some(0)` when the null count is known is the right behavior IMO. On the read side I've always treated missing null counts as unknown rather than 0, so the changes here are welcome. I think it's fine for the read side to continue with the old behavior for some time.
--
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] Write null counts in parquet files when they are present [arrow-rs]
Posted by "alamb (via GitHub)" <gi...@apache.org>.
alamb commented on code in PR #6257:
URL: https://github.com/apache/arrow-rs/pull/6257#discussion_r1718830672
##########
parquet/src/arrow/arrow_reader/statistics.rs:
##########
@@ -1195,6 +1197,23 @@ impl<'a> StatisticsConverter<'a> {
self.arrow_field
}
+ /// Set the statistics converter to treat missing null counts as missing
Review Comment:
By default reading null counts will work with files written with older versions of parquet-rs
--
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] Write null counts in parquet files when they are present [arrow-rs]
Posted by "etseidl (via GitHub)" <gi...@apache.org>.
etseidl commented on PR #6257:
URL: https://github.com/apache/arrow-rs/pull/6257#issuecomment-2366928233
> I go back and forth on this PR -- it isn't technically an API change in the sense of a breaking API change, but also it changes the content of written parquet files. Arguable the content better matches the parquet spec, I am just really worried about unintended consequences of doing this
>
> Maybe I am overly concerned.
Then how about splitting this up? First change the read behavior so `None` isn't treated as `0`, keep the `missing_null_counts_as_zero` setting, but default to false. If anyone is broken by that behavior they can workaround by setting it `true`. After that's been around a release, then change the behavior on write.
--
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] Write null counts in parquet files when they are present [arrow-rs]
Posted by "tustvold (via GitHub)" <gi...@apache.org>.
tustvold commented on code in PR #6257:
URL: https://github.com/apache/arrow-rs/pull/6257#discussion_r1863813242
##########
parquet/src/file/statistics.rs:
##########
@@ -416,9 +429,20 @@ impl Statistics {
/// Returns number of null values for the column, if known.
/// Note that this includes all nulls when column is part of the complex type.
///
- /// Note this API returns Some(0) even if the null count was not present
- /// in the statistics.
- /// See <https://github.com/apache/arrow-rs/pull/6216/files>
+ /// Note: Versions of this library prior to `53.0.0` returned 0 if the null count was
+ /// not available. This method returns `None` in that case.
+ ///
+ /// Also, versions of this library prior to `53.0.0` did not store the null count in the
+ /// statistics if the null count was `0`.
+ ///
+ /// To preserve the prior behavior and read null counts properly from older files
+ /// you should default to zero:
Review Comment:
Perhaps we should make it clearer that this behaviour is actually incorrect, it will claim a null count of 0, when it actually isn't known
--
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] Write null counts in parquet files when they are present [arrow-rs]
Posted by "alamb (via GitHub)" <gi...@apache.org>.
alamb commented on PR #6257:
URL: https://github.com/apache/arrow-rs/pull/6257#issuecomment-2532646531
After more thought, I would like to hold off merging this into arrow 54.0.0 because:
1. It isn't super urgent as I understand: It has been wrong for many years, and I don't know anyone who is actually affected by this
2. It has the potential for causing subtle downstream performance issues.
Maybe it is just that I am burned out on the fallout from the DataFusion 43 release (where there were a bunch of regressions and other challenges) but I don't want to introduce some other potentially subtle issue for a while longer
(I agree this may just me being weak)
--
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] Write null counts in parquet files when they are present [arrow-rs]
Posted by "alamb (via GitHub)" <gi...@apache.org>.
alamb commented on code in PR #6257:
URL: https://github.com/apache/arrow-rs/pull/6257#discussion_r1720755309
##########
parquet/src/arrow/arrow_reader/statistics.rs:
##########
@@ -1195,6 +1197,23 @@ impl<'a> StatisticsConverter<'a> {
self.arrow_field
}
+ /// Set the statistics converter to treat missing null counts as missing
Review Comment:
> The default in this PR is missing_null_counts_as_zero = true, which maintains the old behavior, right?
Yes
> then I would expect the default to be the new behavior.
My thinking was
Since there are two different apis:
`Statistics::null_count` would now return `Option<..>` so users of the library will ned to update their code anyways and thus can choose at that time which behavior they wanted
`StatisticsConverter`'s API didn't change and thus it keeps the previous behavior. This is what I would persoanlly want for a system -- no change for reading parquet files that were written with previous versions of the rust writer.
--
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] Write null counts in parquet files when they are present [arrow-rs]
Posted by "alamb (via GitHub)" <gi...@apache.org>.
alamb commented on PR #6257:
URL: https://github.com/apache/arrow-rs/pull/6257#issuecomment-2359322457
I am depressed about the large review backlog in this crate. We are looking for more help from the community reviewing PRs -- see https://github.com/apache/arrow-rs/issues/6418 for more
--
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] Write null counts in parquet files when they are present [arrow-rs]
Posted by "alamb (via GitHub)" <gi...@apache.org>.
alamb commented on PR #6257:
URL: https://github.com/apache/arrow-rs/pull/6257#issuecomment-2315012120
Unless someone else has time to review this PR and thinks it should go into 53.0.0 (https://github.com/apache/arrow-rs/issues/6016) my personal preference would be to merge this PR early in the next major release cycle (e.g. 54.0.0) so it gets maximum bake / testing time before release
--
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] Write null counts in parquet files when they are present [arrow-rs]
Posted by "alamb (via GitHub)" <gi...@apache.org>.
alamb commented on code in PR #6257:
URL: https://github.com/apache/arrow-rs/pull/6257#discussion_r1718841274
##########
parquet/src/file/statistics.rs:
##########
@@ -125,22 +125,35 @@ pub fn from_thrift(
) -> Result<Option<Statistics>> {
Ok(match thrift_stats {
Some(stats) => {
- // Number of nulls recorded, when it is not available, we just mark it as 0.
- // TODO this should be `None` if there is no information about NULLS.
- // see https://github.com/apache/arrow-rs/pull/6216/files
- let null_count = stats.null_count.unwrap_or(0);
Review Comment:
the removal of this `unwrap_or` is what changes the semantics while reading
--
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] Write null counts in parquet files when they are present [arrow-rs]
Posted by "alamb (via GitHub)" <gi...@apache.org>.
alamb commented on PR #6257:
URL: https://github.com/apache/arrow-rs/pull/6257#issuecomment-2372015792
> > I go back and forth on this PR -- it isn't technically an API change in the sense of a breaking API change, but also it changes the content of written parquet files. Arguable the content better matches the parquet spec, I am just really worried about unintended consequences of doing this
> > Maybe I am overly concerned.
>
> Then how about splitting this up? First change the read behavior so `None` isn't treated as `0`, keep the `missing_null_counts_as_zero` setting, but default to false. If anyone is broken by that behavior they can workaround by setting it `true`. After that's been around a release, then change the behavior on write.
That is a (very) good idea -- I will plan to do that when I can find some time
--
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] Write null counts in parquet files when they are present [arrow-rs]
Posted by "etseidl (via GitHub)" <gi...@apache.org>.
etseidl commented on PR #6257:
URL: https://github.com/apache/arrow-rs/pull/6257#issuecomment-2532913875
Fair enough...I'll check back in February or March 😉
--
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] Write null counts in parquet files when they are present [arrow-rs]
Posted by "alamb (via GitHub)" <gi...@apache.org>.
alamb commented on PR #6257:
URL: https://github.com/apache/arrow-rs/pull/6257#issuecomment-2374551088
> > That is a (very) good idea -- I will plan to do that when I can find some time
>
> @alamb Let me know if you'd like some help with this. I have spare cycles right now.
that would be super helpful @etseidl -- I do not have many spare cycles now (as you have probably guessed). All your help is most appreciated
--
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] Write null counts in parquet files when they are present [arrow-rs]
Posted by "alamb (via GitHub)" <gi...@apache.org>.
alamb commented on code in PR #6257:
URL: https://github.com/apache/arrow-rs/pull/6257#discussion_r1718899864
##########
parquet/src/arrow/arrow_reader/statistics.rs:
##########
@@ -1195,6 +1197,23 @@ impl<'a> StatisticsConverter<'a> {
self.arrow_field
}
+ /// Set the statistics converter to treat missing null counts as missing
Review Comment:
Absolutely
It is important to note that the default behavior in this PR is the old behavior (in other words there should be changes needed in downstream consumers of this code)
--
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] Write null counts in parquet files when they are present [arrow-rs]
Posted by "Michael-J-Ward (via GitHub)" <gi...@apache.org>.
Michael-J-Ward commented on code in PR #6257:
URL: https://github.com/apache/arrow-rs/pull/6257#discussion_r1719985116
##########
parquet/src/arrow/arrow_reader/statistics.rs:
##########
@@ -1195,6 +1197,23 @@ impl<'a> StatisticsConverter<'a> {
self.arrow_field
}
+ /// Set the statistics converter to treat missing null counts as missing
Review Comment:
The default in this PR is `missing_null_counts_as_zero = true`, which maintains the **old** behavior, right?
If "add this config to maintain old behavior" is acceptable for a breaking release, then I would expect the default to be the **new** behavior.
IOW, I'd expect what you said on the [parquet mailing list](https://lists.apache.org/thread/cytmb3n3j72nqmnb90omnvv1w926kth2)
> Applications that use parquet-rs to read parquet_files and interpret the
null_count will need to be changed after the upgrade to explicitly continue
the old behavior of "treat no null_count as 0" which is also documented
now.
--
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] Write null counts in parquet files when they are present [arrow-rs]
Posted by "alamb (via GitHub)" <gi...@apache.org>.
alamb commented on code in PR #6257:
URL: https://github.com/apache/arrow-rs/pull/6257#discussion_r1718842583
##########
parquet/src/file/statistics.rs:
##########
@@ -244,20 +257,21 @@ pub fn from_thrift(
pub fn to_thrift(stats: Option<&Statistics>) -> Option<TStatistics> {
let stats = stats?;
- // record null counts if greater than zero.
- //
- // TODO: This should be Some(0) if there are no nulls.
- // see https://github.com/apache/arrow-rs/pull/6216/files
+ // record null count if it can fit in i64
let null_count = stats
.null_count_opt()
- .map(|value| value as i64)
- .filter(|&x| x > 0);
Review Comment:
The removal of this filter is what fixes the statistics while writing
Maybe it was intended to be `x >= 0` originally 🤔
--
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] Write null counts in parquet files when they are present [arrow-rs]
Posted by "alamb (via GitHub)" <gi...@apache.org>.
alamb commented on code in PR #6257:
URL: https://github.com/apache/arrow-rs/pull/6257#discussion_r1718827728
##########
parquet/src/file/statistics.rs:
##########
@@ -1041,4 +1066,91 @@ mod tests {
true,
));
}
+
+ #[test]
+ fn test_count_encoding() {
+ statistics_count_test(None, None);
Review Comment:
This test fails like this without the changes in this PR:
```
assertion `left == right` failed
left: Boolean({min: Some(true), max: Some(false), distinct_count: None, null_count: Some(0), ...
right: Boolean({min: Some(true), max: Some(false), distinct_count: None, null_count: None, ...
```
##########
parquet/tests/arrow_writer_layout.rs:
##########
@@ -189,7 +189,7 @@ fn test_primitive() {
pages: (0..8)
.map(|_| Page {
rows: 250,
- page_header_size: 36,
+ page_header_size: 38,
Review Comment:
The page headers (and files) are larger now because `Some(0)` takes more space than `None`
--
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] Write null counts in parquet files when they are present [arrow-rs]
Posted by "Michael-J-Ward (via GitHub)" <gi...@apache.org>.
Michael-J-Ward commented on code in PR #6257:
URL: https://github.com/apache/arrow-rs/pull/6257#discussion_r1718868556
##########
parquet/src/arrow/arrow_reader/statistics.rs:
##########
@@ -1195,6 +1197,23 @@ impl<'a> StatisticsConverter<'a> {
self.arrow_field
}
+ /// Set the statistics converter to treat missing null counts as missing
Review Comment:
For breaking / major release, is it acceptable to include an upgrade instruction of "add this config to maintain to old behavior"?
--
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] Write null counts in parquet files when they are present [arrow-rs]
Posted by "tustvold (via GitHub)" <gi...@apache.org>.
tustvold commented on PR #6257:
URL: https://github.com/apache/arrow-rs/pull/6257#issuecomment-2508197751
> This is inconsistent with the parquet spec as well as what parquet-java and parquet-cpp do
FWIW the current behaviour is a bug IMO and so my vote would be to proceed with this change. We've postponed it to a breaking release, and are calling it out as a major change in the changelog, so I think we've done all that we can reasonably be expected to.
--
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