carbondata-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From piaoyats <...@git.apache.org>
Subject [GitHub] incubator-carbondata pull request #388: [CARBONDATA-431]bigdecimal compressi...
Date Tue, 13 Dec 2016 03:18:36 GMT
Github user piaoyats commented on a diff in the pull request:

    https://github.com/apache/incubator-carbondata/pull/388#discussion_r92091360
  
    --- Diff: core/src/main/java/org/apache/carbondata/core/util/ValueCompressionUtil.java
---
    @@ -243,46 +270,64 @@ public static Object getCompressedValues(COMPRESSION_TYPE compType,
double[] val
        * @param actualDataType
        * @return compressor based on actualdatatype
        */
    -  public static ValueCompressor getValueCompressor(DataType actualDataType) {
    -    switch (actualDataType) {
    -      case DATA_BIGINT:
    -        return new BigIntCompressor();
    -      default:
    -        return new DoubleCompressor();
    +  public static ValueCompressor getValueCompressor(
    +      CompressionFinder compressionFinder) {
    +    if (compressionFinder instanceof BigDecimalCompressionFinder) {
    +      return new BigDecimalCompressor();
    +    } else {
    +      switch (compressionFinder.getActualDataType()) {
    +        case DATA_BIGINT:
    +          return new BigIntCompressor();
    +        default:
    +          return new DoubleCompressor();
    +      }
         }
       }
     
    -  private static ValueCompressonHolder.UnCompressValue[] getUncompressedValues(
    -      COMPRESSION_TYPE[] compType, DataType[] actualDataType, DataType[] changedDataType)
{
    -
    -    ValueCompressonHolder.UnCompressValue[] compressValue =
    -        new ValueCompressonHolder.UnCompressValue[changedDataType.length];
    -    for (int i = 0; i < changedDataType.length; i++) {
    -      switch (compType[i]) {
    -        case ADAPTIVE:
    -          compressValue[i] = getUnCompressNone(changedDataType[i], actualDataType[i]);
    -          break;
    -
    -        case DELTA_DOUBLE:
    -          compressValue[i] = getUnCompressDecimalMaxMin(changedDataType[i], actualDataType[i]);
    -          break;
    -
    -        case BIGINT:
    -          compressValue[i] = getUnCompressNonDecimal(changedDataType[i]);
    -          break;
    -
    -        case BIGDECIMAL:
    -          compressValue[i] = new UnCompressByteArray(UnCompressByteArray.ByteArrayType.BIG_DECIMAL);
    -          break;
    +  /**
    +   * get uncompressed object
    +   * @param compressionFinders : Compression types for measures
    +   * @return
    +   */
    +  private static UnCompressValue[] getUncompressedValues(
    +      CompressionFinder[] compressionFinders) {
    +    UnCompressValue[] unCompressedValues = new UnCompressValue[compressionFinders.length];
    +    for (int i=0; i< compressionFinders.length; i++) {
    +      unCompressedValues[i] = getUncompressedValue(compressionFinders[i]);
    +    }
    +    return unCompressedValues;
    +  }
    +  /**
    +   *
    +   * @param compressionFinder bigdecimal compression finder
    +   * @return Uncompressed measure object
    +   */
    +  private static UnCompressValue getUncompressedValue(
    +      BigDecimalCompressionFinder compressionFinder) {
    +    UnCompressValue leftPart = getUncompressedValue(compressionFinder.getLeftCompType(),
    +        compressionFinder.getLeftActualDataType(), compressionFinder.getLeftChangedDataType());
    +    UnCompressValue rightPart = getUncompressedValue(compressionFinder.getRightCompType(),
    +        compressionFinder.getRightActualDataType(), compressionFinder.getRightChangedDataType());
    +    return new UnCompressBigDecimal<>(compressionFinder, leftPart, rightPart);
    +  }
     
    -        default:
    -          compressValue[i] = getUnCompressNonDecimalMaxMin(changedDataType[i]);
    -      }
    +  /**
    +   *
    +   * @param compressionFinder for measure other then bigdecimal
    +   * @return
    +   */
    +  private static UnCompressValue getUncompressedValue(
    +      CompressionFinder compressionFinder) {
    +    if (compressionFinder instanceof BigDecimalCompressionFinder) {
    +      return getUncompressedValue(
    --- End diff --
    
    same instanceof 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