You are viewing a plain text version of this content. The canonical link for it is here.
Posted to github@arrow.apache.org by "waynexia (via GitHub)" <gi...@apache.org> on 2023/05/30 14:04:49 UTC
[GitHub] [arrow-datafusion] waynexia opened a new issue, #6489: Substrait doesn't support alias in projection
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: github-unsubscribe@arrow.apache.org.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [I] Substrait doesn't support alias in projection [arrow-datafusion]
Posted by "waynexia (via GitHub)" <gi...@apache.org>.
waynexia commented on issue #6489:
URL: https://github.com/apache/arrow-datafusion/issues/6489#issuecomment-1807695779
https://github.com/apache/arrow-datafusion/pull/5077/files#diff-7bd0ab7829b96498566ab887a4003134c38092e96441b8f5c8ccdb297478884eR384-R386 processes `Expr::Alias` but it isn't supported yet.
```rust
#[tokio::test]
async fn roundtrip_field_alias() -> Result<()> {
roundtrip("SELECT data.a as b FROM data").await
}
```
Fails with
```
Projection: data.a AS b
TableScan: data projection=[a]
TableScan: data projection=[a]
thread 'cases::roundtrip_logical_plan::roundtrip_field_alias' panicked at 'assertion failed: `(left == right)`
left: `"Projection: data.a AS b\n TableScan: data projection=[a]"`,
right: `"TableScan: data projection=[a]"`
```
--
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