Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Minor: add runtime asserts to RowGroup #10641

Merged
merged 1 commit into from
May 24, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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