You are viewing a plain text version of this content. The canonical link for it is here.
Posted to github@datafusion.apache.org by "Garamda (via GitHub)" <gi...@apache.org> on 2025/02/01 07:21:21 UTC

Re: [PR] Support WITHIN GROUP syntax to standardize certain existing aggregate functions [datafusion]

Garamda commented on code in PR #13511:
URL: https://github.com/apache/datafusion/pull/13511#discussion_r1938219937


##########
datafusion/sql/src/expr/function.rs:
##########
@@ -336,7 +369,28 @@ impl<S: ContextProvider> SqlToRel<'_, S> {
                     None,
                 )?;
                 let order_by = (!order_by.is_empty()).then_some(order_by);
-                let args = self.function_args_to_expr(args, schema, planner_context)?;
+                let mut args =
+                    self.function_args_to_expr(args, schema, planner_context)?;
+
+                let within_group = self.order_by_to_sort_expr(
+                    within_group,
+                    schema,
+                    planner_context,
+                    false,
+                    None,
+                )?;
+
+                // add target column expression in within group clause to function arguments

Review Comment:
   The `Signature` of `ApproxPercentileCont` and `ApproxPercentileContWithWeight` are not changed. Instead, the expression in `WITHIN GROUP` clause is added into function arguments while converting `sql expr` to `logical expr`.



-- 
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-unsubscribe@datafusion.apache.org

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


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