Skip to content

Commit

Permalink
Account for potentially null TableMetadata
Browse files Browse the repository at this point in the history
  • Loading branch information
Jay Chia committed Nov 30, 2024
1 parent d17e91d commit 65d6e2b
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions src/daft-scan/src/scan_task_iters.rs
Original file line number Diff line number Diff line change
Expand Up @@ -226,14 +226,13 @@ impl SplitParquetByRowGroupsAccumulator {
let curr_size_bytes = std::mem::take(&mut self.size_bytes);
let curr_num_rows = std::mem::take(&mut self.num_rows);

// Create a new DataSource by mutating the old one
// Create a new DataSource by mutating a clone of the old one
let mut new_source = ctx.data_source().clone();

if let DataSource::File {
chunk_spec,
size_bytes,
parquet_metadata,
metadata: Some(metadata),
metadata: table_metadata,
..
} = &mut new_source
{
Expand All @@ -256,7 +255,9 @@ impl SplitParquetByRowGroupsAccumulator {
.collect(),
));
*size_bytes = Some(curr_size_bytes as u64);
metadata.length = curr_num_rows;
if let Some(metadata) = table_metadata {
metadata.length = curr_num_rows;
}
} else {
unreachable!("Parquet file format should only be used with DataSource::File");

Check warning on line 262 in src/daft-scan/src/scan_task_iters.rs

View check run for this annotation

Codecov / codecov/patch

src/daft-scan/src/scan_task_iters.rs#L262

Added line #L262 was not covered by tests
}
Expand Down

0 comments on commit 65d6e2b

Please sign in to comment.