carbondata-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jack...@apache.org
Subject [4/5] incubator-carbondata git commit: [CARBONDATA-607] Cleanup ValueCompressionHolder class and all sub-classes
Date Wed, 11 Jan 2017 07:34:19 GMT
[CARBONDATA-607] Cleanup ValueCompressionHolder class and all sub-classes


Project: http://git-wip-us.apache.org/repos/asf/incubator-carbondata/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-carbondata/commit/6592cf4d
Tree: http://git-wip-us.apache.org/repos/asf/incubator-carbondata/tree/6592cf4d
Diff: http://git-wip-us.apache.org/repos/asf/incubator-carbondata/diff/6592cf4d

Branch: refs/heads/master
Commit: 6592cf4d66a10f174fa1e16352cd2e533310027e
Parents: 0252e5d
Author: Jihong Ma <jihongma@apache.org>
Authored: Wed Jan 11 15:32:23 2017 +0800
Committer: jackylk <jacky.likun@huawei.com>
Committed: Wed Jan 11 15:32:23 2017 +0800

----------------------------------------------------------------------
 ...CompressedMeasureChunkFileBasedReaderV1.java |  21 ++-
 ...CompressedMeasureChunkFileBasedReaderV2.java |  35 +++--
 .../store/compression/ReaderCompressModel.java  |  10 +-
 .../compression/ValueCompressionHolder.java     | 115 +++++++++++++++
 .../compression/ValueCompressonHolder.java      | 108 --------------
 .../store/compression/WriterCompressModel.java  |  12 +-
 .../decimal/CompressionMaxMinByte.java          | 115 +++++++++++++++
 .../decimal/CompressionMaxMinDefault.java       | 117 +++++++++++++++
 .../decimal/CompressionMaxMinInt.java           | 113 ++++++++++++++
 .../decimal/CompressionMaxMinLong.java          | 113 ++++++++++++++
 .../decimal/CompressionMaxMinShort.java         | 115 +++++++++++++++
 .../decimal/UnCompressMaxMinByte.java           | 147 -------------------
 .../decimal/UnCompressMaxMinDefault.java        | 140 ------------------
 .../decimal/UnCompressMaxMinInt.java            | 141 ------------------
 .../decimal/UnCompressMaxMinLong.java           | 139 ------------------
 .../decimal/UnCompressMaxMinShort.java          | 139 ------------------
 .../nondecimal/CompressionNonDecimalByte.java   |  99 +++++++++++++
 .../CompressionNonDecimalDefault.java           | 101 +++++++++++++
 .../nondecimal/CompressionNonDecimalInt.java    | 100 +++++++++++++
 .../nondecimal/CompressionNonDecimalLong.java   | 101 +++++++++++++
 .../CompressionNonDecimalMaxMinByte.java        | 105 +++++++++++++
 .../CompressionNonDecimalMaxMinDefault.java     | 107 ++++++++++++++
 .../CompressionNonDecimalMaxMinInt.java         | 105 +++++++++++++
 .../CompressionNonDecimalMaxMinLong.java        | 106 +++++++++++++
 .../CompressionNonDecimalMaxMinShort.java       | 104 +++++++++++++
 .../nondecimal/CompressionNonDecimalShort.java  | 100 +++++++++++++
 .../nondecimal/UnCompressNonDecimalByte.java    | 119 ---------------
 .../nondecimal/UnCompressNonDecimalDefault.java | 117 ---------------
 .../nondecimal/UnCompressNonDecimalInt.java     | 115 ---------------
 .../nondecimal/UnCompressNonDecimalLong.java    | 116 ---------------
 .../UnCompressNonDecimalMaxMinByte.java         | 129 ----------------
 .../UnCompressNonDecimalMaxMinDefault.java      | 123 ----------------
 .../UnCompressNonDecimalMaxMinInt.java          | 126 ----------------
 .../UnCompressNonDecimalMaxMinLong.java         | 130 ----------------
 .../UnCompressNonDecimalMaxMinShort.java        | 129 ----------------
 .../nondecimal/UnCompressNonDecimalShort.java   | 119 ---------------
 .../compression/none/CompressionNoneByte.java   | 104 +++++++++++++
 .../none/CompressionNoneDefault.java            | 102 +++++++++++++
 .../compression/none/CompressionNoneInt.java    | 102 +++++++++++++
 .../compression/none/CompressionNoneLong.java   |  99 +++++++++++++
 .../compression/none/CompressionNoneShort.java  | 104 +++++++++++++
 .../compression/none/UnCompressNoneByte.java    | 127 ----------------
 .../compression/none/UnCompressNoneDefault.java | 120 ---------------
 .../compression/none/UnCompressNoneInt.java     | 122 ---------------
 .../compression/none/UnCompressNoneLong.java    | 124 ----------------
 .../compression/none/UnCompressNoneShort.java   | 125 ----------------
 .../compression/type/CompressionBigDecimal.java | 146 ++++++++++++++++++
 .../compression/type/UnCompressBigDecimal.java  | 119 ---------------
 .../type/UnCompressBigDecimalByte.java          | 145 ------------------
 .../store/dataholder/CarbonReadDataHolder.java  |   6 +-
 ...ractHeavyCompressedDoubleArrayDataStore.java |  27 ++--
 .../core/util/ValueCompressionUtil.java         | 132 ++++++++---------
 .../core/util/ValueCompressionUtilTest.java     | 128 ++++++++--------
 .../carbon/datastore/BlockIndexStoreTest.java   |   6 +
 54 files changed, 2569 insertions(+), 3100 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-carbondata/blob/6592cf4d/core/src/main/java/org/apache/carbondata/core/carbon/datastore/chunk/reader/measure/v1/CompressedMeasureChunkFileBasedReaderV1.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/carbondata/core/carbon/datastore/chunk/reader/measure/v1/CompressedMeasureChunkFileBasedReaderV1.java b/core/src/main/java/org/apache/carbondata/core/carbon/datastore/chunk/reader/measure/v1/CompressedMeasureChunkFileBasedReaderV1.java
index 00c0ad7..c7fbca8 100644
--- a/core/src/main/java/org/apache/carbondata/core/carbon/datastore/chunk/reader/measure/v1/CompressedMeasureChunkFileBasedReaderV1.java
+++ b/core/src/main/java/org/apache/carbondata/core/carbon/datastore/chunk/reader/measure/v1/CompressedMeasureChunkFileBasedReaderV1.java
@@ -27,8 +27,7 @@ import org.apache.carbondata.core.carbon.metadata.blocklet.BlockletInfo;
 import org.apache.carbondata.core.carbon.metadata.blocklet.datachunk.DataChunk;
 import org.apache.carbondata.core.datastorage.store.FileHolder;
 import org.apache.carbondata.core.datastorage.store.compression.ReaderCompressModel;
-import org.apache.carbondata.core.datastorage.store.compression.ValueCompressonHolder.UnCompressValue;
-
+import org.apache.carbondata.core.datastorage.store.compression.ValueCompressionHolder;
 import org.apache.carbondata.core.datastorage.store.dataholder.CarbonReadDataHolder;
 import org.apache.carbondata.core.metadata.ValueEncoderMeta;
 import org.apache.carbondata.core.util.ValueCompressionUtil;
@@ -84,13 +83,19 @@ public class CompressedMeasureChunkFileBasedReaderV1 extends AbstractMeasureChun
       final int blockIndex) throws IOException {
     ValueEncoderMeta meta = measureColumnChunks.get(blockIndex).getValueEncoderMeta().get(0);
     ReaderCompressModel compressModel = ValueCompressionUtil.getReaderCompressModel(meta);
-    UnCompressValue values = compressModel.getUnCompressValues().getNew().getCompressorObject();
-    CarbonReadDataHolder measureDataHolder = new CarbonReadDataHolder(values
-        .uncompress(compressModel.getConvertedDataType(), fileReader
-                .readByteArray(filePath, measureColumnChunks.get(blockIndex).getDataPageOffset(),
-                    measureColumnChunks.get(blockIndex).getDataPageLength()), 0,
+
+    ValueCompressionHolder values = compressModel.getValueCompressionHolder();
+    byte[] dataPage = fileReader
+            .readByteArray(filePath, measureColumnChunks.get(blockIndex).getDataPageOffset(),
+                    measureColumnChunks.get(blockIndex).getDataPageLength());
+
+    // unCompress data
+    values.uncompress(compressModel.getConvertedDataType(), dataPage, 0,
             measureColumnChunks.get(blockIndex).getDataPageLength(), compressModel.getMantissa(),
-            compressModel.getMaxValue()));
+            compressModel.getMaxValue());
+
+    CarbonReadDataHolder measureDataHolder = new CarbonReadDataHolder(values);
+
     // create and set the data chunk
     MeasureColumnDataChunk datChunk = new MeasureColumnDataChunk();
     datChunk.setMeasureDataHolder(measureDataHolder);

http://git-wip-us.apache.org/repos/asf/incubator-carbondata/blob/6592cf4d/core/src/main/java/org/apache/carbondata/core/carbon/datastore/chunk/reader/measure/v2/CompressedMeasureChunkFileBasedReaderV2.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/carbondata/core/carbon/datastore/chunk/reader/measure/v2/CompressedMeasureChunkFileBasedReaderV2.java b/core/src/main/java/org/apache/carbondata/core/carbon/datastore/chunk/reader/measure/v2/CompressedMeasureChunkFileBasedReaderV2.java
index 60fe4f7..32cf784 100644
--- a/core/src/main/java/org/apache/carbondata/core/carbon/datastore/chunk/reader/measure/v2/CompressedMeasureChunkFileBasedReaderV2.java
+++ b/core/src/main/java/org/apache/carbondata/core/carbon/datastore/chunk/reader/measure/v2/CompressedMeasureChunkFileBasedReaderV2.java
@@ -29,7 +29,7 @@ import org.apache.carbondata.core.carbon.metadata.blocklet.BlockletInfo;
 import org.apache.carbondata.core.carbon.metadata.blocklet.datachunk.PresenceMeta;
 import org.apache.carbondata.core.datastorage.store.FileHolder;
 import org.apache.carbondata.core.datastorage.store.compression.CompressorFactory;
-import org.apache.carbondata.core.datastorage.store.compression.ValueCompressonHolder.UnCompressValue;
+import org.apache.carbondata.core.datastorage.store.compression.ValueCompressionHolder;
 import org.apache.carbondata.core.datastorage.store.compression.WriterCompressModel;
 import org.apache.carbondata.core.datastorage.store.dataholder.CarbonReadDataHolder;
 import org.apache.carbondata.core.metadata.ValueEncoderMeta;
@@ -162,14 +162,19 @@ public class CompressedMeasureChunkFileBasedReaderV2 extends AbstractMeasureChun
           CarbonUtil.deserializeEncoderMeta(measureColumnChunk.getEncoder_meta().get(i).array()));
     }
     WriterCompressModel compressionModel = CarbonUtil.getValueCompressionModel(valueEncodeMeta);
-    UnCompressValue values =
-        compressionModel.getUnCompressValues()[0].getNew().getCompressorObject();
-    CarbonReadDataHolder measureDataHolder = new CarbonReadDataHolder(values
-        .uncompress(compressionModel.getConvertedDataType()[0], data, copyPoint,
-            measureColumnChunk.data_page_length, compressionModel.getMantissa()[0],
-            compressionModel.getMaxValue()[0]));
+
+    ValueCompressionHolder values = compressionModel.getValueCompressionHolder()[0];
+
+    // uncompress
+    values.uncompress(compressionModel.getConvertedDataType()[0], data,
+        copyPoint, measureColumnChunk.data_page_length, compressionModel.getMantissa()[0],
+            compressionModel.getMaxValue()[0]);
+
+    CarbonReadDataHolder measureDataHolder = new CarbonReadDataHolder(values);
+
     // set the data chunk
     datChunk.setMeasureDataHolder(measureDataHolder);
+
     // set the enun value indexes
     datChunk.setNullValueIndexHolder(getPresenceMeta(measureColumnChunk.presence));
     return datChunk;
@@ -208,16 +213,20 @@ public class CompressedMeasureChunkFileBasedReaderV2 extends AbstractMeasureChun
             CarbonUtil.deserializeEncoderMeta(measureColumnChunk.getEncoder_meta().get(j).array()));
       }
       WriterCompressModel compressionModel = CarbonUtil.getValueCompressionModel(valueEncodeMeta);
-      UnCompressValue values =
-          compressionModel.getUnCompressValues()[0].getNew().getCompressorObject();
-      // get the data holder after uncompressing
-      CarbonReadDataHolder measureDataHolder = new CarbonReadDataHolder(values
-          .uncompress(compressionModel.getConvertedDataType()[0], data, copyPoint,
+
+      ValueCompressionHolder values = compressionModel.getValueCompressionHolder()[0];
+
+      // uncompress
+      values.uncompress(compressionModel.getConvertedDataType()[0], data, copyPoint,
               measureColumnChunk.data_page_length, compressionModel.getMantissa()[0],
-              compressionModel.getMaxValue()[0]));
+              compressionModel.getMaxValue()[0]);
+
+      CarbonReadDataHolder measureDataHolder = new CarbonReadDataHolder(values);
+
       copyPoint += measureColumnChunk.data_page_length;
       // set the data chunk
       dataChunk.setMeasureDataHolder(measureDataHolder);
+
       // set the enun value indexes
       dataChunk.setNullValueIndexHolder(getPresenceMeta(measureColumnChunk.presence));
       dataChunks[index++] = dataChunk;

http://git-wip-us.apache.org/repos/asf/incubator-carbondata/blob/6592cf4d/core/src/main/java/org/apache/carbondata/core/datastorage/store/compression/ReaderCompressModel.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/carbondata/core/datastorage/store/compression/ReaderCompressModel.java b/core/src/main/java/org/apache/carbondata/core/datastorage/store/compression/ReaderCompressModel.java
index 8981aaa..51730a2 100644
--- a/core/src/main/java/org/apache/carbondata/core/datastorage/store/compression/ReaderCompressModel.java
+++ b/core/src/main/java/org/apache/carbondata/core/datastorage/store/compression/ReaderCompressModel.java
@@ -28,7 +28,7 @@ public class ReaderCompressModel {
 
   private ValueCompressionUtil.DataType convertedDataType;
 
-  private ValueCompressonHolder.UnCompressValue unCompressValues;
+  private ValueCompressionHolder valueHolder;
 
   public void setValueEncoderMeta(ValueEncoderMeta valueEncoderMeta) {
     this.valueEncoderMeta = valueEncoderMeta;
@@ -50,12 +50,12 @@ public class ReaderCompressModel {
     return valueEncoderMeta.getMantissa();
   }
 
-  public ValueCompressonHolder.UnCompressValue getUnCompressValues() {
-    return unCompressValues;
+  public ValueCompressionHolder getValueCompressionHolder() {
+    return valueHolder;
   }
 
-  public void setUnCompressValues(ValueCompressonHolder.UnCompressValue unCompressValues) {
-    this.unCompressValues = unCompressValues;
+  public void setValueCompressionHolder(ValueCompressionHolder valueHolder) {
+    this.valueHolder = valueHolder;
   }
 
 }

http://git-wip-us.apache.org/repos/asf/incubator-carbondata/blob/6592cf4d/core/src/main/java/org/apache/carbondata/core/datastorage/store/compression/ValueCompressionHolder.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/carbondata/core/datastorage/store/compression/ValueCompressionHolder.java b/core/src/main/java/org/apache/carbondata/core/datastorage/store/compression/ValueCompressionHolder.java
new file mode 100644
index 0000000..6fee5ea
--- /dev/null
+++ b/core/src/main/java/org/apache/carbondata/core/datastorage/store/compression/ValueCompressionHolder.java
@@ -0,0 +1,115 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.carbondata.core.datastorage.store.compression;
+
+import java.math.BigDecimal;
+
+import org.apache.carbondata.core.util.ValueCompressionUtil.DataType;
+
+
+
+/**
+ * ValueCompressionHolder is the base class for handling
+ * compression / decompression of the measure data chunk
+ */
+public abstract class ValueCompressionHolder<T> {
+
+  /**
+   * compressedValue
+   */
+  protected byte[] compressedValue;
+
+  /**
+   * @param compressor the compressor used to decompress the data
+   * @param dataType data type of the data
+   * @param data compressed data
+   */
+  public void unCompress(Compressor compressor, DataType dataType, byte[] data,
+      int offset, int length) {
+    switch (dataType) {
+      case DATA_BYTE:
+        setValue((T)compressor.unCompressByte(data, offset, length));
+        break;
+      case DATA_SHORT:
+        setValue((T)compressor.unCompressShort(data, offset, length));
+        break;
+      case DATA_INT:
+        setValue((T)compressor.unCompressInt(data, offset, length));
+        break;
+      case DATA_LONG:
+      case DATA_BIGINT:
+        setValue((T)compressor.unCompressLong(data, offset, length));
+        break;
+      case DATA_FLOAT:
+        setValue((T)compressor.unCompressFloat(data, offset, length));
+        break;
+      default:
+        setValue((T)compressor.unCompressDouble(data, offset, length));
+        break;
+    }
+  }
+
+  /**
+   * @param compressor the compressor used to compress the data
+   * @param dataType data type of the data
+   * @param data original data
+   */
+  public byte[] compress(Compressor compressor, DataType dataType, Object data) {
+    switch (dataType) {
+      case DATA_BYTE:
+        return compressor.compressByte((byte[])data);
+      case DATA_SHORT:
+        return compressor.compressShort((short[])data);
+      case DATA_INT:
+        return compressor.compressInt((int[])data);
+      case DATA_LONG:
+      case DATA_BIGINT:
+        return compressor.compressLong((long[])data);
+      case DATA_FLOAT:
+        return compressor.compressFloat((float[])data);
+      case DATA_DOUBLE:
+      default:
+        return compressor.compressDouble((double[])data);
+    }
+  }
+
+  public abstract void setValue(T value);
+
+  public abstract T getValue();
+
+  public abstract void setValueInBytes(byte[] value);
+
+  public abstract void compress();
+
+  public abstract void uncompress(DataType dataType, byte[] compressData, int offset,
+      int length, int decimal, Object maxValueObject);
+
+  public byte[] getCompressedData() { return compressedValue; }
+
+  public abstract long getLongValue(int index);
+
+  public abstract double getDoubleValue(int index);
+
+  public abstract BigDecimal getBigDecimalValue(int index);
+
+  public abstract void freeMemory();
+
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-carbondata/blob/6592cf4d/core/src/main/java/org/apache/carbondata/core/datastorage/store/compression/ValueCompressonHolder.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/carbondata/core/datastorage/store/compression/ValueCompressonHolder.java b/core/src/main/java/org/apache/carbondata/core/datastorage/store/compression/ValueCompressonHolder.java
deleted file mode 100644
index eca12ef..0000000
--- a/core/src/main/java/org/apache/carbondata/core/datastorage/store/compression/ValueCompressonHolder.java
+++ /dev/null
@@ -1,108 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *    http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.carbondata.core.datastorage.store.compression;
-
-import java.math.BigDecimal;
-
-import org.apache.carbondata.core.util.ValueCompressionUtil.DataType;
-
-/**
- * ValueCompressonHolder class.
- */
-public final class ValueCompressonHolder {
-
-  /**
-   * byteCompressor.
-   */
-  private static Compressor compressor = CompressorFactory.getInstance().getCompressor();
-
-  private ValueCompressonHolder() {
-
-  }
-
-  /**
-   * @param dataType
-   * @param value
-   * @param data
-   */
-  public static void unCompress(DataType dataType, UnCompressValue value, byte[] data, int offset,
-      int length, int decimal, Object maxValueObject) {
-    switch (dataType) {
-      case DATA_BYTE:
-        value.setUncompressValues(compressor.unCompressByte(data, offset, length), decimal,
-            maxValueObject);
-        break;
-      case DATA_SHORT:
-        value.setUncompressValues(compressor.unCompressShort(data, offset, length), decimal,
-            maxValueObject);
-        break;
-      case DATA_INT:
-        value.setUncompressValues(compressor.unCompressInt(data, offset, length), decimal,
-            maxValueObject);
-        break;
-      case DATA_LONG:
-      case DATA_BIGINT:
-        value.setUncompressValues(compressor.unCompressLong(data, offset, length), decimal,
-            maxValueObject);
-        break;
-      case DATA_FLOAT:
-        value.setUncompressValues(compressor.unCompressFloat(data, offset, length), decimal,
-            maxValueObject);
-        break;
-      default:
-        value.setUncompressValues(compressor.unCompressDouble(data, offset, length), decimal,
-            maxValueObject);
-        break;
-    }
-  }
-
-  /**
-   * interface for UnCompressValue<T>.
-   */
-  public interface UnCompressValue<T> extends Cloneable {
-
-    void setValue(T value);
-
-    void setValueInBytes(byte[] value);
-
-    UnCompressValue<T> getNew();
-
-    UnCompressValue compress();
-
-    UnCompressValue uncompress(DataType dataType, byte[] compressData, int offset, int length,
-        int decimal, Object maxValueObject);
-
-    void setUncompressValues(T data, int decimal, Object maxValueObject);
-
-    byte[] getBackArrayData();
-
-    UnCompressValue getCompressorObject();
-
-    long getLongValue(int index);
-
-    double getDoubleValue(int index);
-
-    BigDecimal getBigDecimalValue(int index);
-
-    void freeMemory();
-
-  }
-
-}

http://git-wip-us.apache.org/repos/asf/incubator-carbondata/blob/6592cf4d/core/src/main/java/org/apache/carbondata/core/datastorage/store/compression/WriterCompressModel.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/carbondata/core/datastorage/store/compression/WriterCompressModel.java b/core/src/main/java/org/apache/carbondata/core/datastorage/store/compression/WriterCompressModel.java
index de7c242..2e93123 100644
--- a/core/src/main/java/org/apache/carbondata/core/datastorage/store/compression/WriterCompressModel.java
+++ b/core/src/main/java/org/apache/carbondata/core/datastorage/store/compression/WriterCompressModel.java
@@ -63,7 +63,7 @@ public class WriterCompressModel {
   /**
    * unCompressValues.
    */
-  private ValueCompressonHolder.UnCompressValue[] unCompressValues;
+  private ValueCompressionHolder[] valueHolder;
 
   private CompressionFinder[] compressionFinders;
 
@@ -128,15 +128,15 @@ public class WriterCompressModel {
    *
    * @return the unCompressValues
    */
-  public ValueCompressonHolder.UnCompressValue[] getUnCompressValues() {
-    return unCompressValues;
+  public ValueCompressionHolder[] getValueCompressionHolder() {
+    return valueHolder;
   }
 
   /**
-   * @param unCompressValues the unCompressValues to set
+   * @param valueHolder set the ValueCompressionHolder
    */
-  public void setUnCompressValues(ValueCompressonHolder.UnCompressValue[] unCompressValues) {
-    this.unCompressValues = unCompressValues;
+  public void setValueCompressionHolder(ValueCompressionHolder[] valueHolder) {
+    this.valueHolder = valueHolder;
   }
 
   /**

http://git-wip-us.apache.org/repos/asf/incubator-carbondata/blob/6592cf4d/core/src/main/java/org/apache/carbondata/core/datastorage/store/compression/decimal/CompressionMaxMinByte.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/carbondata/core/datastorage/store/compression/decimal/CompressionMaxMinByte.java b/core/src/main/java/org/apache/carbondata/core/datastorage/store/compression/decimal/CompressionMaxMinByte.java
new file mode 100644
index 0000000..75b9db0
--- /dev/null
+++ b/core/src/main/java/org/apache/carbondata/core/datastorage/store/compression/decimal/CompressionMaxMinByte.java
@@ -0,0 +1,115 @@
+/*
+3 * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.carbondata.core.datastorage.store.compression.decimal;
+
+import java.math.BigDecimal;
+
+import org.apache.carbondata.common.logging.LogService;
+import org.apache.carbondata.common.logging.LogServiceFactory;
+import org.apache.carbondata.core.carbon.datastore.chunk.store.MeasureChunkStoreFactory;
+import org.apache.carbondata.core.carbon.datastore.chunk.store.MeasureDataChunkStore;
+import org.apache.carbondata.core.datastorage.store.compression.Compressor;
+import org.apache.carbondata.core.datastorage.store.compression.CompressorFactory;
+import org.apache.carbondata.core.datastorage.store.compression.ValueCompressionHolder;
+import org.apache.carbondata.core.util.ValueCompressionUtil.DataType;
+
+public class CompressionMaxMinByte extends ValueCompressionHolder<byte[]> {
+
+  /**
+   * Attribute for Carbon LOGGER
+   */
+  private static final LogService LOGGER =
+      LogServiceFactory.getLogService(CompressionMaxMinByte.class.getName());
+
+  /**
+   * compressor.
+   */
+  private static Compressor compressor = CompressorFactory.getInstance().getCompressor();
+
+  /**
+   * value.
+   */
+  protected byte[] value;
+
+  private MeasureDataChunkStore<byte[]> measureChunkStore;
+
+  /**
+   * actual data type
+   */
+  protected DataType actualDataType;
+
+  private double maxValue;
+
+  public CompressionMaxMinByte(DataType actualDataType) {
+    this.actualDataType = actualDataType;
+  }
+
+  @Override public byte[] getValue() {return this.value; }
+
+  @Override public void setValue(byte[] value) {
+    this.value = value;
+  }
+
+  @Override public void compress() {
+    compressedValue = super.compress(compressor, DataType.DATA_BYTE, value);
+  }
+
+  @Override
+  public void uncompress(DataType dataType, byte[] compressedData, int offset, int length,
+      int decimalPlaces, Object maxValueObject) {
+    super.unCompress(compressor, dataType, compressedData, offset, length);
+    setUncompressedValues(value, maxValueObject);
+
+  }
+
+  @Override public void setValueInBytes(byte[] value) {
+    this.value = value;
+  }
+
+  @Override public long getLongValue(int index) {
+    byte byteValue = measureChunkStore.getByte(index);
+    return (long) (maxValue - byteValue);
+  }
+
+  @Override public double getDoubleValue(int index) {
+    byte byteValue = measureChunkStore.getByte(index);
+    return (maxValue - byteValue);
+  }
+
+  @Override public BigDecimal getBigDecimalValue(int index) {
+    throw new UnsupportedOperationException(
+      "Big decimal value is not defined for CompressionMaxMinByte");
+  }
+
+  private void setUncompressedValues(byte[] data, Object maxValueObject) {
+    this.measureChunkStore =
+        MeasureChunkStoreFactory.INSTANCE.getMeasureDataChunkStore(DataType.DATA_BYTE, data.length);
+    this.measureChunkStore.putData(data);
+    if (maxValueObject instanceof Long) {
+      this.maxValue = (long)maxValueObject;
+    } else {
+      this.maxValue = (double) maxValueObject;
+    }
+  }
+
+  @Override public void freeMemory() {
+    this.measureChunkStore.freeMemory();
+  }
+}

http://git-wip-us.apache.org/repos/asf/incubator-carbondata/blob/6592cf4d/core/src/main/java/org/apache/carbondata/core/datastorage/store/compression/decimal/CompressionMaxMinDefault.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/carbondata/core/datastorage/store/compression/decimal/CompressionMaxMinDefault.java b/core/src/main/java/org/apache/carbondata/core/datastorage/store/compression/decimal/CompressionMaxMinDefault.java
new file mode 100644
index 0000000..00a993c
--- /dev/null
+++ b/core/src/main/java/org/apache/carbondata/core/datastorage/store/compression/decimal/CompressionMaxMinDefault.java
@@ -0,0 +1,117 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.carbondata.core.datastorage.store.compression.decimal;
+
+import java.math.BigDecimal;
+import java.nio.ByteBuffer;
+
+import org.apache.carbondata.common.logging.LogService;
+import org.apache.carbondata.common.logging.LogServiceFactory;
+import org.apache.carbondata.core.carbon.datastore.chunk.store.MeasureChunkStoreFactory;
+import org.apache.carbondata.core.carbon.datastore.chunk.store.MeasureDataChunkStore;
+import org.apache.carbondata.core.datastorage.store.compression.Compressor;
+import org.apache.carbondata.core.datastorage.store.compression.CompressorFactory;
+import org.apache.carbondata.core.datastorage.store.compression.ValueCompressionHolder;
+import org.apache.carbondata.core.util.ValueCompressionUtil;
+import org.apache.carbondata.core.util.ValueCompressionUtil.DataType;
+
+
+public class CompressionMaxMinDefault extends ValueCompressionHolder<double[]> {
+
+  /**
+   * Attribute for Carbon LOGGER
+   */
+  private static final LogService LOGGER =
+      LogServiceFactory.getLogService(CompressionMaxMinDefault.class.getName());
+
+  /**
+   * compressor.
+   */
+  private static Compressor compressor = CompressorFactory.getInstance().getCompressor();
+
+  /**
+   * value.
+   */
+  private double[] value;
+
+  private MeasureDataChunkStore<double[]> measureChunkStore;
+
+  /**
+   * actual data type
+   */
+  private DataType actualDataType;
+
+  private double maxValue;
+
+  public CompressionMaxMinDefault(DataType actualDataType) {
+    this.actualDataType = actualDataType;
+  }
+
+  @Override public void setValue(double[] value) {
+    this.value = value;
+  }
+
+  @Override public double[] getValue() {return this.value; }
+
+  @Override public void compress() {
+    compressedValue = super.compress(compressor, DataType.DATA_DOUBLE, value);
+  }
+
+  @Override public void uncompress(DataType dataType, byte[] compressedData,
+      int offset, int length, int decimalPlaces, Object maxValueObject) {
+    super.unCompress(compressor, dataType, compressedData, offset, length);
+    setUncompressedValues(value, maxValueObject);
+  }
+
+  @Override public void setValueInBytes(byte[] value) {
+    ByteBuffer buffer = ByteBuffer.wrap(value);
+    this.value = ValueCompressionUtil.convertToDoubleArray(buffer, value.length);
+  }
+
+  @Override public long getLongValue(int index) {
+    throw new UnsupportedOperationException(
+      "Long value is not defined for CompressionMaxMinDefault");
+  }
+
+  @Override public double getDoubleValue(int index) {
+    double doubleValue = measureChunkStore.getDouble(index);
+    return maxValue - doubleValue;
+  }
+
+  @Override public BigDecimal getBigDecimalValue(int index) {
+    throw new UnsupportedOperationException(
+      "Big decimal value is not defined for CompressionMaxMinDefault");
+  }
+
+  private void setUncompressedValues(double[] data, Object maxValueObject) {
+    this.measureChunkStore = MeasureChunkStoreFactory.INSTANCE
+            .getMeasureDataChunkStore(DataType.DATA_DOUBLE, data.length);
+    this.measureChunkStore.putData(data);
+    if (maxValueObject instanceof Long) {
+      this.maxValue = (long) maxValueObject;
+    } else {
+      this.maxValue = (double) maxValueObject;
+    }
+  }
+
+  @Override public void freeMemory() {
+    this.measureChunkStore.freeMemory();
+  }
+}

http://git-wip-us.apache.org/repos/asf/incubator-carbondata/blob/6592cf4d/core/src/main/java/org/apache/carbondata/core/datastorage/store/compression/decimal/CompressionMaxMinInt.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/carbondata/core/datastorage/store/compression/decimal/CompressionMaxMinInt.java b/core/src/main/java/org/apache/carbondata/core/datastorage/store/compression/decimal/CompressionMaxMinInt.java
new file mode 100644
index 0000000..bf00cf8
--- /dev/null
+++ b/core/src/main/java/org/apache/carbondata/core/datastorage/store/compression/decimal/CompressionMaxMinInt.java
@@ -0,0 +1,113 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.carbondata.core.datastorage.store.compression.decimal;
+
+import java.math.BigDecimal;
+import java.nio.ByteBuffer;
+
+import org.apache.carbondata.common.logging.LogService;
+import org.apache.carbondata.common.logging.LogServiceFactory;
+import org.apache.carbondata.core.carbon.datastore.chunk.store.MeasureChunkStoreFactory;
+import org.apache.carbondata.core.carbon.datastore.chunk.store.MeasureDataChunkStore;
+import org.apache.carbondata.core.datastorage.store.compression.Compressor;
+import org.apache.carbondata.core.datastorage.store.compression.CompressorFactory;
+import org.apache.carbondata.core.datastorage.store.compression.ValueCompressionHolder;
+import org.apache.carbondata.core.util.ValueCompressionUtil;
+import org.apache.carbondata.core.util.ValueCompressionUtil.DataType;
+
+public class CompressionMaxMinInt extends ValueCompressionHolder<int[]> {
+  /**
+   * Attribute for Carbon LOGGER
+   */
+  private static final LogService LOGGER =
+      LogServiceFactory.getLogService(CompressionMaxMinInt.class.getName());
+
+  /**
+   * compressor.
+   */
+  private static Compressor compressor = CompressorFactory.getInstance().getCompressor();
+
+  private MeasureDataChunkStore<int[]> measureChunkStore;
+
+  /**
+   * value.
+   */
+  private int[] value;
+
+  private DataType actualDataType;
+
+  private double maxValue;
+
+  public CompressionMaxMinInt(DataType actualType) {
+    this.actualDataType = actualType;
+  }
+
+  @Override public void setValue(int[] value) {
+    this.value = value;
+  }
+
+  @Override public int[] getValue() { return this.value; }
+
+  @Override
+  public void uncompress(DataType dataType, byte[] compressedData, int offset, int length,
+      int decimalPlaces, Object maxValueObject) {
+    super.unCompress(compressor, dataType, compressedData, offset, length);
+    setUncompressedValues(value, maxValueObject);
+  }
+
+  @Override public void compress() {
+    compressedValue = super.compress(compressor, DataType.DATA_INT, value);
+  }
+
+  @Override public void setValueInBytes(byte[] value) {
+    ByteBuffer buffer = ByteBuffer.wrap(value);
+    this.value = ValueCompressionUtil.convertToIntArray(buffer, value.length);
+  }
+
+  @Override public long getLongValue(int index) {
+    int intValue = measureChunkStore.getInt(index);
+    return (long) (maxValue - intValue);
+  }
+
+  @Override public double getDoubleValue(int index) {
+    int intValue = measureChunkStore.getInt(index);
+    return maxValue - intValue;
+  }
+
+  @Override public BigDecimal getBigDecimalValue(int index) {
+    throw new UnsupportedOperationException(
+      "Big decimal value is not defined for CompressionMaxMinInt");
+  }
+
+  private void setUncompressedValues(int[] data, Object maxValueObject) {
+    this.measureChunkStore =
+        MeasureChunkStoreFactory.INSTANCE.getMeasureDataChunkStore(DataType.DATA_INT, data.length);
+    this.measureChunkStore.putData(data);
+    if (maxValueObject instanceof Long) {
+      this.maxValue = (long) maxValueObject;
+    } else {
+      this.maxValue = (double) maxValueObject;
+    }
+  }
+
+  @Override public void freeMemory() {
+    this.measureChunkStore.freeMemory();
+  }
+}

http://git-wip-us.apache.org/repos/asf/incubator-carbondata/blob/6592cf4d/core/src/main/java/org/apache/carbondata/core/datastorage/store/compression/decimal/CompressionMaxMinLong.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/carbondata/core/datastorage/store/compression/decimal/CompressionMaxMinLong.java b/core/src/main/java/org/apache/carbondata/core/datastorage/store/compression/decimal/CompressionMaxMinLong.java
new file mode 100644
index 0000000..bebe4b7
--- /dev/null
+++ b/core/src/main/java/org/apache/carbondata/core/datastorage/store/compression/decimal/CompressionMaxMinLong.java
@@ -0,0 +1,113 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.carbondata.core.datastorage.store.compression.decimal;
+
+import java.math.BigDecimal;
+import java.nio.ByteBuffer;
+
+import org.apache.carbondata.common.logging.LogService;
+import org.apache.carbondata.common.logging.LogServiceFactory;
+import org.apache.carbondata.core.carbon.datastore.chunk.store.MeasureChunkStoreFactory;
+import org.apache.carbondata.core.carbon.datastore.chunk.store.MeasureDataChunkStore;
+import org.apache.carbondata.core.datastorage.store.compression.Compressor;
+import org.apache.carbondata.core.datastorage.store.compression.CompressorFactory;
+import org.apache.carbondata.core.datastorage.store.compression.ValueCompressionHolder;
+import org.apache.carbondata.core.util.ValueCompressionUtil;
+import org.apache.carbondata.core.util.ValueCompressionUtil.DataType;
+
+public class CompressionMaxMinLong extends ValueCompressionHolder<long[]> {
+  /**
+   * Attribute for Carbon LOGGER
+   */
+  private static final LogService LOGGER =
+      LogServiceFactory.getLogService(CompressionMaxMinLong.class.getName());
+  /**
+   * compressor.
+   */
+  private static Compressor compressor = CompressorFactory.getInstance().getCompressor();
+
+  private MeasureDataChunkStore<long[]> measureChunkStore;
+
+  /**
+   * value.
+   */
+  protected long[] value;
+
+  protected DataType actualDataType;
+
+  private double maxValue;
+
+  public CompressionMaxMinLong(DataType actualDataType) {
+    this.actualDataType = actualDataType;
+  }
+
+  @Override public void compress() {
+    compressedValue = super.compress(compressor, DataType.DATA_LONG, value);
+  }
+
+  @Override public void setValue(long[] value) {
+    this.value = value;
+
+  }
+
+  @Override
+  public void uncompress(DataType dataType, byte[] compressedData, int offset, int length,
+      int decimalPlaces, Object maxValueObject) {
+    super.unCompress(compressor, dataType, compressedData, offset, length);
+    setUncompressValues(value, maxValueObject);
+  }
+
+  @Override public long[] getValue() {return this.value; }
+
+  @Override public void setValueInBytes(byte[] value) {
+    ByteBuffer buffer = ByteBuffer.wrap(value);
+    this.value = ValueCompressionUtil.convertToLongArray(buffer, value.length);
+  }
+
+  @Override public long getLongValue(int index) {
+    long longValue = measureChunkStore.getLong(index);
+    return (long) maxValue - longValue;
+  }
+
+  @Override public double getDoubleValue(int index) {
+    long longValue = measureChunkStore.getLong(index);
+    return maxValue - longValue;
+  }
+
+  @Override public BigDecimal getBigDecimalValue(int index) {
+    throw new UnsupportedOperationException(
+      "Big decimal value is not defined for CompressionMaxMinLong");
+  }
+
+  private void setUncompressValues(long[] data, Object maxValueObject) {
+    this.measureChunkStore =
+        MeasureChunkStoreFactory.INSTANCE.getMeasureDataChunkStore(DataType.DATA_LONG, data.length);
+    this.measureChunkStore.putData(data);
+    if (maxValueObject instanceof Long) {
+      this.maxValue = (long) maxValueObject;
+    } else {
+      this.maxValue = (double) maxValueObject;
+    }
+  }
+
+  @Override public void freeMemory() {
+    this.measureChunkStore.freeMemory();
+  }
+}

http://git-wip-us.apache.org/repos/asf/incubator-carbondata/blob/6592cf4d/core/src/main/java/org/apache/carbondata/core/datastorage/store/compression/decimal/CompressionMaxMinShort.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/carbondata/core/datastorage/store/compression/decimal/CompressionMaxMinShort.java b/core/src/main/java/org/apache/carbondata/core/datastorage/store/compression/decimal/CompressionMaxMinShort.java
new file mode 100644
index 0000000..f179bce
--- /dev/null
+++ b/core/src/main/java/org/apache/carbondata/core/datastorage/store/compression/decimal/CompressionMaxMinShort.java
@@ -0,0 +1,115 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.carbondata.core.datastorage.store.compression.decimal;
+
+import java.math.BigDecimal;
+import java.nio.ByteBuffer;
+
+import org.apache.carbondata.common.logging.LogService;
+import org.apache.carbondata.common.logging.LogServiceFactory;
+import org.apache.carbondata.core.carbon.datastore.chunk.store.MeasureChunkStoreFactory;
+import org.apache.carbondata.core.carbon.datastore.chunk.store.MeasureDataChunkStore;
+import org.apache.carbondata.core.datastorage.store.compression.Compressor;
+import org.apache.carbondata.core.datastorage.store.compression.CompressorFactory;
+import org.apache.carbondata.core.datastorage.store.compression.ValueCompressionHolder;
+import org.apache.carbondata.core.util.ValueCompressionUtil;
+import org.apache.carbondata.core.util.ValueCompressionUtil.DataType;
+
+public class CompressionMaxMinShort extends ValueCompressionHolder<short[]> {
+
+  /**
+   * Attribute for Carbon LOGGER
+   */
+  private static final LogService LOGGER =
+      LogServiceFactory.getLogService(CompressionMaxMinShort.class.getName());
+
+  /**
+   * shortCompressor.
+   */
+  private static Compressor compressor = CompressorFactory.getInstance().getCompressor();
+
+  private MeasureDataChunkStore<short[]> measureChunkStore;
+
+  /**
+   * value.
+   */
+  private short[] value;
+
+  private DataType actualDataType;
+
+  private double maxValue;
+
+  public CompressionMaxMinShort(DataType actualDataType) {
+    this.actualDataType = actualDataType;
+  }
+
+  @Override public void setValue(short[] value) {
+    this.value = value;
+
+  }
+
+  @Override
+  public void uncompress(DataType dataType, byte[] compressedData, int offset, int length,
+      int decimalPlaces, Object maxValueObject) {
+    super.unCompress(compressor, dataType, compressedData, offset, length);
+    setUncompressedValues(value, maxValueObject);
+  }
+
+  @Override public short[] getValue() {return this.value; }
+
+  @Override public void compress() {
+    compressedValue = super.compress(compressor, DataType.DATA_SHORT, value);
+  }
+
+  @Override public void setValueInBytes(byte[] value) {
+    ByteBuffer buffer = ByteBuffer.wrap(value);
+    this.value = ValueCompressionUtil.convertToShortArray(buffer, value.length);
+  }
+
+  @Override public long getLongValue(int index) {
+    short shortValue = measureChunkStore.getShort(index);
+    return (long) maxValue - shortValue;
+  }
+
+  @Override public double getDoubleValue(int index) {
+    short shortValue = measureChunkStore.getShort(index);
+    return maxValue - shortValue;
+  }
+
+  @Override public BigDecimal getBigDecimalValue(int index) {
+    throw new UnsupportedOperationException(
+      "Big decimal value is not defined for CompressionMaxMinShort");
+  }
+
+  private void setUncompressedValues(short[] data, Object maxValueObject) {
+    this.measureChunkStore = MeasureChunkStoreFactory.INSTANCE
+        .getMeasureDataChunkStore(DataType.DATA_SHORT, data.length);
+    this.measureChunkStore.putData(data);
+    if (maxValueObject instanceof Long) {
+      this.maxValue = (long) maxValueObject;
+    } else {
+      this.maxValue = (double) maxValueObject;
+    }
+  }
+
+  @Override public void freeMemory() {
+    this.measureChunkStore.freeMemory();
+  }
+}

http://git-wip-us.apache.org/repos/asf/incubator-carbondata/blob/6592cf4d/core/src/main/java/org/apache/carbondata/core/datastorage/store/compression/decimal/UnCompressMaxMinByte.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/carbondata/core/datastorage/store/compression/decimal/UnCompressMaxMinByte.java b/core/src/main/java/org/apache/carbondata/core/datastorage/store/compression/decimal/UnCompressMaxMinByte.java
deleted file mode 100644
index 637e35b..0000000
--- a/core/src/main/java/org/apache/carbondata/core/datastorage/store/compression/decimal/UnCompressMaxMinByte.java
+++ /dev/null
@@ -1,147 +0,0 @@
-/*
-3 * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *    http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.carbondata.core.datastorage.store.compression.decimal;
-
-import java.math.BigDecimal;
-
-import org.apache.carbondata.common.logging.LogService;
-import org.apache.carbondata.common.logging.LogServiceFactory;
-import org.apache.carbondata.core.carbon.datastore.chunk.store.MeasureChunkStoreFactory;
-import org.apache.carbondata.core.carbon.datastore.chunk.store.MeasureDataChunkStore;
-import org.apache.carbondata.core.datastorage.store.compression.Compressor;
-import org.apache.carbondata.core.datastorage.store.compression.CompressorFactory;
-import org.apache.carbondata.core.datastorage.store.compression.ValueCompressonHolder;
-import org.apache.carbondata.core.datastorage.store.compression.ValueCompressonHolder.UnCompressValue;
-import org.apache.carbondata.core.util.ValueCompressionUtil;
-import org.apache.carbondata.core.util.ValueCompressionUtil.DataType;
-
-public class UnCompressMaxMinByte implements UnCompressValue<byte[]> {
-
-  /**
-   * Attribute for Carbon LOGGER
-   */
-  private static final LogService LOGGER =
-      LogServiceFactory.getLogService(UnCompressMaxMinByte.class.getName());
-  /**
-   * compressor.
-   */
-  private static Compressor compressor = CompressorFactory.getInstance().getCompressor();
-  /**
-   * value.
-   */
-  protected byte[] value;
-
-  private MeasureDataChunkStore<byte[]> measureChunkStore;
-
-  /**
-   * actual data type
-   */
-  protected DataType actualDataType;
-
-  private double maxValue;
-
-  //TODO SIMIAN
-
-  public UnCompressMaxMinByte(DataType actualDataType) {
-    this.actualDataType = actualDataType;
-  }
-
-  @Override public void setValue(byte[] value) {
-    this.value = value;
-
-  }
-
-  @Override public UnCompressValue getNew() {
-    try {
-      return (UnCompressValue) clone();
-    } catch (CloneNotSupportedException e) {
-      LOGGER.error(e, e.getMessage());
-    }
-    return null;
-  }
-
-  @Override public UnCompressValue compress() {
-    UnCompressMaxMinByte byte1 = new UnCompressMaxMinByte(actualDataType);
-    byte1.setValue(compressor.compressByte(value));
-    return byte1;
-  }
-
-  @Override
-  public UnCompressValue uncompress(DataType dataType, byte[] compressData, int offset, int length,
-      int decimalPlaces, Object maxValueObject) {
-    UnCompressValue byte1 =
-        ValueCompressionUtil.getUnCompressDecimalMaxMin(dataType, actualDataType);
-    ValueCompressonHolder
-        .unCompress(dataType, byte1, compressData, offset, length, decimalPlaces, maxValueObject);
-    return byte1;
-  }
-
-  @Override public byte[] getBackArrayData() {
-    return value;
-  }
-
-  @Override public void setValueInBytes(byte[] value) {
-    this.value = value;
-  }
-
-  /**
-   * @see ValueCompressonHolder.UnCompressValue#getCompressorObject()
-   */
-  @Override public UnCompressValue getCompressorObject() {
-    return new UnCompressMaxMinByte(actualDataType);
-  }
-
-  @Override public long getLongValue(int index) {
-    byte byteValue = measureChunkStore.getByte(index);
-    if (byteValue == (byte) 0) {
-      return (long) maxValue;
-    } else {
-      return (short) (maxValue - byteValue);
-    }
-  }
-
-  @Override public double getDoubleValue(int index) {
-    byte byteValue = measureChunkStore.getByte(index);
-    if (byteValue == (byte) 0) {
-      return maxValue;
-    } else {
-      return (short) (maxValue - byteValue);
-    }
-  }
-
-  @Override public BigDecimal getBigDecimalValue(int index) {
-    throw new UnsupportedOperationException("Get big decimal value is not supported");
-  }
-
-  @Override public void setUncompressValues(byte[] data, int decimalPlaces, Object maxValueObject) {
-    this.measureChunkStore =
-        MeasureChunkStoreFactory.INSTANCE.getMeasureDataChunkStore(DataType.DATA_BYTE, data.length);
-    this.measureChunkStore.putData(data);
-    if (maxValueObject instanceof Long) {
-      this.maxValue = (long) maxValueObject;
-    } else {
-      this.maxValue = (double) maxValueObject;
-    }
-  }
-
-  @Override public void freeMemory() {
-    this.measureChunkStore.freeMemory();
-  }
-}

http://git-wip-us.apache.org/repos/asf/incubator-carbondata/blob/6592cf4d/core/src/main/java/org/apache/carbondata/core/datastorage/store/compression/decimal/UnCompressMaxMinDefault.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/carbondata/core/datastorage/store/compression/decimal/UnCompressMaxMinDefault.java b/core/src/main/java/org/apache/carbondata/core/datastorage/store/compression/decimal/UnCompressMaxMinDefault.java
deleted file mode 100644
index 5d5c057..0000000
--- a/core/src/main/java/org/apache/carbondata/core/datastorage/store/compression/decimal/UnCompressMaxMinDefault.java
+++ /dev/null
@@ -1,140 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *    http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.carbondata.core.datastorage.store.compression.decimal;
-
-import java.math.BigDecimal;
-import java.nio.ByteBuffer;
-
-import org.apache.carbondata.common.logging.LogService;
-import org.apache.carbondata.common.logging.LogServiceFactory;
-import org.apache.carbondata.core.carbon.datastore.chunk.store.MeasureChunkStoreFactory;
-import org.apache.carbondata.core.carbon.datastore.chunk.store.MeasureDataChunkStore;
-import org.apache.carbondata.core.datastorage.store.compression.Compressor;
-import org.apache.carbondata.core.datastorage.store.compression.CompressorFactory;
-import org.apache.carbondata.core.datastorage.store.compression.ValueCompressonHolder;
-import org.apache.carbondata.core.datastorage.store.compression.ValueCompressonHolder.UnCompressValue;
-import org.apache.carbondata.core.util.ValueCompressionUtil;
-import org.apache.carbondata.core.util.ValueCompressionUtil.DataType;
-
-public class UnCompressMaxMinDefault implements ValueCompressonHolder.UnCompressValue<double[]> {
-
-  /**
-   * Attribute for Carbon LOGGER
-   */
-  private static final LogService LOGGER =
-      LogServiceFactory.getLogService(UnCompressMaxMinDefault.class.getName());
-
-  /**
-   * compressor.
-   */
-  private static Compressor compressor = CompressorFactory.getInstance().getCompressor();
-  /**
-   * value.
-   */
-  private double[] value;
-
-  private MeasureDataChunkStore<double[]> measureChunkStore;
-
-  /**
-   * actual data type
-   */
-  private DataType actualDataType;
-
-  private double maxValue;
-
-  public UnCompressMaxMinDefault(DataType actualDataType) {
-    this.actualDataType = actualDataType;
-  }
-
-  @Override public void setValue(double[] value) {
-    this.value = value;
-
-  }
-
-  @Override public ValueCompressonHolder.UnCompressValue getNew() {
-    try {
-      return (ValueCompressonHolder.UnCompressValue) clone();
-    } catch (CloneNotSupportedException ex5) {
-      LOGGER.error(ex5, ex5.getMessage());
-    }
-    return null;
-  }
-
-  @Override public ValueCompressonHolder.UnCompressValue compress() {
-    UnCompressMaxMinByte byte1 = new UnCompressMaxMinByte(actualDataType);
-    byte1.setValue(compressor.compressDouble(value));
-    return byte1;
-  }
-
-  @Override
-  public UnCompressValue uncompress(DataType dataType, byte[] compressData, int offset, int length,
-      int decimalPlaces, Object maxValueObject) {
-    return null;
-  }
-
-  @Override public byte[] getBackArrayData() {
-    return ValueCompressionUtil.convertToBytes(value);
-  }
-
-  @Override public void setValueInBytes(byte[] value) {
-    ByteBuffer buffer = ByteBuffer.wrap(value);
-    this.value = ValueCompressionUtil.convertToDoubleArray(buffer, value.length);
-  }
-
-  /**
-   * @see ValueCompressonHolder.UnCompressValue#getCompressorObject()
-   */
-  @Override public ValueCompressonHolder.UnCompressValue getCompressorObject() {
-    return new UnCompressMaxMinByte(actualDataType);
-  }
-
-  @Override public long getLongValue(int index) {
-    throw new UnsupportedOperationException("Get long value is not supported");
-  }
-
-  @Override public double getDoubleValue(int index) {
-    double doubleValue = measureChunkStore.getDouble(index);
-    if (doubleValue == 0) {
-      return maxValue;
-    } else {
-      return maxValue - doubleValue;
-    }
-  }
-
-  @Override public BigDecimal getBigDecimalValue(int index) {
-    throw new UnsupportedOperationException("Get big decimal value is not supported");
-  }
-
-  @Override
-  public void setUncompressValues(double[] data, int decimalPlaces, Object maxValueObject) {
-    this.measureChunkStore = MeasureChunkStoreFactory.INSTANCE
-        .getMeasureDataChunkStore(DataType.DATA_DOUBLE, data.length);
-    this.measureChunkStore.putData(data);
-    if (maxValueObject instanceof Long) {
-      this.maxValue = (long) maxValueObject;
-    } else {
-      this.maxValue = (double) maxValueObject;
-    }
-  }
-
-  @Override public void freeMemory() {
-    this.measureChunkStore.freeMemory();
-  }
-}

http://git-wip-us.apache.org/repos/asf/incubator-carbondata/blob/6592cf4d/core/src/main/java/org/apache/carbondata/core/datastorage/store/compression/decimal/UnCompressMaxMinInt.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/carbondata/core/datastorage/store/compression/decimal/UnCompressMaxMinInt.java b/core/src/main/java/org/apache/carbondata/core/datastorage/store/compression/decimal/UnCompressMaxMinInt.java
deleted file mode 100644
index f58f8a7..0000000
--- a/core/src/main/java/org/apache/carbondata/core/datastorage/store/compression/decimal/UnCompressMaxMinInt.java
+++ /dev/null
@@ -1,141 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *    http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.carbondata.core.datastorage.store.compression.decimal;
-
-import java.math.BigDecimal;
-import java.nio.ByteBuffer;
-
-import org.apache.carbondata.common.logging.LogService;
-import org.apache.carbondata.common.logging.LogServiceFactory;
-import org.apache.carbondata.core.carbon.datastore.chunk.store.MeasureChunkStoreFactory;
-import org.apache.carbondata.core.carbon.datastore.chunk.store.MeasureDataChunkStore;
-import org.apache.carbondata.core.datastorage.store.compression.Compressor;
-import org.apache.carbondata.core.datastorage.store.compression.CompressorFactory;
-import org.apache.carbondata.core.datastorage.store.compression.ValueCompressonHolder;
-import org.apache.carbondata.core.datastorage.store.compression.ValueCompressonHolder.UnCompressValue;
-import org.apache.carbondata.core.util.ValueCompressionUtil;
-import org.apache.carbondata.core.util.ValueCompressionUtil.DataType;
-
-public class UnCompressMaxMinInt implements ValueCompressonHolder.UnCompressValue<int[]> {
-  /**
-   * Attribute for Carbon LOGGER
-   */
-  private static final LogService LOGGER =
-      LogServiceFactory.getLogService(UnCompressMaxMinInt.class.getName());
-
-  /**
-   * compressor.
-   */
-  private static Compressor compressor = CompressorFactory.getInstance().getCompressor();
-
-  private MeasureDataChunkStore<int[]> measureChunkStore;
-
-  /**
-   * value.
-   */
-  private int[] value;
-
-  private DataType actualDataType;
-
-  private double maxValue;
-
-  public UnCompressMaxMinInt(DataType actualDataType) {
-    this.actualDataType = actualDataType;
-  }
-
-  @Override public void setValue(int[] value) {
-    this.value = value;
-
-  }
-
-  @Override public ValueCompressonHolder.UnCompressValue getNew() {
-    try {
-      return (ValueCompressonHolder.UnCompressValue) clone();
-    } catch (CloneNotSupportedException e) {
-      LOGGER.error(e, e.getMessage());
-    }
-    return null;
-  }
-
-  @Override public ValueCompressonHolder.UnCompressValue compress() {
-    UnCompressMaxMinByte byte1 = new UnCompressMaxMinByte(actualDataType);
-    byte1.setValue(compressor.compressInt(value));
-    return byte1;
-  }
-
-  @Override
-  public UnCompressValue uncompress(DataType dataType, byte[] compressData, int offset, int length,
-      int decimalPlaces, Object maxValueObject) {
-    return null;
-  }
-
-  @Override public byte[] getBackArrayData() {
-    return ValueCompressionUtil.convertToBytes(value);
-  }
-
-  @Override public void setValueInBytes(byte[] value) {
-    ByteBuffer buffer = ByteBuffer.wrap(value);
-    this.value = ValueCompressionUtil.convertToIntArray(buffer, value.length);
-  }
-
-  /**
-   * @see ValueCompressonHolder.UnCompressValue#getCompressorObject()
-   */
-  @Override public ValueCompressonHolder.UnCompressValue getCompressorObject() {
-    return new UnCompressMaxMinByte(actualDataType);
-  }
-
-  @Override public long getLongValue(int index) {
-    int intValue = measureChunkStore.getInt(index);
-    if (intValue == 0) {
-      return (long) maxValue;
-    } else {
-      return (long) maxValue - intValue;
-    }
-  }
-
-  @Override public double getDoubleValue(int index) {
-    int intValue = measureChunkStore.getInt(index);
-    if (intValue == 0) {
-      return maxValue;
-    } else {
-      return maxValue - intValue;
-    }
-  }
-
-  @Override public BigDecimal getBigDecimalValue(int index) {
-    throw new UnsupportedOperationException("Get big decimal value is not supported");
-  }
-
-  @Override public void setUncompressValues(int[] data, int decimalPlaces, Object maxValueObject) {
-    this.measureChunkStore =
-        MeasureChunkStoreFactory.INSTANCE.getMeasureDataChunkStore(DataType.DATA_INT, data.length);
-    this.measureChunkStore.putData(data);
-    if (maxValueObject instanceof Long) {
-      this.maxValue = (long) maxValueObject;
-    } else {
-      this.maxValue = (double) maxValueObject;
-    }
-  }
-
-  @Override public void freeMemory() {
-    this.measureChunkStore.freeMemory();
-  }
-}

http://git-wip-us.apache.org/repos/asf/incubator-carbondata/blob/6592cf4d/core/src/main/java/org/apache/carbondata/core/datastorage/store/compression/decimal/UnCompressMaxMinLong.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/carbondata/core/datastorage/store/compression/decimal/UnCompressMaxMinLong.java b/core/src/main/java/org/apache/carbondata/core/datastorage/store/compression/decimal/UnCompressMaxMinLong.java
deleted file mode 100644
index 6d64c73..0000000
--- a/core/src/main/java/org/apache/carbondata/core/datastorage/store/compression/decimal/UnCompressMaxMinLong.java
+++ /dev/null
@@ -1,139 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *    http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.carbondata.core.datastorage.store.compression.decimal;
-
-import java.math.BigDecimal;
-import java.nio.ByteBuffer;
-
-import org.apache.carbondata.common.logging.LogService;
-import org.apache.carbondata.common.logging.LogServiceFactory;
-import org.apache.carbondata.core.carbon.datastore.chunk.store.MeasureChunkStoreFactory;
-import org.apache.carbondata.core.carbon.datastore.chunk.store.MeasureDataChunkStore;
-import org.apache.carbondata.core.datastorage.store.compression.Compressor;
-import org.apache.carbondata.core.datastorage.store.compression.CompressorFactory;
-import org.apache.carbondata.core.datastorage.store.compression.ValueCompressonHolder;
-import org.apache.carbondata.core.datastorage.store.compression.ValueCompressonHolder.UnCompressValue;
-import org.apache.carbondata.core.util.ValueCompressionUtil;
-import org.apache.carbondata.core.util.ValueCompressionUtil.DataType;
-
-public class UnCompressMaxMinLong implements ValueCompressonHolder.UnCompressValue<long[]> {
-  /**
-   * Attribute for Carbon LOGGER
-   */
-  private static final LogService LOGGER =
-      LogServiceFactory.getLogService(UnCompressMaxMinLong.class.getName());
-  /**
-   * compressor.
-   */
-  private static Compressor compressor = CompressorFactory.getInstance().getCompressor();
-
-  private MeasureDataChunkStore<long[]> measureChunkStore;
-  /**
-   * value.
-   */
-  protected long[] value;
-
-  protected DataType actualDataType;
-
-  private double maxValue;
-
-  public UnCompressMaxMinLong(DataType actualDataType) {
-    this.actualDataType = actualDataType;
-  }
-
-  @Override public ValueCompressonHolder.UnCompressValue getNew() {
-    try {
-      return (ValueCompressonHolder.UnCompressValue) clone();
-    } catch (CloneNotSupportedException e) {
-      LOGGER.error(e, e.getMessage());
-    }
-    return null;
-  }
-
-  @Override public ValueCompressonHolder.UnCompressValue compress() {
-    UnCompressMaxMinByte unCompressByte = new UnCompressMaxMinByte(actualDataType);
-    unCompressByte.setValue(compressor.compressLong(value));
-    return unCompressByte;
-  }
-
-  @Override public void setValue(long[] value) {
-    this.value = value;
-
-  }
-
-  @Override
-  public UnCompressValue uncompress(DataType dataType, byte[] compressData, int offset, int length,
-      int decimalPlaces, Object maxValueObject) {
-    return null;
-  }
-
-  @Override public byte[] getBackArrayData() {
-    return ValueCompressionUtil.convertToBytes(value);
-  }
-
-  @Override public void setValueInBytes(byte[] value) {
-    ByteBuffer buffer = ByteBuffer.wrap(value);
-    this.value = ValueCompressionUtil.convertToLongArray(buffer, value.length);
-  }
-
-  /**
-   * @see ValueCompressonHolder.UnCompressValue#getCompressorObject()
-   */
-  @Override public ValueCompressonHolder.UnCompressValue getCompressorObject() {
-    return new UnCompressMaxMinByte(actualDataType);
-  }
-
-  @Override public long getLongValue(int index) {
-    long longValue = measureChunkStore.getLong(index);
-    if (longValue == 0) {
-      return (long) maxValue;
-    } else {
-      return (long) maxValue - longValue;
-    }
-  }
-
-  @Override public double getDoubleValue(int index) {
-    long longValue = measureChunkStore.getLong(index);
-    if (longValue == 0) {
-      return maxValue;
-    } else {
-      return maxValue - longValue;
-    }
-  }
-
-  @Override public BigDecimal getBigDecimalValue(int index) {
-    throw new UnsupportedOperationException("Get big decimal value is not supported");
-  }
-
-  @Override public void setUncompressValues(long[] data, int decimalPlaces, Object maxValueObject) {
-    this.measureChunkStore =
-        MeasureChunkStoreFactory.INSTANCE.getMeasureDataChunkStore(DataType.DATA_LONG, data.length);
-    this.measureChunkStore.putData(data);
-    if (maxValueObject instanceof Long) {
-      this.maxValue = (long) maxValueObject;
-    } else {
-      this.maxValue = (double) maxValueObject;
-    }
-  }
-
-  @Override public void freeMemory() {
-    this.measureChunkStore.freeMemory();
-  }
-}

http://git-wip-us.apache.org/repos/asf/incubator-carbondata/blob/6592cf4d/core/src/main/java/org/apache/carbondata/core/datastorage/store/compression/decimal/UnCompressMaxMinShort.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/carbondata/core/datastorage/store/compression/decimal/UnCompressMaxMinShort.java b/core/src/main/java/org/apache/carbondata/core/datastorage/store/compression/decimal/UnCompressMaxMinShort.java
deleted file mode 100644
index a138379..0000000
--- a/core/src/main/java/org/apache/carbondata/core/datastorage/store/compression/decimal/UnCompressMaxMinShort.java
+++ /dev/null
@@ -1,139 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *    http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.carbondata.core.datastorage.store.compression.decimal;
-
-import java.math.BigDecimal;
-import java.nio.ByteBuffer;
-
-import org.apache.carbondata.common.logging.LogService;
-import org.apache.carbondata.common.logging.LogServiceFactory;
-import org.apache.carbondata.core.carbon.datastore.chunk.store.MeasureChunkStoreFactory;
-import org.apache.carbondata.core.carbon.datastore.chunk.store.MeasureDataChunkStore;
-import org.apache.carbondata.core.datastorage.store.compression.Compressor;
-import org.apache.carbondata.core.datastorage.store.compression.CompressorFactory;
-import org.apache.carbondata.core.datastorage.store.compression.ValueCompressonHolder;
-import org.apache.carbondata.core.datastorage.store.compression.ValueCompressonHolder.UnCompressValue;
-import org.apache.carbondata.core.util.ValueCompressionUtil;
-import org.apache.carbondata.core.util.ValueCompressionUtil.DataType;
-
-public class UnCompressMaxMinShort implements ValueCompressonHolder.UnCompressValue<short[]> {
-  /**
-   * Attribute for Carbon LOGGER
-   */
-  private static final LogService LOGGER =
-      LogServiceFactory.getLogService(UnCompressMaxMinShort.class.getName());
-  /**
-   * shortCompressor.
-   */
-  private static Compressor compressor = CompressorFactory.getInstance().getCompressor();
-
-  private MeasureDataChunkStore<short[]> measureChunkStore;
-  /**
-   * value.
-   */
-  private short[] value;
-
-  private DataType actualDataType;
-  private double maxValue;
-
-  public UnCompressMaxMinShort(DataType actualDataType) {
-    this.actualDataType = actualDataType;
-  }
-
-  @Override public void setValue(short[] value) {
-    this.value = value;
-
-  }
-
-  @Override
-  public UnCompressValue uncompress(DataType dataType, byte[] compressData, int offset, int length,
-      int decimalPlaces, Object maxValueObject) {
-    return null;
-  }
-
-  @Override public byte[] getBackArrayData() {
-    return ValueCompressionUtil.convertToBytes(value);
-  }
-
-  @Override public ValueCompressonHolder.UnCompressValue getNew() {
-    try {
-      return (ValueCompressonHolder.UnCompressValue) clone();
-    } catch (CloneNotSupportedException ex3) {
-      LOGGER.error(ex3, ex3.getMessage());
-    }
-    return null;
-  }
-
-  @Override public ValueCompressonHolder.UnCompressValue compress() {
-    UnCompressMaxMinByte byte1 = new UnCompressMaxMinByte(actualDataType);
-    byte1.setValue(compressor.compressShort(value));
-    return byte1;
-  }
-
-  @Override public void setValueInBytes(byte[] value) {
-    ByteBuffer buffer = ByteBuffer.wrap(value);
-    this.value = ValueCompressionUtil.convertToShortArray(buffer, value.length);
-  }
-
-  /**
-   * @see ValueCompressonHolder.UnCompressValue#getCompressorObject()
-   */
-  @Override public ValueCompressonHolder.UnCompressValue getCompressorObject() {
-    return new UnCompressMaxMinByte(actualDataType);
-  }
-
-  @Override public long getLongValue(int index) {
-    short shortValue = measureChunkStore.getShort(index);
-    if (shortValue == 0) {
-      return (long) maxValue;
-    } else {
-      return (long) maxValue - shortValue;
-    }
-  }
-
-  @Override public double getDoubleValue(int index) {
-    short shortValue = measureChunkStore.getShort(index);
-    if (shortValue == 0) {
-      return maxValue;
-    } else {
-      return maxValue - shortValue;
-    }
-  }
-
-  @Override public BigDecimal getBigDecimalValue(int index) {
-    throw new UnsupportedOperationException("Get big decimal value is not supported");
-  }
-
-  @Override
-  public void setUncompressValues(short[] data, int decimalPlaces, Object maxValueObject) {
-    this.measureChunkStore = MeasureChunkStoreFactory.INSTANCE
-        .getMeasureDataChunkStore(DataType.DATA_SHORT, data.length);
-    this.measureChunkStore.putData(data);
-    if (maxValueObject instanceof Long) {
-      this.maxValue = (long) maxValueObject;
-    } else {
-      this.maxValue = (double) maxValueObject;
-    }
-  }
-
-  @Override public void freeMemory() {
-    this.measureChunkStore.freeMemory();
-  }
-}

http://git-wip-us.apache.org/repos/asf/incubator-carbondata/blob/6592cf4d/core/src/main/java/org/apache/carbondata/core/datastorage/store/compression/nondecimal/CompressionNonDecimalByte.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/carbondata/core/datastorage/store/compression/nondecimal/CompressionNonDecimalByte.java b/core/src/main/java/org/apache/carbondata/core/datastorage/store/compression/nondecimal/CompressionNonDecimalByte.java
new file mode 100644
index 0000000..1b7022b
--- /dev/null
+++ b/core/src/main/java/org/apache/carbondata/core/datastorage/store/compression/nondecimal/CompressionNonDecimalByte.java
@@ -0,0 +1,99 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.carbondata.core.datastorage.store.compression.nondecimal;
+
+import java.math.BigDecimal;
+
+import org.apache.carbondata.common.logging.LogService;
+import org.apache.carbondata.common.logging.LogServiceFactory;
+import org.apache.carbondata.core.carbon.datastore.chunk.store.MeasureChunkStoreFactory;
+import org.apache.carbondata.core.carbon.datastore.chunk.store.MeasureDataChunkStore;
+import org.apache.carbondata.core.datastorage.store.compression.Compressor;
+import org.apache.carbondata.core.datastorage.store.compression.CompressorFactory;
+import org.apache.carbondata.core.datastorage.store.compression.ValueCompressionHolder;
+import org.apache.carbondata.core.util.ValueCompressionUtil.DataType;
+
+public class CompressionNonDecimalByte extends ValueCompressionHolder<byte[]> {
+  /**
+   * Attribute for Carbon LOGGER
+   */
+  private static final LogService LOGGER =
+      LogServiceFactory.getLogService(CompressionNonDecimalByte.class.getName());
+
+  /**
+   * compressor.
+   */
+  private static Compressor compressor = CompressorFactory.getInstance().getCompressor();
+
+  /**
+   * value.
+   */
+  private byte[] value;
+
+  private MeasureDataChunkStore<byte[]> measureChunkStore;
+
+  private double divisionFactory;
+
+  @Override public void setValue(byte[] value) {
+    this.value = value;
+  }
+
+  @Override public byte[] getValue() {return this.value; }
+
+  @Override public void compress() {
+    compressedValue = super.compress(compressor, DataType.DATA_BYTE, value);
+  }
+
+  @Override
+  public void uncompress(DataType dataType, byte[] compressedData,
+      int offset, int length, int decimalPlaces, Object maxValueObject) {
+    super.unCompress(compressor, dataType, compressedData, offset, length);
+    setUncompressedValues(value, decimalPlaces);
+  }
+
+  @Override public void setValueInBytes(byte[] value) {
+    this.value = value;
+  }
+
+  @Override public long getLongValue(int index) {
+    throw new UnsupportedOperationException(
+      "Long value is not defined for CompressionNonDecimalByte");
+  }
+
+  @Override public double getDoubleValue(int index) {
+    return (measureChunkStore.getByte(index) / this.divisionFactory);
+  }
+
+  @Override public BigDecimal getBigDecimalValue(int index) {
+    throw new UnsupportedOperationException(
+      "Big decimal value is not defined for CompressionNonDecimalByte");
+  }
+
+  private void setUncompressedValues(byte[] data, int decimalPlaces) {
+    this.measureChunkStore =
+        MeasureChunkStoreFactory.INSTANCE.getMeasureDataChunkStore(DataType.DATA_BYTE, data.length);
+    this.measureChunkStore.putData(data);
+    this.divisionFactory = Math.pow(10, decimalPlaces);
+  }
+
+  @Override public void freeMemory() {
+    this.measureChunkStore.freeMemory();
+  }
+}

http://git-wip-us.apache.org/repos/asf/incubator-carbondata/blob/6592cf4d/core/src/main/java/org/apache/carbondata/core/datastorage/store/compression/nondecimal/CompressionNonDecimalDefault.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/carbondata/core/datastorage/store/compression/nondecimal/CompressionNonDecimalDefault.java b/core/src/main/java/org/apache/carbondata/core/datastorage/store/compression/nondecimal/CompressionNonDecimalDefault.java
new file mode 100644
index 0000000..1961d3f
--- /dev/null
+++ b/core/src/main/java/org/apache/carbondata/core/datastorage/store/compression/nondecimal/CompressionNonDecimalDefault.java
@@ -0,0 +1,101 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.carbondata.core.datastorage.store.compression.nondecimal;
+
+import java.math.BigDecimal;
+import java.nio.ByteBuffer;
+
+import org.apache.carbondata.common.logging.LogService;
+import org.apache.carbondata.common.logging.LogServiceFactory;
+import org.apache.carbondata.core.carbon.datastore.chunk.store.MeasureChunkStoreFactory;
+import org.apache.carbondata.core.carbon.datastore.chunk.store.MeasureDataChunkStore;
+import org.apache.carbondata.core.datastorage.store.compression.Compressor;
+import org.apache.carbondata.core.datastorage.store.compression.CompressorFactory;
+import org.apache.carbondata.core.datastorage.store.compression.ValueCompressionHolder;
+import org.apache.carbondata.core.util.ValueCompressionUtil;
+import org.apache.carbondata.core.util.ValueCompressionUtil.DataType;
+
+public class CompressionNonDecimalDefault extends ValueCompressionHolder<double[]> {
+  /**
+   * Attribute for Carbon LOGGER
+   */
+  private static final LogService LOGGER =
+      LogServiceFactory.getLogService(CompressionNonDecimalDefault.class.getName());
+  /**
+   * doubleCompressor.
+   */
+  private static Compressor compressor = CompressorFactory.getInstance().getCompressor();
+  /**
+   * value.
+   */
+  private double[] value;
+
+  private MeasureDataChunkStore<double[]> measureChunkStore;
+
+  private double divisionFactory;
+
+  @Override
+  public void uncompress(DataType dataType, byte[] compressedData, int offset, int length,
+      int decimalPlaces, Object maxValueObject) {
+    super.unCompress(compressor, dataType, compressedData, offset, length);
+    setUncompressedValues(value, decimalPlaces);
+  }
+
+  @Override public void compress() {
+    compressedValue = super.compress(compressor, DataType.DATA_DOUBLE, value);
+  }
+
+  @Override public void setValue(double[] value) {
+    this.value = value;
+
+  }
+
+  @Override public double[] getValue() {return this.value; }
+
+  @Override public void setValueInBytes(byte[] value) {
+    ByteBuffer buffer = ByteBuffer.wrap(value);
+    this.value = ValueCompressionUtil.convertToDoubleArray(buffer, value.length);
+  }
+
+  @Override public long getLongValue(int index) {
+    throw new UnsupportedOperationException(
+      "Long value is not defined for CompressionNonDecimalDefault");
+  }
+
+  @Override public double getDoubleValue(int index) {
+    return (measureChunkStore.getDouble(index) / divisionFactory);
+  }
+
+  @Override public BigDecimal getBigDecimalValue(int index) {
+    throw new UnsupportedOperationException(
+      "Big decimal value is not defined for CompressionNonDecimalDefault");
+  }
+
+  private void setUncompressedValues(double[] data, int decimalPlaces) {
+    this.measureChunkStore = MeasureChunkStoreFactory.INSTANCE
+        .getMeasureDataChunkStore(DataType.DATA_DOUBLE, data.length);
+    this.measureChunkStore.putData(data);
+    this.divisionFactory = Math.pow(10, decimalPlaces);
+  }
+
+  @Override public void freeMemory() {
+    this.measureChunkStore.freeMemory();
+  }
+}

http://git-wip-us.apache.org/repos/asf/incubator-carbondata/blob/6592cf4d/core/src/main/java/org/apache/carbondata/core/datastorage/store/compression/nondecimal/CompressionNonDecimalInt.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/carbondata/core/datastorage/store/compression/nondecimal/CompressionNonDecimalInt.java b/core/src/main/java/org/apache/carbondata/core/datastorage/store/compression/nondecimal/CompressionNonDecimalInt.java
new file mode 100644
index 0000000..2477e62
--- /dev/null
+++ b/core/src/main/java/org/apache/carbondata/core/datastorage/store/compression/nondecimal/CompressionNonDecimalInt.java
@@ -0,0 +1,100 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.carbondata.core.datastorage.store.compression.nondecimal;
+
+import java.math.BigDecimal;
+import java.nio.ByteBuffer;
+
+import org.apache.carbondata.common.logging.LogService;
+import org.apache.carbondata.common.logging.LogServiceFactory;
+import org.apache.carbondata.core.carbon.datastore.chunk.store.MeasureChunkStoreFactory;
+import org.apache.carbondata.core.carbon.datastore.chunk.store.MeasureDataChunkStore;
+import org.apache.carbondata.core.datastorage.store.compression.Compressor;
+import org.apache.carbondata.core.datastorage.store.compression.CompressorFactory;
+import org.apache.carbondata.core.datastorage.store.compression.ValueCompressionHolder;
+import org.apache.carbondata.core.util.ValueCompressionUtil;
+import org.apache.carbondata.core.util.ValueCompressionUtil.DataType;
+
+public class CompressionNonDecimalInt extends ValueCompressionHolder<int[]> {
+  /**
+   * Attribute for Carbon LOGGER
+   */
+  private static final LogService LOGGER =
+      LogServiceFactory.getLogService(CompressionNonDecimalInt.class.getName());
+  /**
+   * intCompressor.
+   */
+  private static Compressor compressor = CompressorFactory.getInstance().getCompressor();
+  /**
+   * value.
+   */
+  private int[] value;
+
+  private MeasureDataChunkStore<int[]> measureChunkStore;
+
+  private double divisionFactory;
+
+  @Override public void setValue(int[] value) {
+    this.value = value;
+  }
+
+  @Override public int[] getValue() { return this.value; }
+
+  @Override public void compress() {
+    compressedValue = super.compress(compressor, DataType.DATA_INT, value);
+  }
+
+  @Override public void setValueInBytes(byte[] bytesArr) {
+    ByteBuffer buffer = ByteBuffer.wrap(bytesArr);
+    this.value = ValueCompressionUtil.convertToIntArray(buffer, bytesArr.length);
+  }
+
+  @Override
+  public void uncompress(DataType dataType, byte[] compressedData, int offset, int length,
+      int decimalPlaces, Object maxValueObject) {
+    super.unCompress(compressor, dataType, compressedData, offset, length);
+    setUncompressedValues(value, decimalPlaces);
+  }
+
+  @Override public long getLongValue(int index) {
+    throw new UnsupportedOperationException(
+      "Long value is not defined for CompressionNonDecimalInt");
+  }
+
+  @Override public double getDoubleValue(int index) {
+    return (measureChunkStore.getInt(index) / this.divisionFactory);
+  }
+
+  @Override public BigDecimal getBigDecimalValue(int index) {
+    throw new UnsupportedOperationException(
+      "Big decimal value is not defined for CompressionNonDecmialInt");
+  }
+
+  private void setUncompressedValues(int[] data, int decimalPlaces) {
+    this.measureChunkStore =
+        MeasureChunkStoreFactory.INSTANCE.getMeasureDataChunkStore(DataType.DATA_INT, data.length);
+    this.measureChunkStore.putData(data);
+    this.divisionFactory = Math.pow(10, decimalPlaces);
+  }
+
+  @Override public void freeMemory() {
+    this.measureChunkStore.freeMemory();
+  }
+}



Mime
View raw message