xudong963 opened a new issue #1403:
URL: https://github.com/apache/arrow-datafusion/issues/1403
**Describe the bug**
Group by uses unselect column is invalid.
such as `SELECT a FROM t ORDER BY b;`
**To Reproduce**
Steps to reproduce the behavior:
Postgres:
```sql
postgres=# create table foo (
a int,
b int
);
CREATE TABLE
postgres=# insert into foo (a, b) values (1, 2);
insert into foo (a, b) values (null, 3);
INSERT 0 1
INSERT 0 1
postgres=# select a from foo order by b;
a
---
1
(2 rows)
```
Datafusion
```sql
❯ create table foo as SELECT * FROM (VALUES (1,2), (2,3)) as t;
0 rows in set. Query took 0.061 seconds.
❯ select * from foo;
+---------+---------+
| column1 | column2 |
+---------+---------+
| 1 | 2 |
| 2 | 3 |
+---------+---------+
2 rows in set. Query took 0.006 seconds.
❯ select column1 from foo order by column2;
Plan("No field named 'foo.column2'. Valid fields are 'foo.column1'.")
```
**Expected behavior**
A clear and concise description of what you expected to happen.
**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]