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

chore: implement parquet error handling for object_store #5889

Merged
merged 1 commit into from
Jun 14, 2024
Merged
Show file tree
Hide file tree
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
10 changes: 3 additions & 7 deletions parquet/src/arrow/async_reader/store.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ use futures::{FutureExt, TryFutureExt};
use object_store::{ObjectMeta, ObjectStore};

use crate::arrow::async_reader::{AsyncFileReader, MetadataLoader};
use crate::errors::{ParquetError, Result};
use crate::errors::Result;
use crate::file::metadata::ParquetMetaData;

/// Reads Parquet files in object storage using [`ObjectStore`].
Expand Down Expand Up @@ -105,7 +105,7 @@ impl AsyncFileReader for ParquetObjectReader {
fn get_bytes(&mut self, range: Range<usize>) -> BoxFuture<'_, Result<Bytes>> {
self.store
.get_range(&self.meta.location, range)
.map_err(|e| ParquetError::General(format!("AsyncChunkReader::get_bytes error: {e}")))
.map_err(|e| e.into())
.boxed()
}

Expand All @@ -117,11 +117,7 @@ impl AsyncFileReader for ParquetObjectReader {
self.store
.get_ranges(&self.meta.location, &ranges)
.await
.map_err(|e| {
ParquetError::General(format!(
"ParquetObjectReader::get_byte_ranges error: {e}"
))
})
.map_err(|e| e.into())
}
.boxed()
}
Expand Down
7 changes: 7 additions & 0 deletions parquet/src/errors.rs
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,13 @@ impl From<ArrowError> for ParquetError {
}
}

#[cfg(feature = "object_store")]
impl From<object_store::Error> for ParquetError {
fn from(e: object_store::Error) -> ParquetError {
ParquetError::External(Box::new(e))
}
}

/// A specialized `Result` for Parquet errors.
pub type Result<T, E = ParquetError> = result::Result<T, E>;

Expand Down
Loading