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

    https://github.com/apache/carbondata/pull/2729#discussion_r225088657
  
    --- Diff: 
core/src/main/java/org/apache/carbondata/core/datastore/page/encoding/dimension/legacy/IndexStorageEncoder.java
 ---
    @@ -66,26 +109,76 @@
         return result;
       }
     
    +
       @Override
       protected ColumnPageEncoderMeta getEncoderMeta(ColumnPage inputPage) {
         return null;
       }
     
       @Override
    -  protected void fillLegacyFields(DataChunk2 dataChunk)
    -      throws IOException {
    -    SortState sort = (indexStorage.getRowIdPageLengthInBytes() > 0) ?
    +  protected List<ByteBuffer> buildEncoderMeta(ColumnPage inputPage) throws 
IOException {
    +    if (this.storeOffset) {
    +      List<ByteBuffer> metaDatas = new ArrayList<>();
    +      ByteArrayOutputStream stream = new ByteArrayOutputStream();
    +      DataOutputStream out = new DataOutputStream(stream);
    +      out.writeByte(selectedDataType.getId());
    +      metaDatas.add(ByteBuffer.wrap(stream.toByteArray()));
    +      return metaDatas;
    --- End diff --
    
    We can remove stream usage here and directly write the byte to ByteBuffer


---

Reply via email to