chore: don't panic with invalid parquet (#3309)

Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
pull/24376/head
Raphael Taylor-Davies 2021-12-06 21:15:35 +00:00 committed by GitHub
parent 5316037ffe
commit 5fdaa5b4ab
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 7 additions and 2 deletions

View File

@ -72,6 +72,11 @@ pub enum Error {
#[snafu(display("Cannot encode metadata: {}", source))]
MetadataEncodeFailure { source: prost::EncodeError },
#[snafu(display("Error reading parquet: {}", source))]
ParquetReader {
source: parquet::errors::ParquetError,
},
}
pub type Result<T, E = Error> = std::result::Result<T, E>;
@ -220,11 +225,11 @@ impl Storage {
}
};
let file_reader = SerializedFileReader::new(file).unwrap();
let file_reader = SerializedFileReader::new(file).context(ParquetReader)?;
let mut arrow_reader = ParquetFileArrowReader::new(Arc::new(file_reader));
let record_batch_reader = arrow_reader
.get_record_reader_by_columns(projection, batch_size)
.unwrap();
.context(ParquetReader)?;
for batch in record_batch_reader {
if tx.blocking_send(batch).is_err() {