You are viewing a plain text version of this content. The canonical link for it is here.
Posted to github@arrow.apache.org by GitBox <gi...@apache.org> on 2022/11/17 11:31:43 UTC

[GitHub] [arrow-datafusion] alamb commented on a diff in pull request #4226: Update sqlparser requirement from 0.26 to 0.27

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


##########
datafusion/sql/src/planner.rs:
##########
@@ -2341,6 +2348,53 @@ impl<'a, S: ContextProvider> SqlToRel<'a, S> {
         }))
     }
 
+    fn parse_array_agg(
+        &self,
+        array_agg: ArrayAgg,
+        input_schema: &DFSchema,
+        ctes: &mut HashMap<String, LogicalPlan>,
+    ) -> Result<Expr> {
+        // Some dialects have special syntax for array_agg. DataFusion only supports it like a function.
+        let ArrayAgg {
+            distinct,
+            expr,
+            order_by,
+            limit,
+            within_group,
+        } = array_agg;
+
+        if let Some(order_by) = order_by {

Review Comment:
   due to https://github.com/sqlparser-rs/sqlparser-rs/pull/662



##########
datafusion/core/tests/sql/aggregates.rs:
##########
@@ -1317,6 +1317,38 @@ async fn csv_query_array_agg_with_overflow() -> Result<()> {
     Ok(())
 }
 
+#[tokio::test]
+async fn csv_query_array_agg_unsupported() -> Result<()> {
+    let ctx = SessionContext::new();
+    register_aggregate_csv(&ctx).await?;
+
+    let results = plan_and_collect(
+        &ctx,
+        "SELECT array_agg(c13 ORDER BY c1) FROM aggregate_test_100",

Review Comment:
   this is newly added syntax support in https://github.com/sqlparser-rs/sqlparser-rs/pull/662



##########
datafusion/sql/src/planner.rs:
##########
@@ -460,8 +460,13 @@ impl<'a, S: ContextProvider> SqlToRel<'a, S> {
                 op,
                 left,
                 right,
-                all,
+                set_quantifier,
             } => {
+                let all = match set_quantifier {

Review Comment:
   sqlparser now distinguishes between `ALL` , `DISTINCT` and `not specified` (previously, not specified left `all=false`)



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

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