Skip to content

Commit

Permalink
Replace unwrap with Result combinator
Browse files Browse the repository at this point in the history
  • Loading branch information
andygrove committed Sep 25, 2019
1 parent cd11b97 commit 77bee15
Showing 1 changed file with 5 additions and 10 deletions.
15 changes: 5 additions & 10 deletions rust/datafusion/src/datasource/parquet.rs
Original file line number Diff line number Diff line change
Expand Up @@ -74,21 +74,16 @@ impl TableProvider for ParquetTable {
projection: &Option<Vec<usize>>,
batch_size: usize,
) -> Result<Vec<ScanResult>> {
//TODO remove the unwrap
Ok(self
.filenames
.iter()
.map(|filename| {
Arc::new(Mutex::new(
ParquetScanPartition::try_new(
filename,
projection.clone(),
batch_size,
)
.unwrap(),
)) as Arc<Mutex<dyn BatchIterator>>
ParquetScanPartition::try_new(filename, projection.clone(), batch_size)
.and_then(|part| {
Ok(Arc::new(Mutex::new(part)) as Arc<Mutex<dyn BatchIterator>>)
})
})
.collect())
.collect::<Result<Vec<_>>>()?)
}
}

Expand Down

0 comments on commit 77bee15

Please sign in to comment.