Github user jackylk commented on a diff in the pull request:

    https://github.com/apache/carbondata/pull/1059#discussion_r123155018
  
    --- 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);
    --- End diff --
    
    I think it is better to change the logic in UnsafeMemoryManager to simplify 
the usage code. In UnsafeMemoryManager, it will use unsafe memory based on
    ```
        boolean offHeap = Boolean.parseBoolean(CarbonProperties.getInstance()
            .getProperty(CarbonCommonConstants.ENABLE_OFFHEAP_SORT,
                CarbonCommonConstants.ENABLE_OFFHEAP_SORT_DEFAULT));
    ```
    So I suggest to change this part to make one configuration only for unsafe. 
Then I will remove other unsafe configuration like 
ENABLE_UNSAFE_COLUMN_PAGE_LOADING
    @ravipesala please check


---
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 [email protected] or file a JIRA ticket
with INFRA.
---

Reply via email to