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

   ### Describe the bug
   
   SQLs like these will fail:
   ```sql
   SELECT a as alias_a, a FROM data;
   ```
   or
   ```sql
   SELECT a as alias_a FROM data ORDER BY a;
   ```
   
   The error message looks like
   ```
   Error: Plan("Projections require unique expression names but the expression 
\"data.a\" at position 0 and \"data.a\" at position 1 have the same name. 
Consider aliasing (\"AS\") one of them.")
   ```
   
   ### To Reproduce
   
   Adding case in `datafusion/substrait/tests/roundtrip_logical_plan.rs` like:
   
   ```rust
       #[tokio::test]
       async fn roundtrip_alias_in_projection() -> Result<()> {
           roundtrip("SELECT a as alias_a, a FROM data").await
       }
   ```
   
   ### Expected behavior
   
   It should generate correct LogicalPlan without error
   
   ### Additional context
   
   _No response_


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