pia park created FLINK-41736:
--------------------------------
Summary: Proctime window TVF aggregation fails with "Non-mergeable
processing time window tvf aggregation is invalid" when the pulled-up plan is
costed higher
Key: FLINK-41736
URL: https://issues.apache.org/jira/browse/FLINK-41736
Project: Flink
Issue Type: Bug
Components: Table SQL / Planner
Affects Versions: 2.2.1
Reporter: pia park
{code:sql}
CREATE TEMPORARY TABLE gen (n BIGINT, pt AS PROCTIME()) WITH ('connector' =
'datagen');
CREATE TEMPORARY TABLE sink1 (ws TIMESTAMP(3), we TIMESTAMP(3), c BIGINT) WITH
('connector' = 'blackhole');
CREATE TEMPORARY VIEW v AS SELECT MOD(n, 3) AS k, pt FROM gen;
EXPLAIN INSERT INTO sink1
SELECT window_start, window_end, COUNT(*)
FROM TABLE(TUMBLE(TABLE v, DESCRIPTOR(pt), INTERVAL '1' MINUTES))
WHERE k IS NULL
GROUP BY window_start, window_end;
{code}
fails with "Non-mergeable processing time window tvf aggregation is invalid,
should fallback to group aggregation instead. This is a bug and should not
happen." The same query passes with {{k IS NOT NULL}}.
PullUpWindowTableFunctionIntoWindowAggregateRule does produce the valid plan,
but Volcano picks the WindowAttached one because the IS NULL selectivity is
estimated lower above the WindowTableFunction (0.1) than above the source
(0.25). Unlike FLINK-35816, the TVF can be pulled up here; the valid plan just
loses on cost.
A possible fix is to give the proctime WindowAttached
StreamPhysicalWindowAggregate an infinite cost. I'd like to work on this. Could
someone assign this ticket to me?
--
This message was sent by Atlassian Jira
(v10.3.26#10030026)