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/05/19 23:17:32 UTC

[GitHub] [arrow-ballista] andygrove opened a new issue, #5: Ballista assumes all aggregate expressions are not DISTINCT

andygrove opened a new issue, #5:
URL: https://github.com/apache/arrow-ballista/issues/5

   **Describe the bug**
   We have a hard-coded `distinct = false` parameter in `ballista/rust/core/src/serde/physical_plan/mod.rs`.
   
   ``` rust
   Ok(create_aggregate_expr(
       &aggr_function.into(),
       false, // <-- hard-coded "distinct"
       input_phy_expr.as_slice(),
       &physical_schema,
       name.to_string(),
   )?)
   ```
   
   **To Reproduce**
   Try running a `COUNT(DISTINCT expr)` in Ballista
   
   **Expected behavior**
   We need to include the distinct flag in the protobuf for aggregate queries and implement the appropriate serde code.
   
   **Additional context**
   None
   


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

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


[GitHub] [arrow-ballista] comphead commented on issue #5: Ballista assumes all aggregate expressions are not DISTINCT

Posted by GitBox <gi...@apache.org>.
comphead commented on issue #5:
URL: https://github.com/apache/arrow-ballista/issues/5#issuecomment-1226237784

   > > Hi @andygrove Ive run in local ballista
   > 
   > The issue is specific to distributed mode because it is the serde that has the hard-coded value
   
   Is there any doc how to run ballista tests in distributed mode? perhaps its part of CI now? 


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


[GitHub] [arrow-ballista] andygrove commented on issue #5: Ballista assumes all aggregate expressions are not DISTINCT

Posted by GitBox <gi...@apache.org>.
andygrove commented on issue #5:
URL: https://github.com/apache/arrow-ballista/issues/5#issuecomment-1226056059

   Related: https://github.com/apache/arrow-datafusion/pull/3250


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


[GitHub] [arrow-ballista] Dandandan closed issue #5: Ballista assumes all aggregate expressions are not DISTINCT

Posted by GitBox <gi...@apache.org>.
Dandandan closed issue #5: Ballista assumes all aggregate expressions are not DISTINCT
URL: https://github.com/apache/arrow-ballista/issues/5


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


[GitHub] [arrow-ballista] andygrove commented on issue #5: Ballista assumes all aggregate expressions are not DISTINCT

Posted by GitBox <gi...@apache.org>.
andygrove commented on issue #5:
URL: https://github.com/apache/arrow-ballista/issues/5#issuecomment-1226056627

   > Hi @andygrove Ive run in local ballista
   
   The issue is specific to distributed mode because it is the serde that has the hard-coded value


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


[GitHub] [arrow-ballista] r4ntix commented on issue #5: Ballista assumes all aggregate expressions are not DISTINCT

Posted by GitBox <gi...@apache.org>.
r4ntix commented on issue #5:
URL: https://github.com/apache/arrow-ballista/issues/5#issuecomment-1281906098

   @andygrove @comphead 
   I tried to analyze the problem and found that `SELECT count(distinct c1) as cnt_distinct FROM aggregate_test_100` is also expected in distributed mode. 
   
   Because `single distinct` is optimized by the optimizer as `group by` in datafusion:
   ```
   example sql: select count(distinct c_name) from customer_1;
   
   // Logic plan before optimization: 
   Projection: COUNT(DISTINCT customer_1.c_name)                                                                                                                           
      Aggregate: groupBy=[[]], aggr=[[COUNT(DISTINCT customer_1.c_name)]]                                                                                                   
        TableScan: customer_1 projection=[c_name]
   
   // Logic plan after optimization:
   Projection: COUNT(DISTINCT customer_1.c_name)                                                                                                                                     
      Projection: COUNT(alias1) AS COUNT(DISTINCT customer_1.c_name)                                                                                                                  
        Aggregate: groupBy=[[]], aggr=[[COUNT(alias1)]]                                                                                                                               
          Aggregate: groupBy=[[customer_1.c_name AS alias1]], aggr=[[]]                                                                                                               
            TableScan: customer_1 projection=[c_name]
   ```
   
   The current problem with ballista is that it does not support `DistinctCount` in non-single distinct scenarios.
   Example sql `select count(distinct c_name), max(c_name) from customer_1`:
   ```
   [2022-10-18T06:32:14Z ERROR ballista_core::execution_plans::distributed_query] Job 3N8dtpp failed: Error planning job 3N8dtpp: NotImplemented("Aggregate function not supported: DistinctCount { name: \"COUNT(DISTINCT customer_1.c_name)\", data_type: Int64, state_data_types: [Utf8], exprs: [Column { name: \"c_name\", index: 0 }] }")
   DataFusionError(ArrowError(ExternalError(Execution("Job 3N8dtpp failed: Error planning job 3N8dtpp: NotImplemented(\"Aggregate function not supported: DistinctCount { name: \\\"COUNT(DISTINCT customer_1.c_name)\\\", data_type: Int64, state_data_types: [Utf8], exprs: [Column { name: \\\"c_name\\\", index: 0 }] }\")"))))
   ```
   
   I will sumit a PR for this :)


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