diff --git a/datafusion/sql/src/statement.rs b/datafusion/sql/src/statement.rs index 3744cceb625d0..e453422369b1d 100644 --- a/datafusion/sql/src/statement.rs +++ b/datafusion/sql/src/statement.rs @@ -32,6 +32,7 @@ use crate::utils::normalize_ident; use arrow_schema::{DataType, Fields}; use datafusion_common::parsers::CompressionTypeVariant; +use datafusion_common::DataFusionError::ParquetError; use datafusion_common::{ exec_err, not_impl_err, plan_datafusion_err, plan_err, schema_err, unqualified_field_not_found, Column, Constraints, DFSchema, DFSchemaRef, @@ -1034,7 +1035,8 @@ impl<'a, S: ContextProvider> SqlToRel<'a, S> { "PARQUET" => { if Path::exists((&location).as_ref()) { let file = File::open(&location)?; - let parquet_file = ParquetRecordBatchReaderBuilder::try_new(file)?; + let parquet_file = ParquetRecordBatchReaderBuilder::try_new(file) + .map_err(|err| plan_datafusion_err!("{err}"))?; let schema = parquet_file.schema(); schema.to_owned().to_dfschema_ref()? } else {