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

    https://github.com/apache/drill/pull/1101#discussion_r164624503
  
    --- Diff: 
exec/java-exec/src/main/java/org/apache/drill/exec/physical/impl/aggregate/HashAggTemplate.java
 ---
    @@ -215,6 +206,7 @@ public BatchHolder() {
               MaterializedField outputField = materializedValueFields[i];
               // Create a type-specific ValueVector for this value
               vector = TypeHelper.getNewVector(outputField, allocator);
    +          int columnSize = new RecordBatchSizer.ColumnSize(vector).estSize;
    --- End diff --
    
    Agree that the "sizer" should return the size of a fixed-width column even 
if there are 0 rows. Thanks for catching and fixing this. Though, I will point 
out that if you get a 0-length batch, just throw it away and read another; no 
useful purpose is served by doing anything with an empty batch (except to pass 
it along for schema purposes if this is the first batch: the so-called "fast 
schema" that is supposed to work, but seems to not be fully implemented...)
    
    I've found that Drill behaves poorly and erratically when trying to 
allocate zero-sized vectors. Best not to do that. If your batch size is 0, 
don't allocate vectors would be my general advice to avoid lots of grief.


---

Reply via email to