[ 
https://issues.apache.org/jira/browse/DRILL-6792?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16657616#comment-16657616
 ] 

ASF GitHub Bot commented on DRILL-6792:
---------------------------------------

sohami commented on a change in pull request #1504: DRILL-6792: Find the right 
probe side fragment wrapper & fix DrillBuf…
URL: https://github.com/apache/drill/pull/1504#discussion_r226809347
 
 

 ##########
 File path: 
exec/java-exec/src/main/java/org/apache/drill/exec/work/filter/RuntimeFilterRouter.java
 ##########
 @@ -303,10 +332,28 @@ private Wrapper findPhysicalOpContainer(Wrapper wrapper, 
PhysicalOperator op) {
         return opContainer;
       }
     }
-    //should not be here
-    throw new IllegalStateException(String.format("No valid Wrapper found for 
physicalOperator with id=%d", op.getOperatorId()));
+    return null;
+  }
+
+  private Wrapper findRuntimeFilterContainer(Wrapper wrapper, long 
runtimeFilterIdentifier) {
+    boolean contain = containsRuntimeFilterPhysicalOperator(wrapper, 
runtimeFilterIdentifier);
+    if (contain) {
+      return wrapper;
+    }
+    List<Wrapper> dependencies = wrapper.getFragmentDependencies();
+    if (CollectionUtils.isEmpty(dependencies)) {
+      return null;
+    }
+    for (Wrapper dependencyWrapper : dependencies) {
+      Wrapper opContainer = findRuntimeFilterContainer(dependencyWrapper, 
runtimeFilterIdentifier);
+      if (opContainer != null) {
+        return opContainer;
+      }
+    }
+    return null;
 
 Review comment:
   `findRuntimeFilterContainer` and `findPhysicalOpContainer` are doing same 
thing except they are using different visitor. We can refactor this code as 
below then caller can call with appropriate visitor.
   ```suggestion
   private Wrapper findPhysicalOpContainer(Wrapper wrapper, PhysicalVisitor 
visitor) {
          boolean contain = containsPhysicalOperator(visitor);
       if (contain) {
         return wrapper;
       }
       List<Wrapper> dependencies = wrapper.getFragmentDependencies();
       if (CollectionUtils.isEmpty(dependencies)) {
         return null;
       }
       for (Wrapper dependencyWrapper : dependencies) {
         Wrapper opContainer = findPhysicalOpContainer(dependencyWrapper, 
visitor);
         if (opContainer != null) {
           return opContainer;
         }
       }
       return null;
     }
   ```

----------------------------------------------------------------
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:
[email protected]


> Find the right probe side fragment to any storage plugin
> --------------------------------------------------------
>
>                 Key: DRILL-6792
>                 URL: https://issues.apache.org/jira/browse/DRILL-6792
>             Project: Apache Drill
>          Issue Type: Improvement
>          Components: Execution - Flow
>            Reporter: weijie.tong
>            Assignee: weijie.tong
>            Priority: Major
>             Fix For: 1.15.0
>
>
> The current implementation of JPPD to find the probe side wrapper depends on 
> the GroupScan's digest. But there's no promise the GroupScan's digest will 
> not be changed since it is attached to the RuntimeFilterDef by different 
> storage plugin implementation logic.So here we assign a unique identifier to 
> the RuntimeFilter operator, and find the right probe side fragment wrapper by 
> the runtime filter identifier at the RuntimeFilterRouter class. 



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Reply via email to