Skip to content

Commit

Permalink
propagate parquet io error instead of panicking
Browse files Browse the repository at this point in the history
  • Loading branch information
samster25 committed Sep 6, 2023
1 parent ccff1f4 commit cf5b2f9
Showing 1 changed file with 3 additions and 8 deletions.
11 changes: 3 additions & 8 deletions src/daft-parquet/src/read_planner.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,8 @@ use bytes::Bytes;
use common_error::DaftResult;
use daft_io::IOClient;
use futures::StreamExt;
use snafu::ResultExt;
use tokio::task::JoinHandle;

use crate::JoinSnafu;

type RangeList = Vec<Range<usize>>;

pub trait ReadPlanPass: Send {
Expand Down Expand Up @@ -88,7 +85,7 @@ impl ReadPlanPass for SplitLargeRequestPass {
}

enum RangeCacheState {
InFlight(JoinHandle<DaftResult<Bytes>>),
InFlight(JoinHandle<std::result::Result<Bytes, daft_io::Error>>),
Ready(Bytes),
}

Expand All @@ -107,9 +104,7 @@ impl RangeCacheEntry {
// TODO(sammy): thread in url for join error
let v = f
.await
.context(JoinSnafu { path: "UNKNOWN" })
.unwrap()
.unwrap();
.map_err(|e| daft_io::Error::JoinError { source: e })??;
*_guard = RangeCacheState::Ready(v.clone());
Ok(v.slice(range))
}
Expand Down Expand Up @@ -164,7 +159,7 @@ impl ReadPlanner {
let get_result = owned_io_client
.single_url_get(owned_url, Some(range.clone()))
.await?;
Ok(get_result.bytes().await?)
get_result.bytes().await
});
let state = RangeCacheState::InFlight(join_handle);
let entry = RangeCacheEntry {
Expand Down

0 comments on commit cf5b2f9

Please sign in to comment.