Repository navigation
fix: treat missing Parquet null counts as zero for files from parquet-rs before 53.1.0 - #27546
Omkar-Wagholikar wants to merge 10 commits into
Conversation
…-rs before 53.1.0 Closes issue apache#25253
|
Please ignore the spell check error, it's from a comment |
|
Hi @jayzhan211, @kumarUjjawal, @rluvaton, |
jayzhan211
left a comment
There was a problem hiding this comment.
@Omkar-Wagholikar thanks for picking this up! Two answers to your questions:
- Page-index null counts don't need this change. parquet-rs before 53.1.0 always wrote
ColumnIndex.null_counts, zeros included (ColumnIndexBuilder::build_to_thriftin 52.2.0 passes the wholeVec), so only row-group statistics are affected. - Since 56.0.0 is released, the upgrade-guide entry from #25242 tells 56 users to rewrite their files, and that stays true for 56. Could you add a short note to
docs/source/library-user-guide/upgrading/57.0.0.md, so people upgrading to 57 know they don't need to rewrite? For example:
### Missing Parquet null counts from older parquet-rs writers mean zero again
DataFusion 56.0.0 started treating an omitted Parquet `null_count` as unknown.
parquet-rs before 53.1.0, including DataFusion before 42.1.0, omitted only zero
counts, so DataFusion now reads a missing count as zero for files whose
`created_by` names one of those writers. `IS NULL` row-group pruning,
`COUNT(column)` from metadata, sort elimination and `NULLS FIRST` TopK pruning
return for these files without rewriting them. Files from other writers keep
the 56.0.0 behavior.updated: docs, dyna row grp pruning tests and metadata comments
|
Thanks @jayzhan211, I've addressed all of your comments in d2bc344:
|
jayzhan211
left a comment
There was a problem hiding this comment.
Thanks for the updates! Optional: the description still asks about page-index null counts and says no upgrade note was added. Could you drop those two lines and mention the 57.0.0 upgrade note under user-facing changes, since the description becomes the squash commit message?
|
Hi, thanks for pointing it out! I had missed updating the description. It is updated now. |
|
I am worried about this change causing hard to diagnose / subtle wrong results. I also think parsing the created by field is pretty brittle as there is no guarantee that people didn't override the created by field So basically I am wondering why both to (try) and fix this issue? |
|
Thanks @alamb these are fair concerns. The motivation is basically just the issue:#25253 On the risk: you're right that created_by can be overridden (WriterProperties::set_created_by, and DataFusion exposes it too). The change only applies when created_by is exactly parquet-rs/datafusion with a legacy version, and every other or unparseable value keeps the 56.0.0 behavior. The wrong-result case needs a file that claims a legacy writer but has counts missing for another reason, such as a tampered footer. If you'd still rather not trust created_by, I could put this behind an opt-in config (default off), so only users who know their files come from legacy writers enable it. Or I'm happy to close this if you and @jayzhan211 think the risk isn't worth it. Which would you prefer? |
|
@alamb the reason to bother: since 56.0, files from parquet-rs before 53.1 (including DataFusion before 42.1) lose several optimizations, and the only fix we offer is rewriting the data. This PR reads a missing count as zero only for files from those writers, which never left out a non-zero count. Are you OK merging it, or would you rather park it until a user reports the slowdown?
No one has reported the slowdown yet, but 56.0 is less than two weeks old. |
Which issue does this PR close?
Closes issue #25253
Rationale for this change
(After #25242) A missing Parquet null_count is treated as 'unknown'. That is right in general, but parquet-rs before 53.1.0 left out null_count whenever it was zero. For files from those writers, including DataFusion before 42.1.0, queries lost:
What changes are included in this PR?
What is the testing strategy for this PR?
Are there any user-facing changes?
I haven't benchmarked this. It restores optimizations rather than adding new ones.
I used Claude Code to help find the code and write tests. I have written, reviewed and tested most of the code myself.