Akshat-Jain commented on code in PR #17038:
URL: https://github.com/apache/druid/pull/17038#discussion_r1793470589


##########
processing/src/main/java/org/apache/druid/query/operator/NaivePartitioningOperator.java:
##########
@@ -110,28 +79,7 @@ public Closeable goOrContinue(Closeable continuation, 
Receiver receiver)
           @Override
           public Signal push(RowsAndColumns rac)

Review Comment:
   A static receiver wouldn't have access to methods like 
`ensureMaxRowsMaterializedConstraint()` which are also called from non-static 
methods.
   
   Also, can you elaborate why should we make receiver static? Even if we had a 
StaticReceiver, we would still have to do `new StaticReceiver()` with the 
required state.
   
   For example, to add a static receiver in NaivePartitioningOperator, I added 
the following `StaticReceiver` class and then replaced `new Receiver() {}` with 
`new StaticReceiver(receiver, iterHolder)`:
   
   ```java
   static class StaticReceiver implements Receiver
     {
       private final Receiver delegate;
       private final AtomicReference<Iterator<RowsAndColumns>> iterHolder;
   
       public StaticReceiver(
           Receiver delegate,
           AtomicReference<Iterator<RowsAndColumns>> iterHolder
       ) {
         this.delegate = delegate;
         this.iterHolder = iterHolder;
       }
   
       @Override
       public Signal push(RowsAndColumns rac)
       {
         return handlePush(rac, delegate, iterHolder);
       }
   
       @Override
       public void completed()
       {
         if (iterHolder.get() == null) {
           delegate.completed();
         }
       }
     }
   ```
   
   
   I think we're not on the same page wrt how the static receiver needs to look 
like. Can you share your thoughts on the above?



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