Skip to content

Commit

Permalink
chore: Improve performance of Parquet statistics conversion (#10932)
Browse files Browse the repository at this point in the history
  • Loading branch information
Weijun-H authored Jun 17, 2024
1 parent d4228fe commit 378b9ee
Showing 1 changed file with 4 additions and 28 deletions.
32 changes: 4 additions & 28 deletions datafusion/core/src/datasource/physical_plan/parquet/statistics.rs
Original file line number Diff line number Diff line change
Expand Up @@ -303,24 +303,12 @@ macro_rules! get_statistics {
))),
DataType::Int8 => Ok(Arc::new(Int8Array::from_iter(
[<$stat_type_prefix Int32StatsIterator>]::new($iterator).map(|x| {
x.and_then(|x| {
if let Ok(v) = i8::try_from(*x) {
Some(v)
} else {
None
}
})
x.and_then(|x| i8::try_from(*x).ok())
}),
))),
DataType::Int16 => Ok(Arc::new(Int16Array::from_iter(
[<$stat_type_prefix Int32StatsIterator>]::new($iterator).map(|x| {
x.and_then(|x| {
if let Ok(v) = i16::try_from(*x) {
Some(v)
} else {
None
}
})
x.and_then(|x| i16::try_from(*x).ok())
}),
))),
DataType::Int32 => Ok(Arc::new(Int32Array::from_iter(
Expand All @@ -331,24 +319,12 @@ macro_rules! get_statistics {
))),
DataType::UInt8 => Ok(Arc::new(UInt8Array::from_iter(
[<$stat_type_prefix Int32StatsIterator>]::new($iterator).map(|x| {
x.and_then(|x| {
if let Ok(v) = u8::try_from(*x) {
Some(v)
} else {
None
}
})
x.and_then(|x| u8::try_from(*x).ok())
}),
))),
DataType::UInt16 => Ok(Arc::new(UInt16Array::from_iter(
[<$stat_type_prefix Int32StatsIterator>]::new($iterator).map(|x| {
x.and_then(|x| {
if let Ok(v) = u16::try_from(*x) {
Some(v)
} else {
None
}
})
x.and_then(|x| u16::try_from(*x).ok())
}),
))),
DataType::UInt32 => Ok(Arc::new(UInt32Array::from_iter(
Expand Down

0 comments on commit 378b9ee

Please sign in to comment.