mingmwang commented on code in PR #5837:
URL: https://github.com/apache/arrow-datafusion/pull/5837#discussion_r1162675006
##########
datafusion/physical-expr/src/aggregate/utils.rs:
##########
@@ -31,3 +34,17 @@ pub fn get_accum_scalar_values_as_arrays(
.map(|s| s.to_array_of_size(1))
.collect::<Vec<_>>())
}
+
+pub fn down_cast_any_ref(any: &dyn Any) -> &dyn Any {
Review Comment:
Yes, just add more comments. I have an example in the count unitest.
```rust
#[test]
fn count_eq() -> Result<()> {
let count = Count::new(lit(1i8), "COUNT(1)".to_string(),
DataType::Int64);
let arc_count: Arc<dyn AggregateExpr> = Arc::new(Count::new(
lit(1i8),
"COUNT(1)".to_string(),
DataType::Int64,
));
let box_count: Box<dyn AggregateExpr> = Box::new(Count::new(
lit(1i8),
"COUNT(1)".to_string(),
DataType::Int64,
));
let count2 = Count::new(lit(1i8), "COUNT(2)".to_string(),
DataType::Int64);
assert!(arc_count.eq(&box_count));
assert!(box_count.eq(&arc_count));
assert!(arc_count.eq(&count));
assert!(count.eq(&box_count));
assert!(count.eq(&arc_count));
assert!(count2.ne(&arc_count));
Ok(())
}
```
--
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]