-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Closed
Labels
bugSomething isn't workingSomething isn't working
Description
Describe the bug
Optimization rule filter_push_down causes FieldNotFound error
To Reproduce
CREATE TABLE t AS VALUES (TIMESTAMP '2022-11-28T18:00:00');
SELECT date_trunc('day', column1) AS day FROM t GROUP BY day HAVING day IS NOT NULL;
SELECT date_trunc('day', column1) AS day FROM t GROUP BY day HAVING date_trunc('day', column1) IS NOT NULL;Error displayed
SchemaError(FieldNotFound { field: Column { relation: None, name: "datetrunc(Utf8(\"day\"),t.column1)" }, valid_fields: Some([Column { relation: Some("t"), name: "column1" }]) })
Expected behavior
When I delete the optimization rule filter_push_down, the statement executes normally.
+---------------------+
| day |
+---------------------+
| 2022-11-28T00:00:00 |
+---------------------+
Here is the log about filter_push_down. I added some descriptions about the Expr type.
[2022-11-28T12:37:49Z DEBUG datafusion_optimizer::optimizer] eliminate_outer_join:
Projection: Column(datetrunc(Utf8("day"),t.column1)) AS day
Filter: Column(datetrunc(Utf8("day"),t.column1)) IS NOT NULL
Aggregate: groupBy=[[ScalarFunction(datetrunc(Utf8("day"), Column(t.column1)))]], aggr=[[]]
TableScan: t
[2022-11-28T12:37:49Z DEBUG datafusion_optimizer::optimizer] filter_push_down:
Projection: Column(datetrunc(Utf8("day"),t.column1)) AS day
Aggregate: groupBy=[[ScalarFunction(datetrunc(Utf8("day"), Column(t.column1)))]], aggr=[[]]
Filter: Column(datetrunc(Utf8("day"),t.column1)) IS NOT NULL
TableScan: t
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working