carbondata-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From QiangCai <...@git.apache.org>
Subject [GitHub] carbondata pull request #1059: [CARBONDATA-1124] Use raw compression while e...
Date Wed, 21 Jun 2017 02:10:06 GMT
Github user QiangCai commented on a diff in the pull request:

    https://github.com/apache/carbondata/pull/1059#discussion_r123139760
  
    --- Diff: core/src/main/java/org/apache/carbondata/core/datastore/page/UnsafeFixLengthColumnPage.java
---
    @@ -326,9 +327,17 @@ public void encode(PrimitiveCodec codec) {
       }
     
       @Override
    -  public byte[] compress(Compressor compressor) {
    -    // TODO: use zero-copy raw compression
    -    return super.compress(compressor);
    +  public byte[] compress(Compressor compressor) throws MemoryException, IOException {
    +    // use raw compression and copy to byte[]
    +    int inputSize = pageSize << dataType.getSizeBits();
    +    int compressedMaxSize = compressor.maxCompressedLength(inputSize);
    +    MemoryBlock compressed = UnsafeMemoryManager.allocateMemoryWithRetry(compressedMaxSize);
    +    long outSize = compressor.rawCompress(baseOffset, inputSize, compressed.getBaseOffset());
    +    assert outSize < Integer.MAX_VALUE;
    +    byte[] output = new byte[(int) outSize];
    +    CarbonUnsafe.unsafe.copyMemory(compressed.getBaseObject(), compressed.getBaseOffset(),
    --- End diff --
    
    we need to judge which allocator we used also


---
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