jayzhan211 commented on code in PR #13564:
URL: https://github.com/apache/datafusion/pull/13564#discussion_r1859888893
##########
datafusion/physical-plan/src/aggregates/group_values/multi_group_by/primitive.rs:
##########
@@ -190,9 +191,13 @@ impl<T: ArrowPrimitiveType, const NULLABLE: bool>
GroupColumn
assert!(nulls.is_none(), "unexpected nulls in non nullable input");
}
- let arr = PrimitiveArray::<T>::new(ScalarBuffer::from(group_values),
nulls);
+ let arr = PrimitiveArray::<T>::new(ScalarBuffer::from(group_values),
nulls)
+ .with_data_type(data_type.clone());
+ let array_ref = Arc::new(arr) as ArrayRef;
+
// Set timezone information for timestamp
- Arc::new(arr.with_data_type(data_type))
+ adjust_output_array(&data_type, array_ref)
Review Comment:
It is kept in `data_type`. When you run `adjust_output_array`, the precision
of Decimal should be set with `with_precision_and_scale`.
```rust
pub fn adjust_output_array(data_type: &DataType, array: ArrayRef) ->
Result<ArrayRef> {
let array = match data_type {
DataType::Decimal128(p, s) => Arc::new(
array
.as_primitive::<Decimal128Type>()
.clone()
.with_precision_and_scale(*p, *s)?,
) as ArrayRef,
```
--
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]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]