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

    https://github.com/apache/drill/pull/1057#discussion_r158179222
  
    --- Diff: 
exec/java-exec/src/main/java/org/apache/drill/exec/record/VectorContainer.java 
---
    @@ -353,6 +353,23 @@ public int getRecordCount() {
     
       public boolean hasRecordCount() { return recordCount != -1; }
     
    +  /**
    +   * This works with non-hyper {@link VectorContainer}s which have no 
selection vectors.
    +   * Appends a row taken from a source {@link VectorContainer} to this 
{@link VectorContainer}.
    +   * @param srcContainer The {@link VectorContainer} to copy a row from.
    +   * @param srcIndex The index of the row to copy from the source {@link 
VectorContainer}.
    +   */
    +  public void appendRow(VectorContainer srcContainer, int srcIndex) {
    +    for (int vectorIndex = 0; vectorIndex < wrappers.size(); 
vectorIndex++) {
    +      ValueVector destVector = wrappers.get(vectorIndex).getValueVector();
    +      ValueVector srcVector = 
srcContainer.wrappers.get(vectorIndex).getValueVector();
    +
    +      destVector.copyEntry(recordCount, srcVector, srcIndex);
    +    }
    +
    +    recordCount++;
    --- End diff --
    
    I would not advise changing the meaning of -1; that is baked into the code 
in many places. Instead, before adding the first row, simply set the count to 0 
when the target container is created.


---

Reply via email to