jcsherin commented on code in PR #11287:
URL: https://github.com/apache/datafusion/pull/11287#discussion_r1667024463


##########
datafusion/sql/src/expr/function.rs:
##########
@@ -415,9 +415,11 @@ impl<'a, S: ContextProvider> SqlToRel<'a, S> {
     ) -> Result<WindowFunctionDefinition> {
         // check udaf first
         let udaf = self.context_provider.get_aggregate_meta(name);
-        // Skip first value and last value, since we expect window builtin 
first/last value not udaf version
+        // Use the builtin window function instead of the user-defined 
aggregate function
         if udaf.as_ref().is_some_and(|udaf| {
-            udaf.name() != "first_value" && udaf.name() != "last_value"
+            udaf.name() != "first_value"
+                && udaf.name() != "last_value"
+                && udaf.name() != "nth_value"

Review Comment:
   Bypass the udaf and uses the builtin window function in case of window 
aggregations. 
   
   This was a tricky bit for me and it took me a while to make the connection 
and realize that window aggregations need not be handled in this UDAF. 



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

Reply via email to