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

    https://github.com/apache/carbondata/pull/2417#discussion_r198864088
  
    --- Diff: 
core/src/main/java/org/apache/carbondata/core/datastore/chunk/store/ColumnPageWrapper.java
 ---
    @@ -77,14 +134,115 @@ public boolean isExplicitSorted() {
         return false;
       }
     
    -  @Override
    -  public int compareTo(int rowId, byte[] compareValue) {
    -    throw new UnsupportedOperationException("internal error");
    +  @Override public int compareTo(int rowId, byte[] compareValue) {
    +    if (columnPage.getColumnSpec().getColumnType() == 
ColumnType.DIRECT_DICTIONARY) {
    +      int surrogate = columnPage.getInt(rowId);
    +      int input = ByteBuffer.wrap(compareValue).getInt();
    +      return surrogate - input;
    +    } else {
    +      byte[] data;
    +      if (columnPage.getDataType() == DataTypes.INT) {
    +        data = ByteUtil.toBytes(columnPage.getInt(rowId));
    +      } else if (columnPage.getDataType() == DataTypes.STRING) {
    +        data = columnPage.getBytes(rowId);
    +      } else {
    +        throw new RuntimeException("invalid data type for dimension: " + 
columnPage.getDataType());
    +      }
    +      return ByteUtil.UnsafeComparer.INSTANCE
    +          .compareTo(data, 0, data.length, compareValue, 0, 
compareValue.length);
    +    }
       }
     
       @Override
       public void freeMemory() {
     
       }
     
    +  private void fillData(int[] rowMapping, ColumnVectorInfo 
columnVectorInfo,
    +      CarbonColumnVector vector) {
    +    int offsetRowId = columnVectorInfo.offset;
    +    int vectorOffset = columnVectorInfo.vectorOffset;
    +    int maxRowId = offsetRowId + columnVectorInfo.size;
    +    BitSet nullBitset = columnPage.getNullBits();
    +    switch (columnSpec.getColumnType()) {
    +      case DIRECT_DICTIONARY:
    --- End diff --
    
    No need to handle `DIRECT_DICTIONARY` and 'GLOBAL_DICTIONARY'


---

Reply via email to