Skip to content
This repository has been archived by the owner on Feb 18, 2024. It is now read-only.

Small improvement to deserializing fixed-len parquet statistics. #818

Merged
merged 1 commit into from
Feb 6, 2022
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
6 changes: 1 addition & 5 deletions src/io/parquet/read/statistics/fixlen.rs
Original file line number Diff line number Diff line change
@@ -1,11 +1,9 @@
use std::any::Any;
use std::convert::{TryFrom, TryInto};

use super::super::schema;
use super::primitive::PrimitiveStatistics;
use crate::datatypes::DataType;
use crate::error::{ArrowError, Result};
use parquet2::schema::types::ParquetType;
use parquet2::{
schema::types::PhysicalType,
statistics::{
Expand Down Expand Up @@ -102,10 +100,8 @@ impl TryFrom<(&ParquetFixedLenStatistics, DataType)> for PrimitiveStatistics<i12

pub(super) fn statistics_from_fix_len(
stats: &ParquetFixedLenStatistics,
type_: &ParquetType,
data_type: DataType,
) -> Result<Box<dyn Statistics>> {
let data_type = schema::to_data_type(type_)?.unwrap();

use DataType::*;
Ok(match data_type {
Decimal(_, _) => Box::new(PrimitiveStatistics::<i128>::try_from((stats, data_type))?),
Expand Down
2 changes: 1 addition & 1 deletion src/io/parquet/read/statistics/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ fn _deserialize_statistics(
}
PhysicalType::FixedLenByteArray(_) => {
let stats = stats.as_any().downcast_ref().unwrap();
fixlen::statistics_from_fix_len(stats, stats.descriptor.type_())
fixlen::statistics_from_fix_len(stats, data_type)
}
_ => Err(ArrowError::NotYetImplemented(
"Reading Fixed-len array statistics is not yet supported".to_string(),
Expand Down