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 #1402: [CARBONDATA-1539] Change data type from enum ...
Date Thu, 12 Oct 2017 05:16:47 GMT
Github user ravipesala commented on a diff in the pull request:

    https://github.com/apache/carbondata/pull/1402#discussion_r144195868
  
    --- 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 --
    
    why don't use switch case  with id


---

Mime
View raw message