github-actions[bot] commented on code in PR #62383:
URL: https://github.com/apache/doris/pull/62383#discussion_r3114696437
##########
fe/fe-core/src/main/java/org/apache/doris/nereids/glue/translator/RuntimeFilterTranslator.java:
##########
@@ -89,13 +90,143 @@ public Expr visitSlotReference(SlotReference
slotReference, PlanTranslatorContex
}
}
+ /**
+ * Translate a batch of nereids runtime filters, grouping those with the
same
+ * (srcExpr, type) into a single legacy runtime filter with multiple
targets.
+ * This supports V2-style RF generation where each target produces a
separate
+ * nereids RF object.
+ */
+ public void createLegacyRuntimeFilters(List<RuntimeFilter> filters,
PlanNode node, PlanTranslatorContext ctx) {
+ List<RuntimeFilter> remaining = new ArrayList<>(filters);
+ while (!remaining.isEmpty()) {
+ RuntimeFilter head = remaining.get(0);
+ List<RuntimeFilter> group = new ArrayList<>();
+ List<RuntimeFilter> others = new ArrayList<>();
+ group.add(head);
+ for (int i = 1; i < remaining.size(); i++) {
+ RuntimeFilter rf = remaining.get(i);
Review Comment:
Grouping only on `(srcExpr, type)` is too coarse here. After this PR,
`createLegacyRuntimeFilters()` is also used for nested-loop RFs, and those can
share the same source/type while still carrying different semantics. A concrete
case is `A.x < B.y AND A.z > B.y`: both filters have `srcExpr = B.y` and `type
= MIN_MAX`, but one must be `MAX` and the other `MIN`. This helper merges them
and later keeps only `head.gettMinMaxType()` / `head.getExprOrder()` /
`head.isBitmapFilterNotIn()`, so one target is translated with the wrong
runtime-filter semantics.
##########
fe/fe-core/src/main/java/org/apache/doris/nereids/glue/translator/RuntimeFilterTranslator.java:
##########
@@ -89,13 +90,143 @@ public Expr visitSlotReference(SlotReference
slotReference, PlanTranslatorContex
}
}
+ /**
+ * Translate a batch of nereids runtime filters, grouping those with the
same
+ * (srcExpr, type) into a single legacy runtime filter with multiple
targets.
+ * This supports V2-style RF generation where each target produces a
separate
+ * nereids RF object.
+ */
+ public void createLegacyRuntimeFilters(List<RuntimeFilter> filters,
PlanNode node, PlanTranslatorContext ctx) {
+ List<RuntimeFilter> remaining = new ArrayList<>(filters);
+ while (!remaining.isEmpty()) {
+ RuntimeFilter head = remaining.get(0);
+ List<RuntimeFilter> group = new ArrayList<>();
+ List<RuntimeFilter> others = new ArrayList<>();
+ group.add(head);
+ for (int i = 1; i < remaining.size(); i++) {
+ RuntimeFilter rf = remaining.get(i);
+ if (head.getSrcExpr().equals(rf.getSrcExpr()) &&
head.getType() == rf.getType()) {
+ group.add(rf);
+ } else {
+ others.add(rf);
+ }
+ }
+ if (group.size() == 1) {
+ createLegacyRuntimeFilter(head, node, ctx);
+ } else {
+ createLegacyRuntimeFilterFromGroup(group, node, ctx);
+ }
+ remaining = others;
+ }
+ }
+
+ private void createLegacyRuntimeFilterFromGroup(List<RuntimeFilter> group,
+ PlanNode node, PlanTranslatorContext ctx) {
+ if (ConnectContext.get() != null) {
+ for (RuntimeFilter rf : group) {
+ if (ConnectContext.get().getSessionVariable()
+
.getIgnoredRuntimeFilterIds().contains(rf.getId().asInt())) {
Review Comment:
This `return` drops the entire grouped legacy filter if any member is listed
in `ignore_runtime_filter_ids`. That regresses the old behavior: the previous
V2 translator filtered ignored RF IDs before grouping, so non-ignored siblings
with the same `(srcExpr, type)` were still translated. With this code, ignoring
one RF can accidentally disable every other grouped target from the same
builder.
--
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]