Skip to content

Commit 525e54c

Browse files
alambfindepi
authored andcommitted
Minor: add runtime asserts to RowGroup (apache#10641)
1 parent 8694242 commit 525e54c

File tree

1 file changed

+12
-0
lines changed
  • datafusion/core/src/datasource/physical_plan/parquet

1 file changed

+12
-0
lines changed

datafusion/core/src/datasource/physical_plan/parquet/row_groups.rs

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,11 @@ impl RowGroupSet {
9393
/// Prune remaining row groups to only those within the specified range.
9494
///
9595
/// Updates this set to mark row groups that should not be scanned
96+
///
97+
/// # Panics
98+
/// if `groups.len() != self.len()`
9699
pub fn prune_by_range(&mut self, groups: &[RowGroupMetaData], range: &FileRange) {
100+
assert_eq!(groups.len(), self.len());
97101
for (idx, metadata) in groups.iter().enumerate() {
98102
if !self.should_scan(idx) {
99103
continue;
@@ -120,6 +124,9 @@ impl RowGroupSet {
120124
///
121125
/// Note: This method currently ignores ColumnOrder
122126
/// <https://github.com/apache/datafusion/issues/8335>
127+
///
128+
/// # Panics
129+
/// if `groups.len() != self.len()`
123130
pub fn prune_by_statistics(
124131
&mut self,
125132
arrow_schema: &Schema,
@@ -128,6 +135,7 @@ impl RowGroupSet {
128135
predicate: &PruningPredicate,
129136
metrics: &ParquetFileMetrics,
130137
) {
138+
assert_eq!(groups.len(), self.len());
131139
for (idx, metadata) in groups.iter().enumerate() {
132140
if !self.should_scan(idx) {
133141
continue;
@@ -161,13 +169,17 @@ impl RowGroupSet {
161169
/// [`PruningPredicate`].
162170
///
163171
/// Updates this set with row groups that should not be scanned
172+
///
173+
/// # Panics
174+
/// if the builder does not have the same number of row groups as this set
164175
pub async fn prune_by_bloom_filters<T: AsyncFileReader + Send + 'static>(
165176
&mut self,
166177
arrow_schema: &Schema,
167178
builder: &mut ParquetRecordBatchStreamBuilder<T>,
168179
predicate: &PruningPredicate,
169180
metrics: &ParquetFileMetrics,
170181
) {
182+
assert_eq!(builder.metadata().num_row_groups(), self.len());
171183
for idx in 0..self.len() {
172184
if !self.should_scan(idx) {
173185
continue;

0 commit comments

Comments
 (0)