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

    https://github.com/apache/carbondata/pull/1402#discussion_r144205561
  
    --- Diff: 
core/src/main/java/org/apache/carbondata/core/scan/collector/impl/AbstractScannedResultCollector.java
 ---
    @@ -89,24 +90,23 @@ protected void fillMeasureData(Object[] msrValues, int 
offset,
       protected Object getMeasureData(ColumnPage dataChunk, int index,
           CarbonMeasure carbonMeasure) {
         if (!dataChunk.getNullBits().get(index)) {
    -      switch (carbonMeasure.getDataType()) {
    -        case SHORT:
    -          return (short)dataChunk.getLong(index);
    -        case INT:
    -          return (int)dataChunk.getLong(index);
    -        case LONG:
    -          return dataChunk.getLong(index);
    -        case DECIMAL:
    -          BigDecimal bigDecimalMsrValue =
    -              dataChunk.getDecimal(index);
    -          if (null != bigDecimalMsrValue && carbonMeasure.getScale() > 
bigDecimalMsrValue.scale()) {
    -            bigDecimalMsrValue =
    -                bigDecimalMsrValue.setScale(carbonMeasure.getScale(), 
RoundingMode.HALF_UP);
    -          }
    -          // convert data type as per the computing engine
    -          return 
DataTypeUtil.getDataTypeConverter().convertToDecimal(bigDecimalMsrValue);
    -        default:
    -          return dataChunk.getDouble(index);
    +      DataType dataType = carbonMeasure.getDataType();
    +      if (dataType == DataTypes.SHORT) {
    --- End diff --
    
    For primitive type and String type, we can compare object address, it is 
simpler. 
    Only one place need to compare using id, `fromWrapperToExternalDataType` 
method. It needs it because GSON breaks the singleton pattern


---

Reply via email to