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

ASF GitHub Bot commented on HIVE-13232:
---------------------------------------

GitHub user melode11 opened a pull request:

    https://github.com/apache/hive/pull/118

    fix stripe size smaller than expected

    I saw there's a Jira item: https://issues.apache.org/jira/browse/HIVE-13232 
moved the compressed = null out of if block. But that is not seem to be a 
complete fix. To calculate the right value, we cannot use all bytes that a 
reserved, but should use bytes are filled. Thus I change the capacity() to 
position().
    ```java  
    public void flush() throws IOException {
        spill();
        if (compressed != null && compressed.position() != 0) {
          compressed.flip();
          receiver.output(compressed);
    //Should move compress = null out of if block, (already been moved out in 
2.1.0 code)
    //otherwise its capacity will count for all following stripes even it is 
not used by them.
          compressed = null;
    }
        uncompressedBytes = 0;
        compressedBytes = 0;
        overflow = null;
        current = null;
      }
    ```

You can merge this pull request into a Git repository by running:

    $ git pull https://github.com/melode11/hive master

Alternatively you can review and apply these changes as the patch at:

    https://github.com/apache/hive/pull/118.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

    This closes #118
    
----
commit 5490d08733166c4a1ea5f6a50a3e74897bdbd011
Author: Yuxing Yao <yux...@microsoft.com>
Date:   2016-11-25T10:33:11Z

    fix stripe size smaller than expected

----


> Aggressively drop compression buffers in ORC OutStreams
> -------------------------------------------------------
>
>                 Key: HIVE-13232
>                 URL: https://issues.apache.org/jira/browse/HIVE-13232
>             Project: Hive
>          Issue Type: Bug
>          Components: ORC
>            Reporter: Owen O'Malley
>            Assignee: Owen O'Malley
>             Fix For: 1.3.0, 2.1.0, 2.0.1
>
>         Attachments: HIVE-13232-branch-1.patch, HIVE-13232.patch, 
> HIVE-13232.patch, HIVE-13232.patch
>
>
> In Hive 0.11, when ORC's OutStream's were flushed they dropped all of the 
> their buffers. In the patch for HIVE-4324, we inadvertently changed that 
> behavior so that one of the buffers is held on to. For queries with a lot of 
> writers and thus under significant memory pressure this can have a 
> significant impact on the memory usage. 
> Note that "hive.optimize.sort.dynamic.partition" avoids this problem by 
> sorting on the dynamic partition key and thus only a single ORC writer is 
> open at once. This will use memory more effectively and avoid creating ORC 
> files with very small stripes, which will produce better downstream 
> performance.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to