thinkharderdev commented on code in PR #2774:
URL: https://github.com/apache/arrow-rs/pull/2774#discussion_r979271132
##########
parquet/src/arrow/array_reader/builder.rs:
##########
@@ -26,40 +26,43 @@ use crate::arrow::array_reader::{
ListArrayReader, MapArrayReader, NullArrayReader, PrimitiveArrayReader,
RowGroupCollection, StructArrayReader,
};
-use crate::arrow::schema::{convert_schema, ParquetField, ParquetFieldType};
+use crate::arrow::schema::{ParquetField, ParquetFieldType};
use crate::arrow::ProjectionMask;
use crate::basic::Type as PhysicalType;
use crate::data_type::{
BoolType, DoubleType, FloatType, Int32Type, Int64Type, Int96Type,
};
-use crate::errors::Result;
+use crate::errors::{ParquetError, Result};
use crate::schema::types::{ColumnDescriptor, ColumnPath, Type};
/// Create array reader from parquet schema, projection mask, and parquet file
reader.
pub fn build_array_reader(
- arrow_schema: SchemaRef,
- mask: ProjectionMask,
+ field: Option<&ParquetField>,
+ mask: &ProjectionMask,
row_groups: &dyn RowGroupCollection,
) -> Result<Box<dyn ArrayReader>> {
- let field = convert_schema(&row_groups.schema(), mask,
Some(arrow_schema.as_ref()))?;
+ let reader = field
+ .and_then(|field| build_reader(field, mask, row_groups).transpose())
+ .transpose()?
+ .unwrap_or_else(|| make_empty_array_reader(row_groups.num_rows()));
Review Comment:
Not a comment on this PR per se, but I don't understand why we swallow the
error here and return and empty array reader
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]