Describe the bug
See the following code:
import datafusion
print(f"datafusion: {datafusion.__version__}")
ctx = datafusion.SessionContext(
datafusion.SessionConfig(
{"datafusion.sql_parser.dialect": "PostgreSQL"}
).with_information_schema(True)
)
ctx.from_pydict({"a": [1, 3, 5]}, name="test")
# 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
Describe the bug
See the following code:
And results:
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