github-actions[bot] commented on code in PR #63763:
URL: https://github.com/apache/doris/pull/63763#discussion_r3614210802


##########
fe/fe-core/src/main/java/org/apache/doris/nereids/rules/rewrite/AggScalarSubQueryToWindowFunction.java:
##########
@@ -79,22 +82,33 @@ public class AggScalarSubQueryToWindowFunction extends 
DefaultPlanRewriter<JobCo
 
     private static final Set<Class<? extends LogicalPlan>> 
OUTER_SUPPORTED_PLAN = ImmutableSet.of(
             LogicalJoin.class,
+            LogicalFilter.class,

Review Comment:
   [P1] Reject shared scans with different row domains
   
   Adding `LogicalFilter` here makes an outer `fact@incr(...)` scan eligible 
for WinMagic. `BindRelation` represents that as `Filter(timestamp) -> 
LogicalOlapScan(RowBinlogTableWrapper)`, and the wrapper retains the base table 
ID. `checkRelation()` therefore pairs it with an inner normal `fact` scan using 
only `Table.getId()`, even though they read different rows. For `... FROM 
fact@incr(...) f, dim d ... > (SELECT SUM(f2.v) FROM fact f2 WHERE f2.k=d.k)`, 
the original scalar aggregate reads the full base table, while the rewrite 
computes `SUM(f.v) OVER (...)` from only the incremental rows, which can 
reverse the predicate result. Please require each shared outer/inner scan pair 
to have equivalent row-domain semantics (wrapper/scan params, 
partitions/tablets/index/snapshot/sample, etc.), or reject the rewrite; add an 
outer-`@incr`/inner-base negative case.



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