Github user paul-rogers commented on a diff in the pull request:

    https://github.com/apache/drill/pull/906#discussion_r134299304
  
    --- Diff: 
exec/java-exec/src/main/java/org/apache/drill/exec/physical/impl/ScanBatch.java 
---
    @@ -252,14 +235,28 @@ public IterOutcome next() {
         }
       }
     
    +  private void releaseAssets() {
    +    container.zeroVectors();
    +  }
    +
    +  private void clearFieldVectorMap() {
    +    for (final ValueVector v : mutator.fieldVectorMap().values()) {
    +      v.clear();
    +    }
    +  }
    +
    +  private void advanceNextReader() throws ExecutionSetupException {
    +    currentReader = readers.next();
    +    implicitValues = implicitColumns.hasNext() ? implicitColumns.next() : 
null;
    +    currentReader.setup(oContext, mutator);
    --- End diff --
    
    This seems somewhat unreliable. In the `next()` method above, we have, say, 
a reader with a new schema that returned 0 rows. We want to return the 
container, with that new schema, downstream.
    
    Before we do, we set up the next reader, passing it the mutator. Suppose 
the reader decides to set up its schema in the mutator? Doesn't that add noise 
to the signal we want to send downstream?
    
    Conversely, do readers know to *not* touch the mutator in `setup()` and 
instead defer schema setup to the first call to `next()`? Doesn't that make 
readers rather more complicated than they need to be?
    
    Of course, I could be missing something. In that case, a bit of comment to 
explain the protocol would be greatly appreciated!


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---

Reply via email to