joroKr21 commented on code in PR #10043:
URL: 
https://github.com/apache/arrow-datafusion/pull/10043#discussion_r1560567048


##########
datafusion/physical-expr/src/aggregate/count_distinct/mod.rs:
##########
@@ -109,12 +109,14 @@ impl AggregateExpr for DistinctCount {
             UInt16 => 
Box::new(PrimitiveDistinctCountAccumulator::<UInt16Type>::new()),
             UInt32 => 
Box::new(PrimitiveDistinctCountAccumulator::<UInt32Type>::new()),
             UInt64 => 
Box::new(PrimitiveDistinctCountAccumulator::<UInt64Type>::new()),
-            Decimal128(_, _) => {
-                
Box::new(PrimitiveDistinctCountAccumulator::<Decimal128Type>::new())
-            }
-            Decimal256(_, _) => {
-                
Box::new(PrimitiveDistinctCountAccumulator::<Decimal256Type>::new())
-            }
+            dt @ Decimal128(_, _) => Box::new(
+                PrimitiveDistinctCountAccumulator::<Decimal128Type>::new()
+                    .with_data_type(dt.clone()),
+            ),
+            dt @ Decimal256(_, _) => Box::new(
+                PrimitiveDistinctCountAccumulator::<Decimal256Type>::new()
+                    .with_data_type(dt.clone()),
+            ),

Review Comment:
   I can show that for Decimal128 (not sure why it doesn't trigger for 
Decimal256). But it's better to be consistent, losing the data type might lead 
to unexpected consequences.



-- 
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]

Reply via email to