jcrist opened a new issue, #10878:
URL: https://github.com/apache/datafusion/issues/10878
### Describe the bug
See the following code:
```python
import datafusion
print(f"datafusion: {datafusion.__version__}")
ctx = datafusion.SessionContext(
datafusion.SessionConfig(
{"datafusion.sql_parser.dialect": "PostgreSQL"}
).with_information_schema(True)
)
ctx.register_csv("test", "test.csv")
# A query with no alias works
good = "SELECT MIN(a) FILTER (WHERE a > 1) FROM test"
print(ctx.sql(good))
# A query with an IN filter works
bad = "SELECT MIN(a) FILTER (WHERE a IN (1, 2)) AS x FROM test"
print(ctx.sql(bad))
# But one with an inequality and an alias fails
bad = "SELECT MIN(a) FILTER (WHERE a > 1) AS x FROM test"
print(ctx.sql(bad))
```
And results:
```
datafusion: 38.0.1
DataFrame()
+-------------+
| MIN(test.a) |
+-------------+
| 3 |
+-------------+
DataFrame()
+---+
| x |
+---+
| 1 |
+---+
Traceback (most recent call last):
File "/home/jcristharif/Code/ibis/bug.py", line 23, in <module>
print(ctx.sql(bad))
Exception: Internal error: Input field name MIN(test.a) does not match with
the projection expression MIN(test.a) FILTER (WHERE test.a > Int64(1)).
This was likely caused by a bug in DataFusion's code and we would welcome
that you file an bug report in our issue tracker
```
All 3 queries do seem to work in versions `< 38.0.1`, so the bug appears to
have been introduced in that version.
### To Reproduce
_No response_
### Expected behavior
_No response_
### 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]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]