Rachelint commented on PR #11261:
URL: https://github.com/apache/datafusion/pull/11261#issuecomment-2208428281

   @alamb @EduardoVega 
   I have made draf impl...
   I define a new function `output_from_stats` as a general function to get 
results directly from stats if possible.
   Howerver, when I impl adapt it to `AggregateUDFImpl`, I found I can't get 
the physical exprs which is needed, see the original code in physical optimizer:
   
https://github.com/apache/datafusion/blob/569be9eb1ba60d3e842f22de5080c732ac2206f4/datafusion/core/src/physical_optimizer/aggregate_statistics.rs#L250-L257
   
   It is mainly due to `AggregateUDFImpl` is defined in `expr` crate, and the 
needed `PhysicalExpr` is defined in `datafusion-physical-expr-common` crate 
which will refer `exps` a dependency. And if we import `PhysicalExpr` in 
`expr`, that will lead to cyclic dependecies...
   
   For solving it, I define a `AggregateArgExprs` trait in `expr` crate, and 
impl it for the `Vec<Arc<dyn PhysicalExpr>>`. It can work but we need to 
downcast it to `&[Arc<dyn PhysicalExpr>]` when using it in `output_from_stats` 
of the `udaf`(see the impl of `count`...). I am not sure if it is a good way to 
impl like this...


-- 
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: github-unsubscr...@datafusion.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: github-unsubscr...@datafusion.apache.org
For additional commands, e-mail: github-h...@datafusion.apache.org

Reply via email to