etseidl commented on code in PR #6252:
URL: https://github.com/apache/arrow-rs/pull/6252#discussion_r1725355738
##########
parquet/src/arrow/array_reader/primitive_array.rs:
##########
@@ -217,35 +217,19 @@ where
arrow_cast::cast(&a, target_type)?
}
ArrowType::Decimal128(p, s) => {
- // We can simply reuse the null buffer from `array` rather
than recomputing it
- // (as was the case when we simply used `collect` to produce
the new array).
- let nulls = array.nulls().cloned();
let array = match array.data_type() {
- ArrowType::Int32 => {
- let decimal = array
- .as_any()
- .downcast_ref::<Int32Array>()
- .unwrap()
- .iter()
- .map(|v| match v {
- Some(i) => i as i128,
- None => i128::default(),
- });
- Decimal128Array::from_iter_values_with_nulls(decimal,
nulls)
- }
-
- ArrowType::Int64 => {
- let decimal = array
- .as_any()
- .downcast_ref::<Int64Array>()
- .unwrap()
- .iter()
- .map(|v| match v {
- Some(i) => i as i128,
- None => i128::default(),
- });
- Decimal128Array::from_iter_values_with_nulls(decimal,
nulls)
- }
+ ArrowType::Int32 => array
Review Comment:
done!
--
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]