alamb commented on code in PR #4553:
URL: https://github.com/apache/arrow-datafusion/pull/4553#discussion_r1044385048


##########
datafusion/proto/src/to_proto.rs:
##########
@@ -546,6 +546,8 @@ impl TryFrom<&Expr> for protobuf::LogicalExprNode {
                             protobuf::BuiltInWindowFunction::from(fun).into(),
                         )
                     }
+                    // TODO(LFC): Implement user-defined aggregate window 
function proto ser/de.

Review Comment:
   I don't think it needs to be implemented in this PR. However, I do think 
this PR should return an `DataFusionError::NotYetImplemented` rather than panic 
(which is what `todo!` will do)
   
   I do recommend we file a ticket for implementing UDAF serialization so this 
gap is visible -- which I can do if you like
   
   



##########
datafusion/sql/src/planner.rs:
##########
@@ -2484,6 +2482,21 @@ impl<'a, S: ContextProvider> SqlToRel<'a, S> {
         }
     }
 
+    fn find_window_func(&self, name: &str) -> Result<WindowFunction> {
+        window_function::find_df_window_func(name)
+            .or_else(|| {

Review Comment:
   👍 



##########
datafusion/sql/src/planner.rs:
##########
@@ -5348,6 +5363,27 @@ mod tests {
         quick_test(sql, expected);
     }
 
+    #[test]
+    fn udaf_as_window_func() -> Result<()> {
+        let my_max = create_udaf(
+            "my_max",
+            DataType::Int32,
+            Arc::new(DataType::Int32),
+            Volatility::Immutable,
+            Arc::new(|_| 
Ok(Box::new(MaxAccumulator::try_new(&DataType::Int32)?))),

Review Comment:
   I wonder how much work / copying it would be to avoid the test dependency on 
`datafusion-physical-expr`. It doesn't seem like we actually need anything 
about the `MaxAccumulator` in this code



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