YuvalItzchakov edited a comment on pull request #15307:
URL: https://github.com/apache/flink/pull/15307#issuecomment-812995554
@fsk119 I've added a test to check computed column pushdown and it's failing.
Test:
```java
@Test
public void testComputedColumnPushdownAcrossWatermark() {
String ddl3 = "CREATE TABLE WithWatermark ("
+ " event_time TIMESTAMP(3),\n"
+ " price DOUBLE,\n"
+ " quantity DOUBLE,\n"
+ " cost AS price * quantity,\n"
+ " WATERMARK FOR event_time as event_time"
+ ") WITH (\n"
+ " 'connector' = 'values',\n"
+ " 'bounded' = 'false',\n"
+ " 'filterable-fields' = 'cost',\n"
+ " 'enable-watermark-push-down' = 'true',\n"
+ " 'disable-lookup' = 'true'"
+ ")";
util.tableEnv().executeSql(ddl3);
util.verifyRelPlan(
"SELECT * FROM WithWatermark WHERE cost > 20");
}
```
The optimized plan that is being generated is:
```
FlinkLogicalCalc(select=[event_time, price, quantity, cost])
+- FlinkLogicalCalc(select=[event_time, price, quantity, cost],
where=[>(cost, 20)])
+- FlinkLogicalCalc(select=[Reinterpret(event_time) AS event_time, price,
quantity, *(price, quantity) AS cost])
+- FlinkLogicalTableSourceScan(table=[[default_catalog,
default_database, WithWatermark, watermark=[$0]]], fields=[event_time, price,
quantity])
```
It seems that First a `LogicalCalc` is being created with the computed
columns and only then an additional `LogicalCalc` with the filter. I'm assuming
this is a bug?
--
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.
For queries about this service, please contact Infrastructure at:
[email protected]