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

    https://github.com/apache/carbondata/pull/2454#discussion_r200870442
  
    --- Diff: 
core/src/main/java/org/apache/carbondata/core/util/BlockletDataMapUtil.java ---
    @@ -321,4 +328,43 @@ private static boolean 
isSameColumnSchemaList(List<ColumnSchema> indexFileColumn
         }
         return updatedValues;
       }
    +
    +  /**
    +   * Convert schema to binary
    +   */
    +  public static byte[] convertSchemaToBinary(List<ColumnSchema> 
columnSchemas) throws IOException {
    +    ByteArrayOutputStream stream = new ByteArrayOutputStream();
    +    DataOutput dataOutput = new DataOutputStream(stream);
    +    dataOutput.writeShort(columnSchemas.size());
    +    for (ColumnSchema columnSchema : columnSchemas) {
    +      if (columnSchema.getColumnReferenceId() == null) {
    +        
columnSchema.setColumnReferenceId(columnSchema.getColumnUniqueId());
    +      }
    +      columnSchema.write(dataOutput);
    +    }
    +    byte[] byteArray = stream.toByteArray();
    +    // Compress with snappy to reduce the size of schema
    +    return Snappy.rawCompress(byteArray, byteArray.length);
    +  }
    +
    +  /**
    +   * Read column schema from binary
    +   *
    +   * @param schemaArray
    +   * @throws IOException
    +   */
    +  public static List<ColumnSchema> readColumnSchema(byte[] schemaArray) 
throws IOException {
    +    // uncompress it.
    +    schemaArray = Snappy.uncompress(schemaArray);
    --- End diff --
    
    Same as abive


---

Reply via email to