englefly commented on PR #68340:
URL: https://github.com/apache/doris/pull/68340#issuecomment-5774138684

   Both new P1 cases are addressed in `ee1bf37378b`.
   
   **Representative selection is now constrained by the source value domain.** 
The pushed filter is the one of the deepest builder of the identity group, 
which is a conservative substitute only when it prunes at most as many rows as 
every other filter of the group. `keepsSourceValue()` therefore requires that 
the source expression keeps its values between the deepest builder and the 
shallowest one:
   
   * every node in between must be in `SPJ_PLAN`. This is the all-node check 
the original code intended (its SPJ line was commented out) and it rejects the 
`Repeat` and the aggregate of `GROUP BY GROUPING SETS` — the case of comment 1 
— as well as set operations and nested loop joins;
   * a join which null extends the child the source comes from is rejected: the 
left child of a right outer join (and of an asof right outer join) — the case 
of comment 2. Tracking the child the source travels through is what 
distinguishes it from the preserved right child, which stays allowed.
   
   Verified on a local cluster for the grouping-sets shape (comment 1): `t c1 
JOIN (SELECT x FROM (SELECT c2.k AS k2, b.x AS x FROM t c2 JOIN b ON c2.k <=> 
b.x) z GROUP BY GROUPING SETS ((x), ())) g ON c1.k <=> g.x` with a NULL in `t` 
and `b.x = {3}` returns the row which matches the synthesized NULL with the 
NULL of the CTE, and the runtime filters stay on the branch sinks — the 
producer scan gets none (the plan contains `VAGGREGATE` and `VREPEAT_NODE` 
between the two builders). The same shape is now the `shared_cte_grouping_sets` 
case of the regression suite.
   
   Tests: `RuntimeFilterTest` 42/42 (the two new ones are 
`testDoNotPushRuntimeFilterWhichCrossesAValueSynthesizingNode` for the 
repeat/grouping-sets shape, and 
`testSourceValueIsNotKeptWhenAnOuterJoinNullExtendsIt`, which drives 
`keepsSourceValue` with a right outer join whose source comes from the null 
extended left child versus the preserved right child). The regression suite 
passes with six ordered cases. TPC-DS q95 with `runtime_filter_type=12` still 
installs the same four runtime filters on the inner scan of its CTE body with 
an unchanged result, and the reported case still returns 4 rows instead of 0.
   


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