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

   **Describe the bug**
   Group by incorrectly works with alias. The query fails with "Projection 
references non-aggregate values"
   `
   
   **To Reproduce**
   ```
   async fn csv_query_group_by_substr() -> Result<()> {
       let ctx = SessionContext::new();
       register_aggregate_csv(&ctx).await?;
       let sql = "SELECT substr(c1, 1, 1) c1 \
           FROM aggregate_test_100 \
           GROUP BY substr(c1, 1, 1) \
           ";
       let actual = execute_to_batches(&ctx, sql).await;
       let expected = vec![
           "+----+-----------------------------+",
           "| c1 | AVG(aggregate_test_100.c12) |",
           "+----+-----------------------------+",
           "| a  | 0.48754517466109415         |",
           "| b  | 0.41040709263815384         |",
           "| c  | 0.6600456536439784          |",
           "| d  | 0.48855379387549824         |",
           "| e  | 0.48600669271341534         |",
           "+----+-----------------------------+",
       ];
       assert_batches_sorted_eq!(expected, &actual);
       Ok(())
   }
   ```
   **Expected behavior**
   Test 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