Search before asking
Version
master
What's Wrong?
When a stream scan is placed inside a CTE, NormalizeOlapTableStreamScan may not run in the old rewrite placement. The stream virtual columns are then left as scan outputs instead of being lowered into parent project aliases, and later rewrite steps treat them as real scan slots.
This breaks hidden stream column resolution in the incremental refresh path and can fail IVM planning.
What You Expected?
Stream scans should be normalized consistently whether they appear directly in the query tree or under a CTE.
How to Reproduce?
A minimal reproduction pattern is:
WITH cte AS (
SELECT * FROM stream_table
)
SELECT * FROM cte;
In the broken path, the stream scan under the CTE is not lowered into an OLAP/binlog scan plus parent project aliases for the virtual stream columns.
Anything Else?
Related PR: #65468
The fix being proposed preserves LogicalOlapTableStreamScan during deep copy/CTE rewrite and moves NormalizeOlapTableStreamScan into the CTE children rewrite pipeline before OperativeColumnDerive.
Search before asking
Version
master
What's Wrong?
When a stream scan is placed inside a CTE,
NormalizeOlapTableStreamScanmay not run in the old rewrite placement. The stream virtual columns are then left as scan outputs instead of being lowered into parent project aliases, and later rewrite steps treat them as real scan slots.This breaks hidden stream column resolution in the incremental refresh path and can fail IVM planning.
What You Expected?
Stream scans should be normalized consistently whether they appear directly in the query tree or under a CTE.
How to Reproduce?
A minimal reproduction pattern is:
In the broken path, the stream scan under the CTE is not lowered into an OLAP/binlog scan plus parent project aliases for the virtual stream columns.
Anything Else?
Related PR: #65468
The fix being proposed preserves
LogicalOlapTableStreamScanduring deep copy/CTE rewrite and movesNormalizeOlapTableStreamScaninto the CTE children rewrite pipeline beforeOperativeColumnDerive.