[ 
https://issues.apache.org/jira/browse/DRILL-6071?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16333866#comment-16333866
 ] 

ASF GitHub Bot commented on DRILL-6071:
---------------------------------------

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

    https://github.com/apache/drill/pull/1091#discussion_r162847468
  
    --- Diff: 
exec/java-exec/src/test/java/org/apache/drill/exec/physical/unit/TestOutputBatchSize.java
 ---
    @@ -0,0 +1,498 @@
    +/*
    + * Licensed to the Apache Software Foundation (ASF) under one
    + * or more contributor license agreements.  See the NOTICE file
    + * distributed with this work for additional information
    + * regarding copyright ownership.  The ASF licenses this file
    + * to you under the Apache License, Version 2.0 (the
    + * "License"); you may not use this file except in compliance
    + * with the License.  You may obtain a copy of the License at
    + * <p/>
    + * http://www.apache.org/licenses/LICENSE-2.0
    + * <p/>
    + * Unless required by applicable law or agreed to in writing, software
    + * distributed under the License is distributed on an "AS IS" BASIS,
    + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    + * See the License for the specific language governing permissions and
    + * limitations under the License.
    + */
    +
    +package org.apache.drill.exec.physical.unit;
    +
    +import com.google.common.collect.Lists;
    +import org.apache.drill.common.expression.SchemaPath;
    +
    +import org.apache.drill.exec.physical.base.AbstractBase;
    +import org.apache.drill.exec.physical.base.PhysicalOperator;
    +import org.apache.drill.exec.physical.config.FlattenPOP;
    +import org.apache.drill.exec.physical.impl.ScanBatch;
    +import org.apache.drill.exec.physical.impl.spill.RecordBatchSizer;
    +import org.apache.drill.exec.record.RecordBatch;
    +import org.apache.drill.exec.record.VectorAccessible;
    +import org.apache.drill.exec.util.JsonStringArrayList;
    +import org.apache.drill.exec.util.JsonStringHashMap;
    +import org.apache.drill.exec.util.Text;
    +import org.junit.Ignore;
    +import org.junit.Test;
    +
    +import java.util.ArrayList;
    +import java.util.Arrays;
    +import java.util.List;
    +
    +public class TestOutputBatchSize extends PhysicalOpUnitTestBase {
    --- End diff --
    
    It seems the tests expect a small number of output records. I wonder, do we 
have a test with a large number of records, that will expand into a larger 
number of records, so that we can actually test the batch size limit?
    
    Something like this: generate a large JSON file (at least two batch sizes 
worth) of records something like this:
    ```
    (id1, dummy1, [id2, dummy2])
    ```
    id1 and id2 are just increasing numbers. dummy1 and dummy2 are large 
strings, created just to take up space. Put, say, 10, 20 or more records in 
each array.
    
    Given the sizes, we should be able to predict the number of output records 
per output batch. Since the tests here verify that the data is correct, we only 
need verify that the batches are the right size.
    
    In DRILL-6049 (PR #1085) there is a class that reads a multi-batch result 
set as a series of row sets. With the row set, you can easily get the number of 
rows per batch. (Can also be done with the older mechanisms, if with a bit more 
code.)
    
    Then, run the test to make sure the batches contain the number of records 
predicted by the size calcs.
    
    To reduce the amount of data, you can even use the ClusterFixture mechanism 
(or alter system) to reduce the output batch size.


> Limit batch size for flatten operator
> -------------------------------------
>
>                 Key: DRILL-6071
>                 URL: https://issues.apache.org/jira/browse/DRILL-6071
>             Project: Apache Drill
>          Issue Type: Bug
>          Components: Execution - Flow
>    Affects Versions: 1.12.0
>            Reporter: Padma Penumarthy
>            Assignee: Padma Penumarthy
>            Priority: Major
>             Fix For: 1.13.0
>
>
> flatten currently uses an adaptive algorithm to control the outgoing batch 
> size. 
> While processing the input batch, it adjusts the number of records in 
> outgoing batch based on memory usage so far. Once memory usage exceeds the 
> configured limit for a batch, the algorithm becomes more proactive and 
> adjusts the limit half way through  and end of every batch. All this periodic 
> checking of memory usage is unnecessary overhead and impacts performance. 
> Also, we will know only after the fact. 
> Instead, figure out how many rows should be there in the outgoing batch from 
> incoming batch.
> The way to do that would be to figure out average row size of the outgoing 
> batch and based on that figure out how many rows can be there for a given 
> amount of memory. value vectors provide us the necessary information to be 
> able to figure this out.



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Reply via email to