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

   **Describe the bug**
   
   `csv_query_approx_count` fails due to an edge case exposed in 
https://github.com/apache/arrow-datafusion/pull/3222
   
   The test fails with:
   
   ```
   "Plan(\"Aggregations require unique expression names but the expression 
\\\"APPROXDISTINCT(#aggregate_test_100.c9)\\\" at position 0 and 
\\\"APPROXDISTINCT(CAST(#aggregate_test_100.c9 AS Utf8))\\\" at position 1 have 
the same name. Consider aliasing (\\\"AS\\\") one of them.\")
   ```
   
   However, the expressions are already aliased. The alias is dropped before 
the error check above and this part of the codebase needs some reworking. It is 
not trivial to fix.
   
   **To Reproduce**
   
   ```
   #[tokio::test]
   async fn csv_query_approx_count() -> Result<()> {
       let ctx = SessionContext::new();
       register_aggregate_csv(&ctx).await?;
       let sql = "SELECT approx_distinct(c9) count_c9, approx_distinct(cast(c9 
as varchar)) count_c9_str FROM aggregate_test_100";
       let actual = execute_to_batches(&ctx, sql).await;
       let expected = vec![
           "+----------+--------------+",
           "| count_c9 | count_c9_str |",
           "+----------+--------------+",
           "| 100      | 99           |",
           "+----------+--------------+",
       ];
       assert_batches_eq!(expected, &actual);
       Ok(())
   }
   ```
   
   **Expected behavior**
   Should pass
   
   **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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to