viirya commented on code in PR #6416:
URL: https://github.com/apache/arrow-datafusion/pull/6416#discussion_r1201182885


##########
datafusion/sql/src/expr/mod.rs:
##########
@@ -350,11 +350,25 @@ impl<'a, S: ContextProvider> SqlToRel<'a, S> {
             within_group,
         } = array_agg;
 
-        let order_by = if let Some(order_by) = order_by {
+        let order_by = if let Some(mut order_by) = order_by {
             // TODO: Once sqlparser supports multiple order by clause, handle 
it
             //       see issue: 
https://github.com/sqlparser-rs/sqlparser-rs/issues/875
+            let order_by = match order_by.len() {
+                0 => {
+                    return Err(DataFusionError::NotImplemented(
+                        "ARRAY_AGG with empty ORDER BY not 
supported".to_string(),
+                    ))
+                }

Review Comment:
   Hmm isn't `ORDER BY` an optional clause?
   
   For example, in `aggregate_functions.md`:
   
   ```
   array_agg(expression [ORDER BY expression])
   ```



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