sohami commented on a change in pull request #1334: DRILL-6385: Support JPPD feature URL: https://github.com/apache/drill/pull/1334#discussion_r209791450
########## File path: exec/java-exec/src/main/java/org/apache/drill/exec/planner/physical/visitor/RuntimeFilterPrelVisitor.java ########## @@ -0,0 +1,38 @@ +package org.apache.drill.exec.planner.physical.visitor; + +import com.google.common.collect.Lists; +import org.apache.calcite.rel.RelNode; +import org.apache.drill.exec.planner.physical.Prel; +import org.apache.drill.exec.planner.physical.RuntimeFilterPrel; +import org.apache.drill.exec.planner.physical.ScanPrel; + +import java.util.List; + +/** + * Generate a RuntimeFilterPrel over all the ScanPrel. + */ +public class RuntimeFilterPrelVisitor extends BasePrelVisitor<Prel, Void, RuntimeException>{ + + private static RuntimeFilterPrelVisitor INSTANCE = new RuntimeFilterPrelVisitor(); + + public static Prel addRuntimeFilterPrelOverScanPrel(Prel prel) { + return prel.accept(INSTANCE, null); + } + + @Override + public Prel visitPrel(Prel prel, Void value) throws RuntimeException { + if (prel instanceof ScanPrel) { + List<RelNode> children = Lists.newArrayList(); + RuntimeFilterPrel runtimeFilterPrel = new RuntimeFilterPrel(prel); + children.add(runtimeFilterPrel); + return (Prel) prel.copy(prel.getTraitSet(), children); Review comment: This will call `copy` on `ScanPrel` which ignores the children probably because `Scan` is leaf node and there won't be any child. I think you should just return `runtimeFilterPrel` instead ? Or override method called `visitScan(ScanPrel prel, EXTRA value)` and put the code under if inside that method which will be as below: ``` @Override public Prel visitScan(ScanPrel prel, Void value) throws RuntimeException { RuntimeFilterPrel runtimeFilterPrel = new RuntimeFilterPrel(prel); return runtimeFilterPrel; } ``` ---------------------------------------------------------------- This is an automated message from the Apache Git Service. To respond to the message, please log on GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org With regards, Apache Git Services