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

    https://github.com/apache/carbondata/pull/2902#discussion_r231016130
  
    --- Diff: 
core/src/main/java/org/apache/carbondata/core/datastore/page/encoding/compress/DirectCompressCodec.java
 ---
    @@ -257,7 +265,13 @@ private void fillVector(ColumnPage columnPage, 
CarbonColumnVector vector,
           } else if (pageDataType == DataTypes.SHORT) {
             short[] shortData = columnPage.getShortPage();
             if (vectorDataType == DataTypes.SHORT) {
    -          vector.putShorts(0, pageSize, shortData, 0);
    +          if (isUnderlyingVectorPresent) {
    +            for (int i = 0; i < pageSize; i++) {
    +              vector.putShort(i, shortData[i]);
    +            }
    +          } else {
    +            vector.putShorts(0, pageSize, shortData, 0);
    --- End diff --
    
    I think using `putShorts/putFloats` is common and unavoidable. In future 
also any new encoding class can make use of these method and then again the 
same problem can occur. Is it feasible to modify the vector classes 
implementation methods itself just like an example below
    `public void putShorts(int rowId, int count, short[] src, int srcIndex) {
        for (int i = srcIndex; i < count; i++) {
          putShort(rowId++, src[i]);
        }
      }`
    This way it will be better


---

Reply via email to