Skip to content

Commit

Permalink
Minor: add runtime asserts to RowGroup (#10641)
Browse files Browse the repository at this point in the history
  • Loading branch information
alamb authored May 24, 2024
1 parent 8f3084a commit 4b7b5ab
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions datafusion/core/src/datasource/physical_plan/parquet/row_groups.rs
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,11 @@ impl RowGroupSet {
/// Prune remaining row groups to only those within the specified range.
///
/// Updates this set to mark row groups that should not be scanned
///
/// # Panics
/// if `groups.len() != self.len()`
pub fn prune_by_range(&mut self, groups: &[RowGroupMetaData], range: &FileRange) {
assert_eq!(groups.len(), self.len());
for (idx, metadata) in groups.iter().enumerate() {
if !self.should_scan(idx) {
continue;
Expand All @@ -120,6 +124,9 @@ impl RowGroupSet {
///
/// Note: This method currently ignores ColumnOrder
/// <https://github.com/apache/datafusion/issues/8335>
///
/// # Panics
/// if `groups.len() != self.len()`
pub fn prune_by_statistics(
&mut self,
arrow_schema: &Schema,
Expand All @@ -128,6 +135,7 @@ impl RowGroupSet {
predicate: &PruningPredicate,
metrics: &ParquetFileMetrics,
) {
assert_eq!(groups.len(), self.len());
for (idx, metadata) in groups.iter().enumerate() {
if !self.should_scan(idx) {
continue;
Expand Down Expand Up @@ -161,13 +169,17 @@ impl RowGroupSet {
/// [`PruningPredicate`].
///
/// Updates this set with row groups that should not be scanned
///
/// # Panics
/// if the builder does not have the same number of row groups as this set
pub async fn prune_by_bloom_filters<T: AsyncFileReader + Send + 'static>(
&mut self,
arrow_schema: &Schema,
builder: &mut ParquetRecordBatchStreamBuilder<T>,
predicate: &PruningPredicate,
metrics: &ParquetFileMetrics,
) {
assert_eq!(builder.metadata().num_row_groups(), self.len());
for idx in 0..self.len() {
if !self.should_scan(idx) {
continue;
Expand Down

0 comments on commit 4b7b5ab

Please sign in to comment.