yujun777 opened a new issue, #65469:
URL: https://github.com/apache/doris/issues/65469

   ### Search before asking
   
   - [x] I had searched in the [issues](https://github.com/apache/doris/issues) 
and found no similar issues.
   
   ### 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:
   
   ```sql
   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`.


-- 
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.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to