carbondata-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ravipesala <...@git.apache.org>
Subject [GitHub] carbondata pull request #987: [CARBONDATA-1017] Add EncodingStrategy and use...
Date Tue, 13 Jun 2017 04:27:15 GMT
Github user ravipesala commented on a diff in the pull request:

    https://github.com/apache/carbondata/pull/987#discussion_r121579950
  
    --- Diff: core/src/main/java/org/apache/carbondata/core/datastore/page/ColumnPage.java
---
    @@ -46,51 +62,157 @@
       // The index of the rowId whose value is null, will be set to 1
       private BitSet nullBitSet;
     
    -  public ColumnPage(DataType dataType, int pageSize) {
    -    this.dataType = dataType;
    +  protected ColumnPage(DataType dataType, int pageSize) {
         this.pageSize = pageSize;
    -    this.stats = new ColumnPageStatistics(dataType);
    -    this.nullBitSet = new BitSet(pageSize);
    +    this.dataType = dataType;
    +  }
    +
    +  // create a new page
    +  public static ColumnPage newPage(DataType dataType, int pageSize) {
    +    ColumnPage instance;
         switch (dataType) {
    +      case BYTE:
    +        instance = newBytePage(new byte[pageSize]);
    +        break;
           case SHORT:
    +        instance = newShortPage(new short[pageSize]);
    +        break;
           case INT:
    +        instance = newIntPage(new int[pageSize]);
    +        break;
           case LONG:
    -        longData = new long[pageSize];
    +        instance = newLongPage(new long[pageSize]);
    +        break;
    +      case FLOAT:
    +        instance = newFloatPage(new float[pageSize]);
             break;
           case DOUBLE:
    -        doubleData = new double[pageSize];
    +        instance = newDoublePage(new double[pageSize]);
             break;
           case DECIMAL:
    -        byteArrayData = new byte[pageSize][];
    +        instance = newDecimalPage(new byte[pageSize][]);
             break;
           case STRING:
    -        byteArrayData = new byte[pageSize][];
    +        instance = newStringPage(new byte[pageSize][]);
             break;
           default:
             throw new RuntimeException("Unsupported data dataType: " + dataType);
         }
    +    instance.stats = new ColumnPageStatsVO(dataType);
    +    instance.nullBitSet = new BitSet(pageSize);
    +    return instance;
    +  }
    +
    +  // create a new page and set data with input `pageData`
    +  public static ColumnPage newPage(DataType dataType, Object pageData) {
    +    // This is used in read path, since statistics and nullBitSet is not required, not
creating
    +    // them to make object minimum
    +    switch (dataType) {
    +      case BYTE:
    +        byte[] byteData = (byte[]) pageData;
    +        return newBytePage(byteData);
    +      case SHORT:
    +        short[] shortData = (short[]) pageData;
    +        return newShortPage(shortData);
    +      case INT:
    +        int[] intData = (int[]) pageData;
    +        return newIntPage(intData);
    +      case LONG:
    +        long[] longData = (long[]) pageData;
    +        return newLongPage(longData);
    +      case FLOAT:
    +        float[] floatData = (float[]) pageData;
    +        return newFloatPage(floatData);
    +      case DOUBLE:
    +        double[] doubleData = (double[]) pageData;
    +        return newDoublePage(doubleData);
    +      case DECIMAL:
    +        byte[][] decimalData = (byte[][]) pageData;
    +        return newDecimalPage(decimalData);
    +      case STRING:
    --- End diff --
    
    Better change this to BYTE_ARRAY and bring KeyColumnPage also here


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