jiacai2050 opened a new issue, #2994:
URL: https://github.com/apache/arrow-datafusion/issues/2994
**Describe the bug**
single_distinct_to_groupby panic when group by expr is a binaryExpr, with
error message like this:
```
thread 'main' panicked at 'called `Result::unwrap()` on an `Err` value:
SchemaError(FieldNotFound { qualifier: Some("users"), name: "id", valid_fields:
Some(["users.id + Int64(1)", "alias1"]) })',
datafusion/optimizer/src/single_distinct_to_groupby.rs:117:72
```
**To Reproduce**
Based on
https://github.com/apache/arrow-datafusion/blob/e47c4eb1ac8a5c3c07a0ed2bad74ecd6509bae7b/datafusion-examples/examples/memtable.rs#L39,
Change sql to following will reproduce this error.
```sql
SELECT id+1 as id, count(distinct(bank_account))
FROM users
group by id+1
order by id
```
**Expected behavior**
No error
**Additional context**
Add any other context about the problem here.
--
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]