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_r230527544
 
 

 ##########
 File path: 
exec/java-exec/src/main/java/org/apache/drill/exec/ops/FragmentContextImpl.java
 ##########
 @@ -362,12 +368,35 @@ public boolean isUserAuthenticationEnabled() {
 
   @Override
   public void addRuntimeFilter(RuntimeFilterWritable runtimeFilter) {
-    this.runtimeFilterSink.aggregate(runtimeFilter);
+    this.runtimeFilterWritable = runtimeFilter;
+    if (enableRFWaiting) {
+      condition.signal();
+    }
+  }
+
+  @Override
+  public RuntimeFilterWritable getRuntimeFilter() {
+    return runtimeFilterWritable;
   }
 
   @Override
-  public RuntimeFilterSink getRuntimeFilterSink() {
-    return runtimeFilterSink;
+  public RuntimeFilterWritable getRuntimeFilter(long maxWaitTime, TimeUnit 
timeUnit) {
+    if (runtimeFilterWritable != null) {
+      return runtimeFilterWritable;
+    }
+    if (enableRFWaiting) {
+      lock.lock();
+      try {
+        if (runtimeFilterWritable != null) {
+          condition.await(maxWaitTime, timeUnit);
+        }
+      } catch (InterruptedException e) {
+        logger.debug("Condition was interrupted", e);
+      } finally {
+        lock.unlock();
+      }
+    }
+    return runtimeFilterWritable;
 
 Review comment:
   ```
   lockForRF.lock();
   try {
      if (runtimeFilterWritable != null) {
          return runtimeFilterWritable;
      }
      if (enableRFWaiting) {
          conditionForRF.await(maxWaitTime, timeUnit);
      }
      return runtimeFilterWritable;
   } catch (InterruptedException ex) {
      logger.debug("Conditional wait for RF was interrupted", ex);
   } finally {
      lockForRF.unlock();
   }
   ```

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

Reply via email to