drill-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From paul-rogers <...@git.apache.org>
Subject [GitHub] drill pull request #761: DRILL-5284: Roll-up of final fixes for managed sort
Date Tue, 28 Feb 2017 00:06:45 GMT
Github user paul-rogers commented on a diff in the pull request:

    https://github.com/apache/drill/pull/761#discussion_r103333813
  
    --- Diff: exec/java-exec/src/main/java/org/apache/drill/exec/physical/impl/xsort/managed/ExternalSortBatch.java
---
    @@ -948,50 +1027,50 @@ private void updateMemoryEstimates(long memoryDelta, RecordBatchSizer
sizer) {
         // spill batches of either 64K records, or as many records as fit into the
         // amount of memory dedicated to each spill batch, whichever is less.
     
    -    spillBatchRowCount = (int) Math.max(1, spillBatchSize / estimatedRowWidth);
    +    spillBatchRowCount = (int) Math.max(1, preferredSpillBatchSize / estimatedRowWidth
/ 2);
    --- End diff --
    
    Yes. Another wonderful Drill artifact. Suppose we have 1023 bytes of data. We will allocate
a vector of 1024 bytes in size. Suppose we have 1025 bytes of data. (Just 0.2% more.) We allocate
a vector of 2048 bytes.
    
    Now, we could be more conservative and assume that, on average, each vector will bye 3/4
full, so we should us a factor of 1.5 for the calcs. We can file a JIRA and experiment with
this change as a future enhancement.
    
    It would also help if the allocator didn't kill the query if we allocate even one extra
byte. But, since math errors are fatal, we are super-conservative for now.


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

Mime
View raw message