jayzhan211 commented on code in PR #10214:
URL: https://github.com/apache/datafusion/pull/10214#discussion_r1580258192
##########
datafusion/expr/src/udaf.rs:
##########
@@ -354,6 +360,24 @@ pub trait AggregateUDFImpl: Debug + Send + Sync {
fn aliases(&self) -> &[String] {
&[]
}
+
+ /// Construct an expression that calculates the aggregate in reverse.
+ /// Typically the "reverse" expression is itself (e.g. SUM, COUNT).
+ /// For aggregates that do not support calculation in reverse,
+ /// returns None (which is the default value).
+ fn reverse_expr(&self) -> ReversedExpr {
+ ReversedExpr::NotSupported
+ }
+}
+
+#[derive(Debug)]
+pub enum ReversedExpr {
+ /// The expression is the same as the original expression, like SUM, COUNT
+ Identical,
+ /// The expression does not support reverse calculation, like ArrayAgg
+ NotSupported,
+ /// The expression is different from the original expression
+ Reversed(AggregateFunction),
Review Comment:
Let me take a look at the code that uses `reverse_expr`, I guess some kind
of rewrite may help.
--
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]