Github user adeneche commented on a diff in the pull request:

    https://github.com/apache/drill/pull/222#discussion_r43668976
  
    --- Diff: 
exec/java-exec/src/main/java/org/apache/drill/exec/physical/impl/window/DefaultFrameTemplate.java
 ---
    @@ -287,6 +318,36 @@ private int countPeers(final int start) {
       }
     
       /**
    +   * Counts how many rows are peer with the first row of the current 
frame. This is called when we don't require all
    +   * batches of current partition to be processed at once.<br>
    +   * Assumes the end of the frame has indeed been found, because of this 
it doesn't use partition.remaining to check
    +   * the end of current partition but rather isSamePartition()
    +   * @param start first row of current frame
    +   * @return number of peer rows
    +   */
    +  private int countPeersPartialPartition(final int start) {
    +    // current frame always starts from first batch
    +    final VectorAccessible first = getCurrent();
    +    int length = 0;
    +
    +    // count all rows that are in the same frame of starting row
    +    // keep increasing length until we find first non peer row we reach 
the very
    +    // last batch
    +    for (WindowDataBatch batch : batches) {
    +      final int recordCount = batch.getRecordCount();
    +
    +      // for every remaining row in the partition, count it if it's a peer 
row
    +      for (int row = (batch == first) ? start : 0; row < recordCount; 
row++, length++) {
    --- End diff --
    
    This may be a relic from early implementations. I should be able to remove 
it now.
    
    I may also be able to get rid of `updatePartitionSize()` but this may 
require too much work for this patch and may do it in a separate patch


---
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 infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---

Reply via email to