Repository navigation
test: add struct field pruning tests - #27876
Conversation
Predicates on struct fields such as `s['a'] > 5` do not prune Parquet row groups or pages today. These tests record that behavior. A later change adds the pruning and updates the expected output, so its diff shows the effect. The tests add a sqllogictest file with EXPLAIN ANALYZE pruning metrics. They also add a core integration test for a struct field without a null count statistic. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
|
|
||
| /// Writes `s: {a: Int64}` with rows `{a: 1}` and `{a: null}` in one row | ||
| /// group. The footer keeps the min and max of `s.a`, but not its null count. | ||
| fn struct_file_without_null_count() -> NamedTempFile { |
There was a problem hiding this comment.
what is the purpose of hand constructing a file without null statistics?
It might be easier to understand if the test wrote a file with null statistics and then updated the statistics and rewrite the file (not sure if this is possible with the parquet API today)
There was a problem hiding this comment.
Also in theory we could add this setup file to the slt harness runner (or check it in) so that the tests could be entirely .slt
There was a problem hiding this comment.
The purpose was to check that the new code that reads struct field statistics treats a missing null count as unknown, the same as the existing column path does since #25242. It is not a struct-specific problem: StatisticsConverter reads a missing count as zero for any column unless the caller sets with_missing_null_counts_as_zero(false) (the default from apache/arrow-rs#6485, which DataFusion turned off in #25242). This is not just a theoretical problem: old parquet-rs releases used to write offending files.
I looked into committing an offending file but in the end opted for a unit test. For top level column row_group_pruning_predicate_missing_null_count already covers the case with in-memory metadata, and #27736 now has the same unit test for a struct field, next to the code that reads its statistics.
A reviewer asked why the test builds a file without a null count by hand. The doc comment gives the reason and the method. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
The test built a Parquet file by hand to drop the null count from its footer. The unit test row_group_pruning_predicate_missing_null_count already covers a missing null count for a column. The struct field case belongs in a unit test next to the code that reads struct field statistics. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
## Which issue does this PR close? - Prepares for apache#27736. ## Rationale for this change Predicates on struct fields such as `s['a'] > 5` do not prune Parquet row groups or pages today. This PR records that behavior in tests. The follow-up PR apache#27736 adds the pruning and updates the expected output. Its diff then shows the effect of the change directly. ## What changes are included in this PR? This PR is tests only. It does not change any behavior. - `datafusion/sqllogictest/test_files/parquet_struct_field_pruning.slt` writes Parquet files with struct columns. It records the `EXPLAIN ANALYZE` row group and page pruning metrics for predicates on struct fields. ## What is the testing strategy for this PR? The PR consists of the new tests. They pass on `main` and record its current behavior. ## Are there any user-facing changes? No. 🤖 Generated with [Claude Code](https://claude.com/claude-code) --------- Co-authored-by: Claude Fable 5.2 <noreply@anthropic.com>
Which issue does this PR close?
Rationale for this change
Predicates on struct fields such as
s['a'] > 5do not prune Parquet row groups or pages today. This PR records that behavior in tests. The follow-up PR #27736 adds the pruning and updates the expected output. Its diff then shows the effect of the change directly.What changes are included in this PR?
This PR is tests only. It does not change any behavior.
datafusion/sqllogictest/test_files/parquet_struct_field_pruning.sltwrites Parquet files with struct columns. It records theEXPLAIN ANALYZErow group and page pruning metrics for predicates on struct fields.What is the testing strategy for this PR?
The PR consists of the new tests. They pass on
mainand record its current behavior.Are there any user-facing changes?
No.
🤖 Generated with Claude Code