carbondata-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jack...@apache.org
Subject [3/4] incubator-carbondata git commit: modify compress interface
Date Tue, 06 Dec 2016 04:04:14 GMT
modify compress interface

fix style


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

Branch: refs/heads/master
Commit: 25b4ba2c9918c894f44761cf170d85f0a4e2a021
Parents: 7277355
Author: jackylk <jacky.likun@huawei.com>
Authored: Mon Dec 5 23:42:22 2016 +0800
Committer: jackylk <jacky.likun@huawei.com>
Committed: Tue Dec 6 11:26:04 2016 +0800

----------------------------------------------------------------------
 .../reader/dimension/AbstractChunkReader.java   |   5 +-
 ...mpressedDimensionChunkFileBasedReaderV1.java |   2 +-
 ...mpressedDimensionChunkFileBasedReaderV2.java |   5 +-
 ...CompressedMeasureChunkFileBasedReaderV1.java |   4 +-
 ...CompressedMeasureChunkFileBasedReaderV2.java |   7 +-
 .../core/constants/CarbonCommonConstants.java   |  11 +
 .../store/compression/Compressor.java           |  26 +-
 .../store/compression/CompressorFactory.java    |  42 +++
 .../store/compression/SnappyCompression.java    | 273 -------------------
 .../store/compression/SnappyCompressor.java     | 153 +++++++++++
 .../compression/ValueCompressonHolder.java      |  43 +--
 .../compression/type/UnCompressByteArray.java   |  12 +-
 .../compression/type/UnCompressMaxMinByte.java  |  10 +-
 .../type/UnCompressMaxMinByteForLong.java       |   8 +-
 .../type/UnCompressMaxMinDefault.java           |   9 +-
 .../type/UnCompressMaxMinDefaultLong.java       |   7 +-
 .../compression/type/UnCompressMaxMinFloat.java |  11 +-
 .../compression/type/UnCompressMaxMinInt.java   |   8 +-
 .../compression/type/UnCompressMaxMinLong.java  |   9 +-
 .../compression/type/UnCompressMaxMinShort.java |   8 +-
 .../type/UnCompressNonDecimalByte.java          |   9 +-
 .../type/UnCompressNonDecimalDefault.java       |   7 +-
 .../type/UnCompressNonDecimalFloat.java         |   7 +-
 .../type/UnCompressNonDecimalInt.java           |   9 +-
 .../type/UnCompressNonDecimalLong.java          |  10 +-
 .../type/UnCompressNonDecimalMaxMinByte.java    |   9 +-
 .../type/UnCompressNonDecimalMaxMinDefault.java |  10 +-
 .../type/UnCompressNonDecimalMaxMinFloat.java   |   7 +-
 .../type/UnCompressNonDecimalMaxMinInt.java     |   9 +-
 .../type/UnCompressNonDecimalMaxMinLong.java    |   7 +-
 .../type/UnCompressNonDecimalMaxMinShort.java   |   9 +-
 .../type/UnCompressNonDecimalShort.java         |   7 +-
 .../compression/type/UnCompressNoneByte.java    |   7 +-
 .../compression/type/UnCompressNoneDefault.java |   8 +-
 .../compression/type/UnCompressNoneFloat.java   |  13 +-
 .../compression/type/UnCompressNoneInt.java     |  31 ++-
 .../compression/type/UnCompressNoneLong.java    |   9 +-
 .../compression/type/UnCompressNoneShort.java   |  13 +-
 .../store/dataholder/CarbonReadDataHolder.java  |  84 ++----
 ...HeavyCompressedDoubleArrayDataFileStore.java | 110 --------
 .../uncompressed/DoubleArrayDataFileStore.java  |  86 ------
 .../DoubleArrayDataInMemoryStore.java           |   5 -
 .../key/columnar/AbstractColumnarKeyStore.java  | 106 -------
 .../CompressedColumnarFileKeyStore.java         | 168 ------------
 .../CompressedColumnarInMemoryStore.java        | 155 -----------
 .../CompressedColumnarKeyStoreUtil.java         | 108 --------
 .../UnCompressedColumnarFileKeyStore.java       |  88 ------
 .../UnCompressedColumnarInMemoryStore.java      |  70 -----
 .../AbstractCompressedSingleArrayStore.java     | 119 --------
 .../CompressedSingleArrayKeyFileStore.java      |  92 -------
 .../CompressedSingleArrayKeyInMemoryStore.java  |  46 ----
 .../AbstractSingleArrayKeyStore.java            | 107 --------
 .../uncompressed/SingleArrayKeyFileStore.java   | 104 -------
 .../SingleArrayKeyInMemoryStore.java            |  36 ---
 .../core/util/CarbonMetadataUtil.java           |   6 +-
 ...ressedDimensionChunkFileBasedReaderTest.java |  18 +-
 .../sortdata/CompressedTempSortFileReader.java  |   6 +-
 .../sortdata/CompressedTempSortFileWriter.java  |   4 +-
 .../store/writer/AbstractFactDataWriter.java    |   4 +-
 59 files changed, 412 insertions(+), 1944 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-carbondata/blob/25b4ba2c/core/src/main/java/org/apache/carbondata/core/carbon/datastore/chunk/reader/dimension/AbstractChunkReader.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/carbondata/core/carbon/datastore/chunk/reader/dimension/AbstractChunkReader.java b/core/src/main/java/org/apache/carbondata/core/carbon/datastore/chunk/reader/dimension/AbstractChunkReader.java
index ced33fe..cfe7079 100644
--- a/core/src/main/java/org/apache/carbondata/core/carbon/datastore/chunk/reader/dimension/AbstractChunkReader.java
+++ b/core/src/main/java/org/apache/carbondata/core/carbon/datastore/chunk/reader/dimension/AbstractChunkReader.java
@@ -25,7 +25,7 @@ import java.util.List;
 import org.apache.carbondata.core.carbon.datastore.chunk.reader.DimensionColumnChunkReader;
 import org.apache.carbondata.core.constants.CarbonCommonConstants;
 import org.apache.carbondata.core.datastorage.store.compression.Compressor;
-import org.apache.carbondata.core.datastorage.store.compression.SnappyCompression;
+import org.apache.carbondata.core.datastorage.store.compression.CompressorFactory;
 import org.apache.carbondata.core.keygenerator.mdkey.NumberCompressor;
 import org.apache.carbondata.core.util.CarbonProperties;
 
@@ -38,8 +38,7 @@ public abstract class AbstractChunkReader implements DimensionColumnChunkReader
   /**
    * compressor will be used to uncompress the data
    */
-  protected static final Compressor<byte[]> COMPRESSOR =
-      SnappyCompression.SnappyByteCompression.INSTANCE;
+  protected static final Compressor compressor = CompressorFactory.getInstance();
 
   /**
    * size of the each column value

http://git-wip-us.apache.org/repos/asf/incubator-carbondata/blob/25b4ba2c/core/src/main/java/org/apache/carbondata/core/carbon/datastore/chunk/reader/dimension/v1/CompressedDimensionChunkFileBasedReaderV1.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/carbondata/core/carbon/datastore/chunk/reader/dimension/v1/CompressedDimensionChunkFileBasedReaderV1.java b/core/src/main/java/org/apache/carbondata/core/carbon/datastore/chunk/reader/dimension/v1/CompressedDimensionChunkFileBasedReaderV1.java
index 3ead985..00ad35f 100644
--- a/core/src/main/java/org/apache/carbondata/core/carbon/datastore/chunk/reader/dimension/v1/CompressedDimensionChunkFileBasedReaderV1.java
+++ b/core/src/main/java/org/apache/carbondata/core/carbon/datastore/chunk/reader/dimension/v1/CompressedDimensionChunkFileBasedReaderV1.java
@@ -92,7 +92,7 @@ public class CompressedDimensionChunkFileBasedReaderV1 extends AbstractChunkRead
     int[] rlePage = null;
 
     // first read the data and uncompressed it
-    dataPage = COMPRESSOR.unCompress(fileReader
+    dataPage = compressor.unCompressByte(fileReader
         .readByteArray(filePath, dimensionColumnChunk.get(blockIndex).getDataPageOffset(),
             dimensionColumnChunk.get(blockIndex).getDataPageLength()));
     // if row id block is present then read the row id chunk and uncompress it

http://git-wip-us.apache.org/repos/asf/incubator-carbondata/blob/25b4ba2c/core/src/main/java/org/apache/carbondata/core/carbon/datastore/chunk/reader/dimension/v2/CompressedDimensionChunkFileBasedReaderV2.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/carbondata/core/carbon/datastore/chunk/reader/dimension/v2/CompressedDimensionChunkFileBasedReaderV2.java b/core/src/main/java/org/apache/carbondata/core/carbon/datastore/chunk/reader/dimension/v2/CompressedDimensionChunkFileBasedReaderV2.java
index af83514..810fe08 100644
--- a/core/src/main/java/org/apache/carbondata/core/carbon/datastore/chunk/reader/dimension/v2/CompressedDimensionChunkFileBasedReaderV2.java
+++ b/core/src/main/java/org/apache/carbondata/core/carbon/datastore/chunk/reader/dimension/v2/CompressedDimensionChunkFileBasedReaderV2.java
@@ -29,6 +29,7 @@ import org.apache.carbondata.core.carbon.datastore.chunk.reader.dimension.Abstra
 import org.apache.carbondata.core.carbon.metadata.blocklet.BlockletInfo;
 import org.apache.carbondata.core.datastorage.store.FileHolder;
 import org.apache.carbondata.core.datastorage.store.columnar.UnBlockIndexer;
+import org.apache.carbondata.core.datastorage.store.compression.CompressorFactory;
 import org.apache.carbondata.core.util.CarbonUtil;
 import org.apache.carbondata.format.DataChunk2;
 import org.apache.carbondata.format.Encoding;
@@ -156,7 +157,7 @@ public class CompressedDimensionChunkFileBasedReaderV2 extends AbstractChunkRead
         dimensionColumnChunk.data_page_length);
     copySourcePoint += dimensionColumnChunk.data_page_length;
     // first read the data and uncompressed it
-    dataPage = COMPRESSOR.unCompress(compressedDataPage);
+    dataPage = CompressorFactory.getInstance().unCompressByte(compressedDataPage);
     // if row id block is present then read the row id chunk and uncompress it
     if (hasEncoding(dimensionColumnChunk.encoders, Encoding.INVERTED_INDEX)) {
       byte[] compressedIndexPage = new byte[dimensionColumnChunk.rowid_page_length];
@@ -243,7 +244,7 @@ public class CompressedDimensionChunkFileBasedReaderV2 extends AbstractChunkRead
           dimensionColumnChunk.data_page_length);
       copySourcePoint += dimensionColumnChunk.data_page_length;
       // first read the data and uncompressed it
-      dataPage = COMPRESSOR.unCompress(compressedDataPage);
+      dataPage = CompressorFactory.getInstance().unCompressByte(compressedDataPage);
       // if row id block is present then read the row id chunk and uncompress it
       if (hasEncoding(dimensionColumnChunk.encoders, Encoding.INVERTED_INDEX)) {
         byte[] compressedIndexPage = new byte[dimensionColumnChunk.rowid_page_length];

http://git-wip-us.apache.org/repos/asf/incubator-carbondata/blob/25b4ba2c/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 d989852..c1204f2 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
@@ -88,8 +88,8 @@ public class CompressedMeasureChunkFileBasedReaderV1 extends AbstractMeasureChun
     // create a new uncompressor
     // read data from file and set to uncompressor
     // read data from file and set to uncompressor
-    values.setValue(fileReader
-        .readByteArray(filePath, measureColumnChunks.get(blockIndex).getDataPageOffset(),
+    values.setValue(
+        fileReader.readByteArray(filePath, measureColumnChunks.get(blockIndex).getDataPageOffset(),
             measureColumnChunks.get(blockIndex).getDataPageLength()));
     // get the data holder after uncompressing
     CarbonReadDataHolder measureDataHolder =

http://git-wip-us.apache.org/repos/asf/incubator-carbondata/blob/25b4ba2c/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 71b7c8f..d053005 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
@@ -27,7 +27,7 @@ import org.apache.carbondata.core.carbon.datastore.chunk.reader.measure.Abstract
 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.SnappyCompression.SnappyByteCompression;
+import org.apache.carbondata.core.datastorage.store.compression.CompressorFactory;
 import org.apache.carbondata.core.datastorage.store.compression.ValueCompressionModel;
 import org.apache.carbondata.core.datastorage.store.compression.ValueCompressonHolder.UnCompressValue;
 import org.apache.carbondata.core.datastorage.store.dataholder.CarbonReadDataHolder;
@@ -74,8 +74,9 @@ public class CompressedMeasureChunkFileBasedReaderV2 extends AbstractMeasureChun
       org.apache.carbondata.format.PresenceMeta presentMetadataThrift) {
     PresenceMeta presenceMeta = new PresenceMeta();
     presenceMeta.setRepresentNullValues(presentMetadataThrift.isRepresents_presence());
-    presenceMeta.setBitSet(BitSet.valueOf(
-        SnappyByteCompression.INSTANCE.unCompress(presentMetadataThrift.getPresent_bit_stream())));
+    presenceMeta.setBitSet(
+        BitSet.valueOf(CompressorFactory.getInstance().unCompressByte(
+            presentMetadataThrift.getPresent_bit_stream())));
     return presenceMeta;
   }
 

http://git-wip-us.apache.org/repos/asf/incubator-carbondata/blob/25b4ba2c/core/src/main/java/org/apache/carbondata/core/constants/CarbonCommonConstants.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/carbondata/core/constants/CarbonCommonConstants.java b/core/src/main/java/org/apache/carbondata/core/constants/CarbonCommonConstants.java
index 29dbbd8..8257756 100644
--- a/core/src/main/java/org/apache/carbondata/core/constants/CarbonCommonConstants.java
+++ b/core/src/main/java/org/apache/carbondata/core/constants/CarbonCommonConstants.java
@@ -485,6 +485,17 @@ public final class CarbonCommonConstants {
    */
   public static final String MAX_TIMEOUT_FOR_LOAD_METADATA_LOCK =
       "carbon.load.metadata.lock.retry.timeout.sec";
+
+  /**
+   * compressor for writing/reading carbondata file
+   */
+  public static final String COMPRESSOR = "carbon.column.compressor";
+
+  /**
+   * default compressor is snappy
+   */
+  public static final String DEFAULT_COMPRESSOR = "snappy";
+
   /**
    * MARKED_FOR_DELETION
    */

http://git-wip-us.apache.org/repos/asf/incubator-carbondata/blob/25b4ba2c/core/src/main/java/org/apache/carbondata/core/datastorage/store/compression/Compressor.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/carbondata/core/datastorage/store/compression/Compressor.java b/core/src/main/java/org/apache/carbondata/core/datastorage/store/compression/Compressor.java
index 67d4cc1..a3d922d 100644
--- a/core/src/main/java/org/apache/carbondata/core/datastorage/store/compression/Compressor.java
+++ b/core/src/main/java/org/apache/carbondata/core/datastorage/store/compression/Compressor.java
@@ -19,10 +19,30 @@
 
 package org.apache.carbondata.core.datastorage.store.compression;
 
-public interface Compressor<T> {
+public interface Compressor {
 
-  byte[] compress(T input);
+  byte[] compressByte(byte[] unCompInput);
 
-  T unCompress(byte[] input);
+  byte[] unCompressByte(byte[] compInput);
+
+  byte[] compressShort(short[] unCompInput);
+
+  short[] unCompressShort(byte[] compInput);
+
+  byte[] compressInt(int[] unCompInput);
+
+  int[] unCompressInt(byte[] compInput);
+
+  byte[] compressLong(long[] unCompInput);
+
+  long[] unCompressLong(byte[] compInput);
+
+  byte[] compressFloat(float[] unCompInput);
+
+  float[] unCompressFloat(byte[] compInput);
+
+  byte[] compressDouble(double[] unCompInput);
+
+  double[] unCompressDouble(byte[] compInput);
 
 }

http://git-wip-us.apache.org/repos/asf/incubator-carbondata/blob/25b4ba2c/core/src/main/java/org/apache/carbondata/core/datastorage/store/compression/CompressorFactory.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/carbondata/core/datastorage/store/compression/CompressorFactory.java b/core/src/main/java/org/apache/carbondata/core/datastorage/store/compression/CompressorFactory.java
new file mode 100644
index 0000000..110010f
--- /dev/null
+++ b/core/src/main/java/org/apache/carbondata/core/datastorage/store/compression/CompressorFactory.java
@@ -0,0 +1,42 @@
+/*
+ * 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 org.apache.carbondata.core.constants.CarbonCommonConstants;
+import org.apache.carbondata.core.util.CarbonProperties;
+
+public class CompressorFactory {
+
+  private static Compressor snappy;
+
+  public static Compressor getInstance() {
+    String compressor = CarbonProperties.getInstance().getProperty(CarbonCommonConstants.COMPRESSOR,
+        CarbonCommonConstants.DEFAULT_COMPRESSOR);
+    switch (compressor) {
+      case "snappy":
+        if (snappy == null) {
+          snappy = new SnappyCompressor();
+        }
+        return snappy;
+      default:
+        throw new RuntimeException("Unsupported compressor: " + compressor);
+    }
+  }
+}

http://git-wip-us.apache.org/repos/asf/incubator-carbondata/blob/25b4ba2c/core/src/main/java/org/apache/carbondata/core/datastorage/store/compression/SnappyCompression.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/carbondata/core/datastorage/store/compression/SnappyCompression.java b/core/src/main/java/org/apache/carbondata/core/datastorage/store/compression/SnappyCompression.java
deleted file mode 100644
index 31717a9..0000000
--- a/core/src/main/java/org/apache/carbondata/core/datastorage/store/compression/SnappyCompression.java
+++ /dev/null
@@ -1,273 +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.io.IOException;
-
-import org.apache.carbondata.common.logging.LogService;
-import org.apache.carbondata.common.logging.LogServiceFactory;
-
-import org.xerial.snappy.Snappy;
-
-public class SnappyCompression {
-  /**
-   * Attribute for Carbon LOGGER
-   */
-  private static final LogService LOGGER =
-      LogServiceFactory.getLogService(SnappyCompression.class.getName());
-
-  /**
-   * SnappyByteCompression.
-   */
-  public static enum SnappyByteCompression implements Compressor<byte[]> {
-    /**
-     *
-     */
-    INSTANCE;
-
-    /**
-     * wrapper method for compressing byte[] unCompInput.
-     */
-    public byte[] compress(byte[] unCompInput) {
-      try {
-        return Snappy.rawCompress(unCompInput, unCompInput.length);
-      } catch (IOException e) {
-        LOGGER.error(e, e.getMessage());
-        return null;
-      }
-    }
-
-    /**
-     * wrapper method for unCompress byte[] compInput.
-     *
-     * @return byte[].
-     */
-    public byte[] unCompress(byte[] compInput) {
-      try {
-        return Snappy.uncompress(compInput);
-      } catch (IOException e) {
-        LOGGER.error(e, e.getMessage());
-      }
-      return compInput;
-    }
-  }
-
-  /**
-   * enum class for SnappyDoubleCompression.
-   */
-  public static enum SnappyDoubleCompression implements Compressor<double[]> {
-    /**
-     *
-     */
-    INSTANCE;
-
-    /**
-     * wrapper method for compressing double[] unCompInput.
-     */
-    public byte[] compress(double[] unCompInput) {
-      try {
-        return Snappy.compress(unCompInput);
-      } catch (IOException e) {
-        LOGGER.error(e, e.getMessage());
-        return null;
-      }
-    }
-
-    /**
-     * wrapper method for unCompress byte[] compInput.
-     *
-     * @param compInput byte[].
-     * @return double[].
-     */
-    public double[] unCompress(byte[] compInput) {
-      try {
-        return Snappy.uncompressDoubleArray(compInput);
-      } catch (IOException e) {
-        LOGGER.error(e, e.getMessage());
-      }
-      return null;
-    }
-
-  }
-
-  /**
-   * enum class for SnappyShortCompression.
-   *
-   * @author S71955
-   */
-  public static enum SnappyShortCompression implements Compressor<short[]> {
-    /**
-     *
-     */
-    INSTANCE;
-
-    /**
-     * wrapper method for compress short[] unCompInput.
-     *
-     * @param unCompInput short[].
-     * @return byte[].
-     */
-    public byte[] compress(short[] unCompInput) {
-      try {
-        return Snappy.compress(unCompInput);
-      } catch (IOException e) {
-        LOGGER.error(e, e.getMessage());
-        return null;
-      }
-    }
-
-    /**
-     * wrapper method for uncompressShortArray.
-     *
-     * @param compInput byte[].
-     * @return short[].
-     */
-    public short[] unCompress(byte[] compInput) {
-      try {
-        return Snappy.uncompressShortArray(compInput);
-      } catch (IOException e) {
-        LOGGER.error(e, e.getMessage());
-      }
-      return null;
-    }
-  }
-
-  /**
-   * enum class for SnappyIntCompression.
-   */
-  public static enum SnappyIntCompression implements Compressor<int[]> {
-    /**
-     *
-     */
-    INSTANCE;
-
-    /**
-     * wrapper method for compress int[] unCompInput.
-     *
-     * @param unCompInput int[].
-     * @return byte[].
-     */
-    public byte[] compress(int[] unCompInput) {
-      try {
-        return Snappy.compress(unCompInput);
-      } catch (IOException e) {
-        LOGGER.error(e, e.getMessage());
-        return null;
-      }
-    }
-
-    /**
-     * wrapper method for uncompressIntArray.
-     *
-     * @param compInput byte[].
-     * @return int[].
-     */
-    public int[] unCompress(byte[] compInput) {
-      try {
-        return Snappy.uncompressIntArray(compInput);
-      } catch (IOException e) {
-        LOGGER.error(e, e.getMessage());
-      }
-      return null;
-    }
-  }
-
-  /**
-   * enum class for SnappyLongCompression.
-   */
-  public static enum SnappyLongCompression implements Compressor<long[]> {
-    /**
-     *
-     */
-    INSTANCE;
-
-    /**
-     * wrapper method for compress long[] unCompInput.
-     *
-     * @param unCompInput long[].
-     * @return byte[].
-     */
-    public byte[] compress(long[] unCompInput) {
-      try {
-        return Snappy.compress(unCompInput);
-      } catch (IOException e) {
-        LOGGER.error(e, e.getMessage());
-        return null;
-      }
-    }
-
-    /**
-     * wrapper method for uncompressLongArray.
-     *
-     * @param compInput byte[].
-     * @return long[].
-     */
-    public long[] unCompress(byte[] compInput) {
-      try {
-        return Snappy.uncompressLongArray(compInput);
-      } catch (IOException e) {
-        LOGGER.error(e, e.getMessage());
-      }
-      return null;
-    }
-  }
-
-  /**
-   * enum class for SnappyFloatCompression.
-   */
-
-  public static enum SnappyFloatCompression implements Compressor<float[]> {
-    /**
-     *
-     */
-    INSTANCE;
-
-    /**
-     * wrapper method for compress float[] unCompInput.
-     *
-     * @param unCompInput float[].
-     * @return byte[].
-     */
-    public byte[] compress(float[] unCompInput) {
-      try {
-        return Snappy.compress(unCompInput);
-      } catch (IOException e) {
-        LOGGER.error(e, e.getMessage());
-        return null;
-      }
-    }
-
-    /**
-     * wrapper method for uncompressFloatArray.
-     *
-     * @param compInput byte[].
-     * @return float[].
-     */
-    public float[] unCompress(byte[] compInput) {
-      try {
-        return Snappy.uncompressFloatArray(compInput);
-      } catch (IOException e) {
-        LOGGER.error(e, e.getMessage());
-      }
-      return null;
-    }
-  }
-
-}

http://git-wip-us.apache.org/repos/asf/incubator-carbondata/blob/25b4ba2c/core/src/main/java/org/apache/carbondata/core/datastorage/store/compression/SnappyCompressor.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/carbondata/core/datastorage/store/compression/SnappyCompressor.java b/core/src/main/java/org/apache/carbondata/core/datastorage/store/compression/SnappyCompressor.java
new file mode 100644
index 0000000..d9b627f
--- /dev/null
+++ b/core/src/main/java/org/apache/carbondata/core/datastorage/store/compression/SnappyCompressor.java
@@ -0,0 +1,153 @@
+/*
+ * 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.io.IOException;
+
+import org.apache.carbondata.common.logging.LogService;
+import org.apache.carbondata.common.logging.LogServiceFactory;
+
+import org.xerial.snappy.Snappy;
+
+public class SnappyCompressor implements Compressor {
+
+  private static final LogService LOGGER =
+      LogServiceFactory.getLogService(SnappyCompressor.class.getName());
+
+  @Override
+  public byte[] compressByte(byte[] unCompInput) {
+    try {
+      return Snappy.rawCompress(unCompInput, unCompInput.length);
+    } catch (IOException e) {
+      LOGGER.error(e, e.getMessage());
+      return null;
+    }
+  }
+
+  @Override
+  public byte[] unCompressByte(byte[] compInput) {
+    try {
+      return Snappy.uncompress(compInput);
+    } catch (IOException e) {
+      LOGGER.error(e, e.getMessage());
+    }
+    return compInput;
+  }
+
+  @Override
+  public byte[] compressShort(short[] unCompInput) {
+    try {
+      return Snappy.compress(unCompInput);
+    } catch (IOException e) {
+      LOGGER.error(e, e.getMessage());
+      return null;
+    }
+  }
+
+  @Override
+  public short[] unCompressShort(byte[] compInput) {
+    try {
+      return Snappy.uncompressShortArray(compInput);
+    } catch (IOException e) {
+      LOGGER.error(e, e.getMessage());
+    }
+    return null;
+  }
+
+  @Override
+  public byte[] compressInt(int[] unCompInput) {
+    try {
+      return Snappy.compress(unCompInput);
+    } catch (IOException e) {
+      LOGGER.error(e, e.getMessage());
+      return null;
+    }
+  }
+
+  @Override
+  public int[] unCompressInt(byte[] compInput) {
+    try {
+      return Snappy.uncompressIntArray(compInput);
+    } catch (IOException e) {
+      LOGGER.error(e, e.getMessage());
+    }
+    return null;
+  }
+
+  @Override
+  public byte[] compressLong(long[] unCompInput) {
+    try {
+      return Snappy.compress(unCompInput);
+    } catch (IOException e) {
+      LOGGER.error(e, e.getMessage());
+      return null;
+    }
+  }
+
+  @Override
+  public long[] unCompressLong(byte[] compInput) {
+    try {
+      return Snappy.uncompressLongArray(compInput);
+    } catch (IOException e) {
+      LOGGER.error(e, e.getMessage());
+    }
+    return null;
+  }
+
+  @Override
+  public byte[] compressFloat(float[] unCompInput) {
+    try {
+      return Snappy.compress(unCompInput);
+    } catch (IOException e) {
+      LOGGER.error(e, e.getMessage());
+      return null;
+    }
+  }
+
+  @Override
+  public float[] unCompressFloat(byte[] compInput) {
+    try {
+      return Snappy.uncompressFloatArray(compInput);
+    } catch (IOException e) {
+      LOGGER.error(e, e.getMessage());
+    }
+    return null;
+  }
+
+  @Override
+  public byte[] compressDouble(double[] unCompInput) {
+    try {
+      return Snappy.compress(unCompInput);
+    } catch (IOException e) {
+      LOGGER.error(e, e.getMessage());
+      return null;
+    }
+  }
+
+  @Override
+  public double[] unCompressDouble(byte[] compInput) {
+    try {
+      return Snappy.uncompressDoubleArray(compInput);
+    } catch (IOException e) {
+      LOGGER.error(e, e.getMessage());
+    }
+    return null;
+  }
+}

http://git-wip-us.apache.org/repos/asf/incubator-carbondata/blob/25b4ba2c/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
index 01764ce..18e15f0 100644
--- 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
@@ -30,36 +30,7 @@ public final class ValueCompressonHolder {
   /**
    * byteCompressor.
    */
-  private static Compressor<byte[]> byteCompressor =
-      SnappyCompression.SnappyByteCompression.INSTANCE;
-
-  /**
-   * shortCompressor.
-   */
-  private static Compressor<short[]> shortCompressor =
-      SnappyCompression.SnappyShortCompression.INSTANCE;
-
-  /**
-   * intCompressor.
-   */
-  private static Compressor<int[]> intCompressor = SnappyCompression.SnappyIntCompression.INSTANCE;
-
-  /**
-   * longCompressor.
-   */
-  private static Compressor<long[]> longCompressor =
-      SnappyCompression.SnappyLongCompression.INSTANCE;
-
-  /**
-   * floatCompressor
-   */
-  private static Compressor<float[]> floatCompressor =
-      SnappyCompression.SnappyFloatCompression.INSTANCE;
-  /**
-   * doubleCompressor.
-   */
-  private static Compressor<double[]> doubleCompressor =
-      SnappyCompression.SnappyDoubleCompression.INSTANCE;
+  private static Compressor compressor = CompressorFactory.getInstance();
 
   private ValueCompressonHolder() {
 
@@ -74,32 +45,32 @@ public final class ValueCompressonHolder {
     switch (dataType) {
       case DATA_BYTE:
 
-        value.setValue(byteCompressor.unCompress(data));
+        value.setValue(compressor.unCompressByte(data));
         break;
 
       case DATA_SHORT:
 
-        value.setValue(shortCompressor.unCompress(data));
+        value.setValue(compressor.unCompressShort(data));
         break;
 
       case DATA_INT:
 
-        value.setValue(intCompressor.unCompress(data));
+        value.setValue(compressor.unCompressInt(data));
         break;
 
       case DATA_LONG:
       case DATA_BIGINT:
 
-        value.setValue(longCompressor.unCompress(data));
+        value.setValue(compressor.unCompressLong(data));
         break;
 
       case DATA_FLOAT:
 
-        value.setValue(floatCompressor.unCompress(data));
+        value.setValue(compressor.unCompressFloat(data));
         break;
       default:
 
-        value.setValue(doubleCompressor.unCompress(data));
+        value.setValue(compressor.unCompressDouble(data));
         break;
 
     }

http://git-wip-us.apache.org/repos/asf/incubator-carbondata/blob/25b4ba2c/core/src/main/java/org/apache/carbondata/core/datastorage/store/compression/type/UnCompressByteArray.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/carbondata/core/datastorage/store/compression/type/UnCompressByteArray.java b/core/src/main/java/org/apache/carbondata/core/datastorage/store/compression/type/UnCompressByteArray.java
index b5f7887..5009cd3 100644
--- a/core/src/main/java/org/apache/carbondata/core/datastorage/store/compression/type/UnCompressByteArray.java
+++ b/core/src/main/java/org/apache/carbondata/core/datastorage/store/compression/type/UnCompressByteArray.java
@@ -28,7 +28,7 @@ import org.apache.carbondata.common.logging.LogService;
 import org.apache.carbondata.common.logging.LogServiceFactory;
 import org.apache.carbondata.core.constants.CarbonCommonConstants;
 import org.apache.carbondata.core.datastorage.store.compression.Compressor;
-import org.apache.carbondata.core.datastorage.store.compression.SnappyCompression;
+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.dataholder.CarbonReadDataHolder;
 import org.apache.carbondata.core.util.DataTypeUtil;
@@ -41,10 +41,10 @@ public class UnCompressByteArray implements ValueCompressonHolder.UnCompressValu
   private static final LogService LOGGER =
       LogServiceFactory.getLogService(UnCompressMaxMinByte.class.getName());
   /**
-   * byteCompressor.
+   * compressor.
    */
-  private static Compressor<byte[]> byteCompressor =
-      SnappyCompression.SnappyByteCompression.INSTANCE;
+  private static Compressor compressor = CompressorFactory.getInstance();
+
   private ByteArrayType arrayType;
   /**
    * value.
@@ -81,14 +81,14 @@ public class UnCompressByteArray implements ValueCompressonHolder.UnCompressValu
 
   @Override public ValueCompressonHolder.UnCompressValue compress() {
     UnCompressByteArray byte1 = new UnCompressByteArray(arrayType);
-    byte1.setValue(byteCompressor.compress(value));
+    byte1.setValue(compressor.compressByte(value));
     return byte1;
   }
 
   @Override
   public ValueCompressonHolder.UnCompressValue uncompress(ValueCompressionUtil.DataType dataType) {
     ValueCompressonHolder.UnCompressValue byte1 = new UnCompressByteArray(arrayType);
-    byte1.setValue(byteCompressor.unCompress(value));
+    byte1.setValue(compressor.unCompressByte(value));
     return byte1;
   }
 

http://git-wip-us.apache.org/repos/asf/incubator-carbondata/blob/25b4ba2c/core/src/main/java/org/apache/carbondata/core/datastorage/store/compression/type/UnCompressMaxMinByte.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/carbondata/core/datastorage/store/compression/type/UnCompressMaxMinByte.java b/core/src/main/java/org/apache/carbondata/core/datastorage/store/compression/type/UnCompressMaxMinByte.java
index db7f085..e6baf91 100644
--- a/core/src/main/java/org/apache/carbondata/core/datastorage/store/compression/type/UnCompressMaxMinByte.java
+++ b/core/src/main/java/org/apache/carbondata/core/datastorage/store/compression/type/UnCompressMaxMinByte.java
@@ -22,7 +22,7 @@ package org.apache.carbondata.core.datastorage.store.compression.type;
 import org.apache.carbondata.common.logging.LogService;
 import org.apache.carbondata.common.logging.LogServiceFactory;
 import org.apache.carbondata.core.datastorage.store.compression.Compressor;
-import org.apache.carbondata.core.datastorage.store.compression.SnappyCompression;
+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.datastorage.store.dataholder.CarbonReadDataHolder;
@@ -37,10 +37,9 @@ public class UnCompressMaxMinByte implements UnCompressValue<byte[]> {
   private static final LogService LOGGER =
       LogServiceFactory.getLogService(UnCompressMaxMinByte.class.getName());
   /**
-   * byteCompressor.
+   * compressor.
    */
-  private static Compressor<byte[]> byteCompressor =
-      SnappyCompression.SnappyByteCompression.INSTANCE;
+  private static Compressor compressor = CompressorFactory.getInstance();
   /**
    * value.
    */
@@ -72,9 +71,8 @@ public class UnCompressMaxMinByte implements UnCompressValue<byte[]> {
   }
 
   @Override public UnCompressValue compress() {
-
     UnCompressMaxMinByte byte1 = new UnCompressMaxMinByte(actualDataType);
-    byte1.setValue(byteCompressor.compress(value));
+    byte1.setValue(compressor.compressByte(value));
     return byte1;
   }
 

http://git-wip-us.apache.org/repos/asf/incubator-carbondata/blob/25b4ba2c/core/src/main/java/org/apache/carbondata/core/datastorage/store/compression/type/UnCompressMaxMinByteForLong.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/carbondata/core/datastorage/store/compression/type/UnCompressMaxMinByteForLong.java b/core/src/main/java/org/apache/carbondata/core/datastorage/store/compression/type/UnCompressMaxMinByteForLong.java
index b5d42b3..d38c49a 100644
--- a/core/src/main/java/org/apache/carbondata/core/datastorage/store/compression/type/UnCompressMaxMinByteForLong.java
+++ b/core/src/main/java/org/apache/carbondata/core/datastorage/store/compression/type/UnCompressMaxMinByteForLong.java
@@ -21,7 +21,7 @@ package org.apache.carbondata.core.datastorage.store.compression.type;
 import org.apache.carbondata.common.logging.LogService;
 import org.apache.carbondata.common.logging.LogServiceFactory;
 import org.apache.carbondata.core.datastorage.store.compression.Compressor;
-import org.apache.carbondata.core.datastorage.store.compression.SnappyCompression;
+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.dataholder.CarbonReadDataHolder;
 import org.apache.carbondata.core.util.ValueCompressionUtil;
@@ -31,8 +31,7 @@ public class UnCompressMaxMinByteForLong extends UnCompressMaxMinByte {
 
   private static final LogService LOGGER =
       LogServiceFactory.getLogService(UnCompressMaxMinByteForLong.class.getName());
-  private static Compressor<byte[]> byteCompressor =
-      SnappyCompression.SnappyByteCompression.INSTANCE;
+  private static Compressor compressor = CompressorFactory.getInstance();
 
   public UnCompressMaxMinByteForLong(DataType actualDataType) {
     super(actualDataType);
@@ -47,9 +46,8 @@ public class UnCompressMaxMinByteForLong extends UnCompressMaxMinByte {
   }
 
   @Override public ValueCompressonHolder.UnCompressValue compress() {
-
     UnCompressMaxMinByteForLong byte1 = new UnCompressMaxMinByteForLong(actualDataType);
-    byte1.setValue(byteCompressor.compress(value));
+    byte1.setValue(compressor.compressByte(value));
     return byte1;
   }
 

http://git-wip-us.apache.org/repos/asf/incubator-carbondata/blob/25b4ba2c/core/src/main/java/org/apache/carbondata/core/datastorage/store/compression/type/UnCompressMaxMinDefault.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/carbondata/core/datastorage/store/compression/type/UnCompressMaxMinDefault.java b/core/src/main/java/org/apache/carbondata/core/datastorage/store/compression/type/UnCompressMaxMinDefault.java
index dea9858..f076221 100644
--- a/core/src/main/java/org/apache/carbondata/core/datastorage/store/compression/type/UnCompressMaxMinDefault.java
+++ b/core/src/main/java/org/apache/carbondata/core/datastorage/store/compression/type/UnCompressMaxMinDefault.java
@@ -24,7 +24,7 @@ import java.nio.ByteBuffer;
 import org.apache.carbondata.common.logging.LogService;
 import org.apache.carbondata.common.logging.LogServiceFactory;
 import org.apache.carbondata.core.datastorage.store.compression.Compressor;
-import org.apache.carbondata.core.datastorage.store.compression.SnappyCompression;
+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.dataholder.CarbonReadDataHolder;
 import org.apache.carbondata.core.util.ValueCompressionUtil;
@@ -39,10 +39,9 @@ public class UnCompressMaxMinDefault implements ValueCompressonHolder.UnCompress
       LogServiceFactory.getLogService(UnCompressMaxMinDefault.class.getName());
 
   /**
-   * doubleCompressor.
+   * compressor.
    */
-  private static Compressor<double[]> doubleCompressor =
-      SnappyCompression.SnappyDoubleCompression.INSTANCE;
+  private static Compressor compressor = CompressorFactory.getInstance();
   /**
    * value.
    */
@@ -73,7 +72,7 @@ public class UnCompressMaxMinDefault implements ValueCompressonHolder.UnCompress
 
   @Override public ValueCompressonHolder.UnCompressValue compress() {
     UnCompressMaxMinByte byte1 = new UnCompressMaxMinByte(actualDataType);
-    byte1.setValue(doubleCompressor.compress(value));
+    byte1.setValue(compressor.compressDouble(value));
     return byte1;
   }
 

http://git-wip-us.apache.org/repos/asf/incubator-carbondata/blob/25b4ba2c/core/src/main/java/org/apache/carbondata/core/datastorage/store/compression/type/UnCompressMaxMinDefaultLong.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/carbondata/core/datastorage/store/compression/type/UnCompressMaxMinDefaultLong.java b/core/src/main/java/org/apache/carbondata/core/datastorage/store/compression/type/UnCompressMaxMinDefaultLong.java
index 376b487..0528ecb 100644
--- a/core/src/main/java/org/apache/carbondata/core/datastorage/store/compression/type/UnCompressMaxMinDefaultLong.java
+++ b/core/src/main/java/org/apache/carbondata/core/datastorage/store/compression/type/UnCompressMaxMinDefaultLong.java
@@ -21,7 +21,7 @@ package org.apache.carbondata.core.datastorage.store.compression.type;
 import org.apache.carbondata.common.logging.LogService;
 import org.apache.carbondata.common.logging.LogServiceFactory;
 import org.apache.carbondata.core.datastorage.store.compression.Compressor;
-import org.apache.carbondata.core.datastorage.store.compression.SnappyCompression;
+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.dataholder.CarbonReadDataHolder;
 import org.apache.carbondata.core.util.ValueCompressionUtil;
@@ -31,8 +31,7 @@ public class UnCompressMaxMinDefaultLong extends UnCompressMaxMinLong {
 
   private static final LogService LOGGER =
       LogServiceFactory.getLogService(UnCompressMaxMinDefaultLong.class.getName());
-  private static Compressor<long[]> longCompressor =
-      SnappyCompression.SnappyLongCompression.INSTANCE;
+  private static Compressor compressor = CompressorFactory.getInstance();
 
   public UnCompressMaxMinDefaultLong(DataType actualDataType) {
     super(actualDataType);
@@ -49,7 +48,7 @@ public class UnCompressMaxMinDefaultLong extends UnCompressMaxMinLong {
 
   @Override public ValueCompressonHolder.UnCompressValue compress() {
     UnCompressMaxMinByteForLong byte1 = new UnCompressMaxMinByteForLong(actualDataType);
-    byte1.setValue(longCompressor.compress(value));
+    byte1.setValue(compressor.compressLong(value));
     return byte1;
   }
 

http://git-wip-us.apache.org/repos/asf/incubator-carbondata/blob/25b4ba2c/core/src/main/java/org/apache/carbondata/core/datastorage/store/compression/type/UnCompressMaxMinFloat.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/carbondata/core/datastorage/store/compression/type/UnCompressMaxMinFloat.java b/core/src/main/java/org/apache/carbondata/core/datastorage/store/compression/type/UnCompressMaxMinFloat.java
index 0958069..2512afb 100644
--- a/core/src/main/java/org/apache/carbondata/core/datastorage/store/compression/type/UnCompressMaxMinFloat.java
+++ b/core/src/main/java/org/apache/carbondata/core/datastorage/store/compression/type/UnCompressMaxMinFloat.java
@@ -24,7 +24,7 @@ import java.nio.ByteBuffer;
 import org.apache.carbondata.common.logging.LogService;
 import org.apache.carbondata.common.logging.LogServiceFactory;
 import org.apache.carbondata.core.datastorage.store.compression.Compressor;
-import org.apache.carbondata.core.datastorage.store.compression.SnappyCompression;
+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.dataholder.CarbonReadDataHolder;
 import org.apache.carbondata.core.util.ValueCompressionUtil;
@@ -40,8 +40,7 @@ public class UnCompressMaxMinFloat implements UnCompressValue<float[]> {
   /**
    * floatCompressor
    */
-  private static Compressor<float[]> floatCompressor =
-      SnappyCompression.SnappyFloatCompression.INSTANCE;
+  private static Compressor compressor = CompressorFactory.getInstance();
   /**
    * value.
    */
@@ -68,9 +67,8 @@ public class UnCompressMaxMinFloat implements UnCompressValue<float[]> {
   }
 
   @Override public UnCompressValue compress() {
-
     UnCompressMaxMinByte byte1 = new UnCompressMaxMinByte(actualDataType);
-    byte1.setValue(floatCompressor.compress(value));
+    byte1.setValue(compressor.compressFloat(value));
     return byte1;
   }
 
@@ -87,9 +85,6 @@ public class UnCompressMaxMinFloat implements UnCompressValue<float[]> {
     this.value = ValueCompressionUtil.convertToFloatArray(buffer, value.length);
   }
 
-  /**
-   * @see ValueCompressonHolder.UnCompressValue#getCompressorObject()
-   */
   @Override public UnCompressValue getCompressorObject() {
     return new UnCompressMaxMinByte(actualDataType);
   }

http://git-wip-us.apache.org/repos/asf/incubator-carbondata/blob/25b4ba2c/core/src/main/java/org/apache/carbondata/core/datastorage/store/compression/type/UnCompressMaxMinInt.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/carbondata/core/datastorage/store/compression/type/UnCompressMaxMinInt.java b/core/src/main/java/org/apache/carbondata/core/datastorage/store/compression/type/UnCompressMaxMinInt.java
index c25f75b..126d8b6 100644
--- a/core/src/main/java/org/apache/carbondata/core/datastorage/store/compression/type/UnCompressMaxMinInt.java
+++ b/core/src/main/java/org/apache/carbondata/core/datastorage/store/compression/type/UnCompressMaxMinInt.java
@@ -24,7 +24,7 @@ import java.nio.ByteBuffer;
 import org.apache.carbondata.common.logging.LogService;
 import org.apache.carbondata.common.logging.LogServiceFactory;
 import org.apache.carbondata.core.datastorage.store.compression.Compressor;
-import org.apache.carbondata.core.datastorage.store.compression.SnappyCompression;
+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.dataholder.CarbonReadDataHolder;
 import org.apache.carbondata.core.util.ValueCompressionUtil;
@@ -38,9 +38,9 @@ public class UnCompressMaxMinInt implements ValueCompressonHolder.UnCompressValu
       LogServiceFactory.getLogService(UnCompressMaxMinInt.class.getName());
 
   /**
-   * intCompressor.
+   * compressor.
    */
-  private static Compressor<int[]> intCompressor = SnappyCompression.SnappyIntCompression.INSTANCE;
+  private static Compressor compressor = CompressorFactory.getInstance();
   /**
    * value.
    */
@@ -68,7 +68,7 @@ public class UnCompressMaxMinInt implements ValueCompressonHolder.UnCompressValu
 
   @Override public ValueCompressonHolder.UnCompressValue compress() {
     UnCompressMaxMinByte byte1 = new UnCompressMaxMinByte(actualDataType);
-    byte1.setValue(intCompressor.compress(value));
+    byte1.setValue(compressor.compressInt(value));
     return byte1;
   }
 

http://git-wip-us.apache.org/repos/asf/incubator-carbondata/blob/25b4ba2c/core/src/main/java/org/apache/carbondata/core/datastorage/store/compression/type/UnCompressMaxMinLong.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/carbondata/core/datastorage/store/compression/type/UnCompressMaxMinLong.java b/core/src/main/java/org/apache/carbondata/core/datastorage/store/compression/type/UnCompressMaxMinLong.java
index 0dc1c5b..13034c2 100644
--- a/core/src/main/java/org/apache/carbondata/core/datastorage/store/compression/type/UnCompressMaxMinLong.java
+++ b/core/src/main/java/org/apache/carbondata/core/datastorage/store/compression/type/UnCompressMaxMinLong.java
@@ -24,7 +24,7 @@ import java.nio.ByteBuffer;
 import org.apache.carbondata.common.logging.LogService;
 import org.apache.carbondata.common.logging.LogServiceFactory;
 import org.apache.carbondata.core.datastorage.store.compression.Compressor;
-import org.apache.carbondata.core.datastorage.store.compression.SnappyCompression;
+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.dataholder.CarbonReadDataHolder;
 import org.apache.carbondata.core.util.ValueCompressionUtil;
@@ -37,10 +37,9 @@ public class UnCompressMaxMinLong implements ValueCompressonHolder.UnCompressVal
   private static final LogService LOGGER =
       LogServiceFactory.getLogService(UnCompressMaxMinLong.class.getName());
   /**
-   * longCompressor.
+   * compressor.
    */
-  private static Compressor<long[]> longCompressor =
-      SnappyCompression.SnappyLongCompression.INSTANCE;
+  private static Compressor compressor = CompressorFactory.getInstance();
   /**
    * value.
    */
@@ -63,7 +62,7 @@ public class UnCompressMaxMinLong implements ValueCompressonHolder.UnCompressVal
 
   @Override public ValueCompressonHolder.UnCompressValue compress() {
     UnCompressMaxMinByte unCompressByte = new UnCompressMaxMinByte(actualDataType);
-    unCompressByte.setValue(longCompressor.compress(value));
+    unCompressByte.setValue(compressor.compressLong(value));
     return unCompressByte;
   }
 

http://git-wip-us.apache.org/repos/asf/incubator-carbondata/blob/25b4ba2c/core/src/main/java/org/apache/carbondata/core/datastorage/store/compression/type/UnCompressMaxMinShort.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/carbondata/core/datastorage/store/compression/type/UnCompressMaxMinShort.java b/core/src/main/java/org/apache/carbondata/core/datastorage/store/compression/type/UnCompressMaxMinShort.java
index faca753..fd2af22 100644
--- a/core/src/main/java/org/apache/carbondata/core/datastorage/store/compression/type/UnCompressMaxMinShort.java
+++ b/core/src/main/java/org/apache/carbondata/core/datastorage/store/compression/type/UnCompressMaxMinShort.java
@@ -24,7 +24,7 @@ import java.nio.ByteBuffer;
 import org.apache.carbondata.common.logging.LogService;
 import org.apache.carbondata.common.logging.LogServiceFactory;
 import org.apache.carbondata.core.datastorage.store.compression.Compressor;
-import org.apache.carbondata.core.datastorage.store.compression.SnappyCompression;
+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.dataholder.CarbonReadDataHolder;
 import org.apache.carbondata.core.util.ValueCompressionUtil;
@@ -39,8 +39,7 @@ public class UnCompressMaxMinShort implements ValueCompressonHolder.UnCompressVa
   /**
    * shortCompressor.
    */
-  private static Compressor<short[]> shortCompressor =
-      SnappyCompression.SnappyShortCompression.INSTANCE;
+  private static Compressor compressor = CompressorFactory.getInstance();
   /**
    * value.
    */
@@ -75,9 +74,8 @@ public class UnCompressMaxMinShort implements ValueCompressonHolder.UnCompressVa
   }
 
   @Override public ValueCompressonHolder.UnCompressValue compress() {
-
     UnCompressMaxMinByte byte1 = new UnCompressMaxMinByte(actualDataType);
-    byte1.setValue(shortCompressor.compress(value));
+    byte1.setValue(compressor.compressShort(value));
     return byte1;
   }
 

http://git-wip-us.apache.org/repos/asf/incubator-carbondata/blob/25b4ba2c/core/src/main/java/org/apache/carbondata/core/datastorage/store/compression/type/UnCompressNonDecimalByte.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/carbondata/core/datastorage/store/compression/type/UnCompressNonDecimalByte.java b/core/src/main/java/org/apache/carbondata/core/datastorage/store/compression/type/UnCompressNonDecimalByte.java
index 7a81789..83aae2c 100644
--- a/core/src/main/java/org/apache/carbondata/core/datastorage/store/compression/type/UnCompressNonDecimalByte.java
+++ b/core/src/main/java/org/apache/carbondata/core/datastorage/store/compression/type/UnCompressNonDecimalByte.java
@@ -22,7 +22,7 @@ package org.apache.carbondata.core.datastorage.store.compression.type;
 import org.apache.carbondata.common.logging.LogService;
 import org.apache.carbondata.common.logging.LogServiceFactory;
 import org.apache.carbondata.core.datastorage.store.compression.Compressor;
-import org.apache.carbondata.core.datastorage.store.compression.SnappyCompression;
+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.dataholder.CarbonReadDataHolder;
 import org.apache.carbondata.core.util.ValueCompressionUtil;
@@ -35,10 +35,9 @@ public class UnCompressNonDecimalByte implements ValueCompressonHolder.UnCompres
   private static final LogService LOGGER =
       LogServiceFactory.getLogService(UnCompressNonDecimalByte.class.getName());
   /**
-   * byteCompressor.
+   * compressor.
    */
-  private static Compressor<byte[]> byteCompressor =
-      SnappyCompression.SnappyByteCompression.INSTANCE;
+  private static Compressor compressor = CompressorFactory.getInstance();
   /**
    * value.
    */
@@ -59,7 +58,7 @@ public class UnCompressNonDecimalByte implements ValueCompressonHolder.UnCompres
 
   @Override public ValueCompressonHolder.UnCompressValue compress() {
     UnCompressNonDecimalByte byte1 = new UnCompressNonDecimalByte();
-    byte1.setValue(byteCompressor.compress(value));
+    byte1.setValue(compressor.compressByte(value));
     return byte1;
   }
 

http://git-wip-us.apache.org/repos/asf/incubator-carbondata/blob/25b4ba2c/core/src/main/java/org/apache/carbondata/core/datastorage/store/compression/type/UnCompressNonDecimalDefault.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/carbondata/core/datastorage/store/compression/type/UnCompressNonDecimalDefault.java b/core/src/main/java/org/apache/carbondata/core/datastorage/store/compression/type/UnCompressNonDecimalDefault.java
index 9146705..3c1f554 100644
--- a/core/src/main/java/org/apache/carbondata/core/datastorage/store/compression/type/UnCompressNonDecimalDefault.java
+++ b/core/src/main/java/org/apache/carbondata/core/datastorage/store/compression/type/UnCompressNonDecimalDefault.java
@@ -24,7 +24,7 @@ import java.nio.ByteBuffer;
 import org.apache.carbondata.common.logging.LogService;
 import org.apache.carbondata.common.logging.LogServiceFactory;
 import org.apache.carbondata.core.datastorage.store.compression.Compressor;
-import org.apache.carbondata.core.datastorage.store.compression.SnappyCompression;
+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.dataholder.CarbonReadDataHolder;
 import org.apache.carbondata.core.util.ValueCompressionUtil;
@@ -40,8 +40,7 @@ public class UnCompressNonDecimalDefault
   /**
    * doubleCompressor.
    */
-  private static Compressor<double[]> doubleCompressor =
-      SnappyCompression.SnappyDoubleCompression.INSTANCE;
+  private static Compressor compressor = CompressorFactory.getInstance();
   /**
    * value.
    */
@@ -58,7 +57,7 @@ public class UnCompressNonDecimalDefault
 
   @Override public ValueCompressonHolder.UnCompressValue compress() {
     UnCompressNonDecimalByte byte1 = new UnCompressNonDecimalByte();
-    byte1.setValue(doubleCompressor.compress(value));
+    byte1.setValue(compressor.compressDouble(value));
     return byte1;
   }
 

http://git-wip-us.apache.org/repos/asf/incubator-carbondata/blob/25b4ba2c/core/src/main/java/org/apache/carbondata/core/datastorage/store/compression/type/UnCompressNonDecimalFloat.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/carbondata/core/datastorage/store/compression/type/UnCompressNonDecimalFloat.java b/core/src/main/java/org/apache/carbondata/core/datastorage/store/compression/type/UnCompressNonDecimalFloat.java
index 487e943..f840f8c 100644
--- a/core/src/main/java/org/apache/carbondata/core/datastorage/store/compression/type/UnCompressNonDecimalFloat.java
+++ b/core/src/main/java/org/apache/carbondata/core/datastorage/store/compression/type/UnCompressNonDecimalFloat.java
@@ -24,7 +24,7 @@ import java.nio.ByteBuffer;
 import org.apache.carbondata.common.logging.LogService;
 import org.apache.carbondata.common.logging.LogServiceFactory;
 import org.apache.carbondata.core.datastorage.store.compression.Compressor;
-import org.apache.carbondata.core.datastorage.store.compression.SnappyCompression;
+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.dataholder.CarbonReadDataHolder;
 import org.apache.carbondata.core.util.ValueCompressionUtil;
@@ -38,8 +38,7 @@ public class UnCompressNonDecimalFloat implements ValueCompressonHolder.UnCompre
   /**
    * floatCompressor
    */
-  private static Compressor<float[]> floatCompressor =
-      SnappyCompression.SnappyFloatCompression.INSTANCE;
+  private static Compressor compressor = CompressorFactory.getInstance();
   /**
    * value.
    */
@@ -67,7 +66,7 @@ public class UnCompressNonDecimalFloat implements ValueCompressonHolder.UnCompre
 
   @Override public ValueCompressonHolder.UnCompressValue compress() {
     UnCompressNonDecimalByte byte1 = new UnCompressNonDecimalByte();
-    byte1.setValue(floatCompressor.compress(value));
+    byte1.setValue(compressor.compressFloat(value));
     return byte1;
   }
 

http://git-wip-us.apache.org/repos/asf/incubator-carbondata/blob/25b4ba2c/core/src/main/java/org/apache/carbondata/core/datastorage/store/compression/type/UnCompressNonDecimalInt.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/carbondata/core/datastorage/store/compression/type/UnCompressNonDecimalInt.java b/core/src/main/java/org/apache/carbondata/core/datastorage/store/compression/type/UnCompressNonDecimalInt.java
index 0e0c2b9..fe06793 100644
--- a/core/src/main/java/org/apache/carbondata/core/datastorage/store/compression/type/UnCompressNonDecimalInt.java
+++ b/core/src/main/java/org/apache/carbondata/core/datastorage/store/compression/type/UnCompressNonDecimalInt.java
@@ -24,7 +24,7 @@ import java.nio.ByteBuffer;
 import org.apache.carbondata.common.logging.LogService;
 import org.apache.carbondata.common.logging.LogServiceFactory;
 import org.apache.carbondata.core.datastorage.store.compression.Compressor;
-import org.apache.carbondata.core.datastorage.store.compression.SnappyCompression;
+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.dataholder.CarbonReadDataHolder;
 import org.apache.carbondata.core.util.ValueCompressionUtil;
@@ -39,7 +39,7 @@ public class UnCompressNonDecimalInt implements UnCompressValue<int[]> {
   /**
    * intCompressor.
    */
-  private static Compressor<int[]> intCompressor = SnappyCompression.SnappyIntCompression.INSTANCE;
+  private static Compressor compressor = CompressorFactory.getInstance();
   /**
    * value.
    */
@@ -61,7 +61,7 @@ public class UnCompressNonDecimalInt implements UnCompressValue<int[]> {
 
   @Override public UnCompressValue compress() {
     UnCompressNonDecimalByte byte1 = new UnCompressNonDecimalByte();
-    byte1.setValue(intCompressor.compress(value));
+    byte1.setValue(compressor.compressInt(value));
     return byte1;
   }
 
@@ -74,9 +74,6 @@ public class UnCompressNonDecimalInt implements UnCompressValue<int[]> {
     this.value = ValueCompressionUtil.convertToIntArray(buffer, bytesArr.length);
   }
 
-  /**
-   * @see ValueCompressonHolder.UnCompressValue#getCompressorObject()
-   */
   @Override public UnCompressValue getCompressorObject() {
     return new UnCompressNonDecimalByte();
   }

http://git-wip-us.apache.org/repos/asf/incubator-carbondata/blob/25b4ba2c/core/src/main/java/org/apache/carbondata/core/datastorage/store/compression/type/UnCompressNonDecimalLong.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/carbondata/core/datastorage/store/compression/type/UnCompressNonDecimalLong.java b/core/src/main/java/org/apache/carbondata/core/datastorage/store/compression/type/UnCompressNonDecimalLong.java
index 3fb817e..cdd44b0 100644
--- a/core/src/main/java/org/apache/carbondata/core/datastorage/store/compression/type/UnCompressNonDecimalLong.java
+++ b/core/src/main/java/org/apache/carbondata/core/datastorage/store/compression/type/UnCompressNonDecimalLong.java
@@ -24,7 +24,7 @@ import java.nio.ByteBuffer;
 import org.apache.carbondata.common.logging.LogService;
 import org.apache.carbondata.common.logging.LogServiceFactory;
 import org.apache.carbondata.core.datastorage.store.compression.Compressor;
-import org.apache.carbondata.core.datastorage.store.compression.SnappyCompression;
+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.dataholder.CarbonReadDataHolder;
 import org.apache.carbondata.core.util.ValueCompressionUtil;
@@ -40,8 +40,7 @@ public class UnCompressNonDecimalLong implements UnCompressValue<long[]> {
   /**
    * longCompressor.
    */
-  private static Compressor<long[]> longCompressor =
-      SnappyCompression.SnappyLongCompression.INSTANCE;
+  private static Compressor compressor = CompressorFactory.getInstance();
 
   /**
    * value.
@@ -54,7 +53,7 @@ public class UnCompressNonDecimalLong implements UnCompressValue<long[]> {
 
   @Override public UnCompressValue compress() {
     UnCompressNonDecimalByte byte1 = new UnCompressNonDecimalByte();
-    byte1.setValue(longCompressor.compress(value));
+    byte1.setValue(compressor.compressLong(value));
     return byte1;
   }
 
@@ -80,9 +79,6 @@ public class UnCompressNonDecimalLong implements UnCompressValue<long[]> {
     this.value = ValueCompressionUtil.convertToLongArray(buffer, bytes.length);
   }
 
-  /**
-   * @see ValueCompressonHolder.UnCompressValue#getCompressorObject()
-   */
   @Override public UnCompressValue getCompressorObject() {
     return new UnCompressNonDecimalByte();
   }

http://git-wip-us.apache.org/repos/asf/incubator-carbondata/blob/25b4ba2c/core/src/main/java/org/apache/carbondata/core/datastorage/store/compression/type/UnCompressNonDecimalMaxMinByte.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/carbondata/core/datastorage/store/compression/type/UnCompressNonDecimalMaxMinByte.java b/core/src/main/java/org/apache/carbondata/core/datastorage/store/compression/type/UnCompressNonDecimalMaxMinByte.java
index 1e6192c..0ebd52b 100644
--- a/core/src/main/java/org/apache/carbondata/core/datastorage/store/compression/type/UnCompressNonDecimalMaxMinByte.java
+++ b/core/src/main/java/org/apache/carbondata/core/datastorage/store/compression/type/UnCompressNonDecimalMaxMinByte.java
@@ -24,7 +24,7 @@ import java.math.BigDecimal;
 import org.apache.carbondata.common.logging.LogService;
 import org.apache.carbondata.common.logging.LogServiceFactory;
 import org.apache.carbondata.core.datastorage.store.compression.Compressor;
-import org.apache.carbondata.core.datastorage.store.compression.SnappyCompression;
+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.dataholder.CarbonReadDataHolder;
 import org.apache.carbondata.core.util.ValueCompressionUtil;
@@ -38,10 +38,9 @@ public class UnCompressNonDecimalMaxMinByte
   private static final LogService LOGGER =
       LogServiceFactory.getLogService(UnCompressNonDecimalMaxMinByte.class.getName());
   /**
-   * byteCompressor.
+   * compressor.
    */
-  private static Compressor<byte[]> byteCompressor =
-      SnappyCompression.SnappyByteCompression.INSTANCE;
+  private static Compressor compressor = CompressorFactory.getInstance();
   /**
    * value.
    */
@@ -59,7 +58,7 @@ public class UnCompressNonDecimalMaxMinByte
 
   @Override public ValueCompressonHolder.UnCompressValue compress() {
     UnCompressNonDecimalMaxMinByte byte1 = new UnCompressNonDecimalMaxMinByte();
-    byte1.setValue(byteCompressor.compress(value));
+    byte1.setValue(compressor.compressByte(value));
     return byte1;
   }
 

http://git-wip-us.apache.org/repos/asf/incubator-carbondata/blob/25b4ba2c/core/src/main/java/org/apache/carbondata/core/datastorage/store/compression/type/UnCompressNonDecimalMaxMinDefault.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/carbondata/core/datastorage/store/compression/type/UnCompressNonDecimalMaxMinDefault.java b/core/src/main/java/org/apache/carbondata/core/datastorage/store/compression/type/UnCompressNonDecimalMaxMinDefault.java
index f596a64..5651948 100644
--- a/core/src/main/java/org/apache/carbondata/core/datastorage/store/compression/type/UnCompressNonDecimalMaxMinDefault.java
+++ b/core/src/main/java/org/apache/carbondata/core/datastorage/store/compression/type/UnCompressNonDecimalMaxMinDefault.java
@@ -25,7 +25,7 @@ import java.nio.ByteBuffer;
 import org.apache.carbondata.common.logging.LogService;
 import org.apache.carbondata.common.logging.LogServiceFactory;
 import org.apache.carbondata.core.datastorage.store.compression.Compressor;
-import org.apache.carbondata.core.datastorage.store.compression.SnappyCompression;
+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.dataholder.CarbonReadDataHolder;
 import org.apache.carbondata.core.util.ValueCompressionUtil;
@@ -40,8 +40,7 @@ public class UnCompressNonDecimalMaxMinDefault implements UnCompressValue<double
   /**
    * doubleCompressor.
    */
-  private static Compressor<double[]> doubleCompressor =
-      SnappyCompression.SnappyDoubleCompression.INSTANCE;
+  private static Compressor compressor = CompressorFactory.getInstance();
   /**
    * value.
    */
@@ -62,7 +61,7 @@ public class UnCompressNonDecimalMaxMinDefault implements UnCompressValue<double
 
   @Override public UnCompressValue compress() {
     UnCompressNonDecimalMaxMinByte byte1 = new UnCompressNonDecimalMaxMinByte();
-    byte1.setValue(doubleCompressor.compress(value));
+    byte1.setValue(compressor.compressDouble(value));
     return byte1;
   }
 
@@ -75,9 +74,6 @@ public class UnCompressNonDecimalMaxMinDefault implements UnCompressValue<double
     this.value = ValueCompressionUtil.convertToDoubleArray(buffer, value.length);
   }
 
-  /**
-   * @see ValueCompressonHolder.UnCompressValue#getCompressorObject()
-   */
   @Override public UnCompressValue getCompressorObject() {
     return new UnCompressNonDecimalMaxMinByte();
   }

http://git-wip-us.apache.org/repos/asf/incubator-carbondata/blob/25b4ba2c/core/src/main/java/org/apache/carbondata/core/datastorage/store/compression/type/UnCompressNonDecimalMaxMinFloat.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/carbondata/core/datastorage/store/compression/type/UnCompressNonDecimalMaxMinFloat.java b/core/src/main/java/org/apache/carbondata/core/datastorage/store/compression/type/UnCompressNonDecimalMaxMinFloat.java
index aff9985..5067422 100644
--- a/core/src/main/java/org/apache/carbondata/core/datastorage/store/compression/type/UnCompressNonDecimalMaxMinFloat.java
+++ b/core/src/main/java/org/apache/carbondata/core/datastorage/store/compression/type/UnCompressNonDecimalMaxMinFloat.java
@@ -25,7 +25,7 @@ import java.nio.ByteBuffer;
 import org.apache.carbondata.common.logging.LogService;
 import org.apache.carbondata.common.logging.LogServiceFactory;
 import org.apache.carbondata.core.datastorage.store.compression.Compressor;
-import org.apache.carbondata.core.datastorage.store.compression.SnappyCompression;
+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.dataholder.CarbonReadDataHolder;
 import org.apache.carbondata.core.util.ValueCompressionUtil;
@@ -40,8 +40,7 @@ public class UnCompressNonDecimalMaxMinFloat
   /**
    * floatCompressor
    */
-  private static Compressor<float[]> floatCompressor =
-      SnappyCompression.SnappyFloatCompression.INSTANCE;
+  private static Compressor compressor = CompressorFactory.getInstance();
   /**
    * value.
    */
@@ -64,7 +63,7 @@ public class UnCompressNonDecimalMaxMinFloat
   @Override public ValueCompressonHolder.UnCompressValue compress() {
 
     UnCompressNonDecimalMaxMinByte byte1 = new UnCompressNonDecimalMaxMinByte();
-    byte1.setValue(floatCompressor.compress(value));
+    byte1.setValue(compressor.compressFloat(value));
     return byte1;
   }
 

http://git-wip-us.apache.org/repos/asf/incubator-carbondata/blob/25b4ba2c/core/src/main/java/org/apache/carbondata/core/datastorage/store/compression/type/UnCompressNonDecimalMaxMinInt.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/carbondata/core/datastorage/store/compression/type/UnCompressNonDecimalMaxMinInt.java b/core/src/main/java/org/apache/carbondata/core/datastorage/store/compression/type/UnCompressNonDecimalMaxMinInt.java
index 245f782..bd3c35c 100644
--- a/core/src/main/java/org/apache/carbondata/core/datastorage/store/compression/type/UnCompressNonDecimalMaxMinInt.java
+++ b/core/src/main/java/org/apache/carbondata/core/datastorage/store/compression/type/UnCompressNonDecimalMaxMinInt.java
@@ -25,7 +25,7 @@ import java.nio.ByteBuffer;
 import org.apache.carbondata.common.logging.LogService;
 import org.apache.carbondata.common.logging.LogServiceFactory;
 import org.apache.carbondata.core.datastorage.store.compression.Compressor;
-import org.apache.carbondata.core.datastorage.store.compression.SnappyCompression;
+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.dataholder.CarbonReadDataHolder;
 import org.apache.carbondata.core.util.ValueCompressionUtil;
@@ -40,7 +40,7 @@ public class UnCompressNonDecimalMaxMinInt implements UnCompressValue<int[]> {
   /**
    * intCompressor.
    */
-  private static Compressor<int[]> intCompressor = SnappyCompression.SnappyIntCompression.INSTANCE;
+  private static Compressor compressor = CompressorFactory.getInstance();
   /**
    * value.
    */
@@ -63,7 +63,7 @@ public class UnCompressNonDecimalMaxMinInt implements UnCompressValue<int[]> {
   @Override public UnCompressValue compress() {
 
     UnCompressNonDecimalMaxMinByte byte1 = new UnCompressNonDecimalMaxMinByte();
-    byte1.setValue(intCompressor.compress(value));
+    byte1.setValue(compressor.compressInt(value));
     return byte1;
 
   }
@@ -77,9 +77,6 @@ public class UnCompressNonDecimalMaxMinInt implements UnCompressValue<int[]> {
     this.value = ValueCompressionUtil.convertToIntArray(buffer, value.length);
   }
 
-  /**
-   * @see ValueCompressonHolder.UnCompressValue#getCompressorObject()
-   */
   @Override public UnCompressValue getCompressorObject() {
     return new UnCompressNonDecimalMaxMinByte();
   }

http://git-wip-us.apache.org/repos/asf/incubator-carbondata/blob/25b4ba2c/core/src/main/java/org/apache/carbondata/core/datastorage/store/compression/type/UnCompressNonDecimalMaxMinLong.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/carbondata/core/datastorage/store/compression/type/UnCompressNonDecimalMaxMinLong.java b/core/src/main/java/org/apache/carbondata/core/datastorage/store/compression/type/UnCompressNonDecimalMaxMinLong.java
index 122db75..dfe2481 100644
--- a/core/src/main/java/org/apache/carbondata/core/datastorage/store/compression/type/UnCompressNonDecimalMaxMinLong.java
+++ b/core/src/main/java/org/apache/carbondata/core/datastorage/store/compression/type/UnCompressNonDecimalMaxMinLong.java
@@ -25,7 +25,7 @@ import java.nio.ByteBuffer;
 import org.apache.carbondata.common.logging.LogService;
 import org.apache.carbondata.common.logging.LogServiceFactory;
 import org.apache.carbondata.core.datastorage.store.compression.Compressor;
-import org.apache.carbondata.core.datastorage.store.compression.SnappyCompression;
+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.dataholder.CarbonReadDataHolder;
 import org.apache.carbondata.core.util.ValueCompressionUtil;
@@ -41,8 +41,7 @@ public class UnCompressNonDecimalMaxMinLong
   /**
    * longCompressor.
    */
-  private static Compressor<long[]> longCompressor =
-      SnappyCompression.SnappyLongCompression.INSTANCE;
+  private static Compressor compressor = CompressorFactory.getInstance();
   /**
    * value.
    */
@@ -65,7 +64,7 @@ public class UnCompressNonDecimalMaxMinLong
   @Override public ValueCompressonHolder.UnCompressValue compress() {
 
     UnCompressNonDecimalMaxMinByte uNonDecByte = new UnCompressNonDecimalMaxMinByte();
-    uNonDecByte.setValue(longCompressor.compress(value));
+    uNonDecByte.setValue(compressor.compressLong(value));
     return uNonDecByte;
   }
 

http://git-wip-us.apache.org/repos/asf/incubator-carbondata/blob/25b4ba2c/core/src/main/java/org/apache/carbondata/core/datastorage/store/compression/type/UnCompressNonDecimalMaxMinShort.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/carbondata/core/datastorage/store/compression/type/UnCompressNonDecimalMaxMinShort.java b/core/src/main/java/org/apache/carbondata/core/datastorage/store/compression/type/UnCompressNonDecimalMaxMinShort.java
index e82ac80..ea19104 100644
--- a/core/src/main/java/org/apache/carbondata/core/datastorage/store/compression/type/UnCompressNonDecimalMaxMinShort.java
+++ b/core/src/main/java/org/apache/carbondata/core/datastorage/store/compression/type/UnCompressNonDecimalMaxMinShort.java
@@ -25,7 +25,7 @@ import java.nio.ByteBuffer;
 import org.apache.carbondata.common.logging.LogService;
 import org.apache.carbondata.common.logging.LogServiceFactory;
 import org.apache.carbondata.core.datastorage.store.compression.Compressor;
-import org.apache.carbondata.core.datastorage.store.compression.SnappyCompression;
+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.dataholder.CarbonReadDataHolder;
 import org.apache.carbondata.core.util.ValueCompressionUtil;
@@ -38,10 +38,9 @@ public class UnCompressNonDecimalMaxMinShort
   private static final LogService LOGGER =
       LogServiceFactory.getLogService(UnCompressNonDecimalMaxMinShort.class.getName());
   /**
-   * shortCompressor.
+   * compressor.
    */
-  private static Compressor<short[]> shortCompressor =
-      SnappyCompression.SnappyShortCompression.INSTANCE;
+  private static Compressor compressor = CompressorFactory.getInstance();
   /**
    * value.
    */
@@ -63,7 +62,7 @@ public class UnCompressNonDecimalMaxMinShort
 
   @Override public ValueCompressonHolder.UnCompressValue compress() {
     UnCompressNonDecimalMaxMinByte byte1 = new UnCompressNonDecimalMaxMinByte();
-    byte1.setValue(shortCompressor.compress(value));
+    byte1.setValue(compressor.compressShort(value));
     return byte1;
   }
 

http://git-wip-us.apache.org/repos/asf/incubator-carbondata/blob/25b4ba2c/core/src/main/java/org/apache/carbondata/core/datastorage/store/compression/type/UnCompressNonDecimalShort.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/carbondata/core/datastorage/store/compression/type/UnCompressNonDecimalShort.java b/core/src/main/java/org/apache/carbondata/core/datastorage/store/compression/type/UnCompressNonDecimalShort.java
index 852fd12..05cfa67 100644
--- a/core/src/main/java/org/apache/carbondata/core/datastorage/store/compression/type/UnCompressNonDecimalShort.java
+++ b/core/src/main/java/org/apache/carbondata/core/datastorage/store/compression/type/UnCompressNonDecimalShort.java
@@ -24,7 +24,7 @@ import java.nio.ByteBuffer;
 import org.apache.carbondata.common.logging.LogService;
 import org.apache.carbondata.common.logging.LogServiceFactory;
 import org.apache.carbondata.core.datastorage.store.compression.Compressor;
-import org.apache.carbondata.core.datastorage.store.compression.SnappyCompression;
+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.dataholder.CarbonReadDataHolder;
 import org.apache.carbondata.core.util.ValueCompressionUtil;
@@ -38,8 +38,7 @@ public class UnCompressNonDecimalShort implements ValueCompressonHolder.UnCompre
   /**
    * shortCompressor.
    */
-  private static Compressor<short[]> shortCompressor =
-      SnappyCompression.SnappyShortCompression.INSTANCE;
+  private static Compressor compressor = CompressorFactory.getInstance();
   /**
    * value.
    */
@@ -65,7 +64,7 @@ public class UnCompressNonDecimalShort implements ValueCompressonHolder.UnCompre
 
   @Override public ValueCompressonHolder.UnCompressValue compress() {
     UnCompressNonDecimalByte byte1 = new UnCompressNonDecimalByte();
-    byte1.setValue(shortCompressor.compress(value));
+    byte1.setValue(compressor.compressShort(value));
     return byte1;
   }
 

http://git-wip-us.apache.org/repos/asf/incubator-carbondata/blob/25b4ba2c/core/src/main/java/org/apache/carbondata/core/datastorage/store/compression/type/UnCompressNoneByte.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/carbondata/core/datastorage/store/compression/type/UnCompressNoneByte.java b/core/src/main/java/org/apache/carbondata/core/datastorage/store/compression/type/UnCompressNoneByte.java
index 91959a2..b87c370 100644
--- a/core/src/main/java/org/apache/carbondata/core/datastorage/store/compression/type/UnCompressNoneByte.java
+++ b/core/src/main/java/org/apache/carbondata/core/datastorage/store/compression/type/UnCompressNoneByte.java
@@ -22,7 +22,7 @@ package org.apache.carbondata.core.datastorage.store.compression.type;
 import org.apache.carbondata.common.logging.LogService;
 import org.apache.carbondata.common.logging.LogServiceFactory;
 import org.apache.carbondata.core.datastorage.store.compression.Compressor;
-import org.apache.carbondata.core.datastorage.store.compression.SnappyCompression;
+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.datastorage.store.dataholder.CarbonReadDataHolder;
@@ -39,8 +39,7 @@ public class UnCompressNoneByte implements UnCompressValue<byte[]> {
   /**
    * byteCompressor.
    */
-  private static Compressor<byte[]> byteCompressor =
-      SnappyCompression.SnappyByteCompression.INSTANCE;
+  private static Compressor compressor = CompressorFactory.getInstance();
 
   /**
    * value.
@@ -77,7 +76,7 @@ public class UnCompressNoneByte implements UnCompressValue<byte[]> {
 
   @Override public UnCompressValue compress() {
     UnCompressNoneByte byte1 = new UnCompressNoneByte(actualDataType);
-    byte1.setValue(byteCompressor.compress(value));
+    byte1.setValue(compressor.compressByte(value));
     return byte1;
   }
 

http://git-wip-us.apache.org/repos/asf/incubator-carbondata/blob/25b4ba2c/core/src/main/java/org/apache/carbondata/core/datastorage/store/compression/type/UnCompressNoneDefault.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/carbondata/core/datastorage/store/compression/type/UnCompressNoneDefault.java b/core/src/main/java/org/apache/carbondata/core/datastorage/store/compression/type/UnCompressNoneDefault.java
index abf6ae3..025f570 100644
--- a/core/src/main/java/org/apache/carbondata/core/datastorage/store/compression/type/UnCompressNoneDefault.java
+++ b/core/src/main/java/org/apache/carbondata/core/datastorage/store/compression/type/UnCompressNoneDefault.java
@@ -24,7 +24,7 @@ import java.nio.ByteBuffer;
 import org.apache.carbondata.common.logging.LogService;
 import org.apache.carbondata.common.logging.LogServiceFactory;
 import org.apache.carbondata.core.datastorage.store.compression.Compressor;
-import org.apache.carbondata.core.datastorage.store.compression.SnappyCompression;
+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.dataholder.CarbonReadDataHolder;
 import org.apache.carbondata.core.util.ValueCompressionUtil;
@@ -39,8 +39,7 @@ public class UnCompressNoneDefault implements UnCompressValue<double[]> {
   /**
    * doubleCompressor.
    */
-  private static Compressor<double[]> doubleCompressor =
-      SnappyCompression.SnappyDoubleCompression.INSTANCE;
+  private static Compressor compressor = CompressorFactory.getInstance();
   /**
    * value.
    */
@@ -68,8 +67,7 @@ public class UnCompressNoneDefault implements UnCompressValue<double[]> {
 
   @Override public UnCompressValue compress() {
     UnCompressNoneByte byte1 = new UnCompressNoneByte(actualDataType);
-    byte1.setValue(doubleCompressor.compress(value));
-
+    byte1.setValue(compressor.compressDouble(value));
     return byte1;
   }
 

http://git-wip-us.apache.org/repos/asf/incubator-carbondata/blob/25b4ba2c/core/src/main/java/org/apache/carbondata/core/datastorage/store/compression/type/UnCompressNoneFloat.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/carbondata/core/datastorage/store/compression/type/UnCompressNoneFloat.java b/core/src/main/java/org/apache/carbondata/core/datastorage/store/compression/type/UnCompressNoneFloat.java
index 6167c54..75c933f 100644
--- a/core/src/main/java/org/apache/carbondata/core/datastorage/store/compression/type/UnCompressNoneFloat.java
+++ b/core/src/main/java/org/apache/carbondata/core/datastorage/store/compression/type/UnCompressNoneFloat.java
@@ -24,7 +24,7 @@ import java.nio.ByteBuffer;
 import org.apache.carbondata.common.logging.LogService;
 import org.apache.carbondata.common.logging.LogServiceFactory;
 import org.apache.carbondata.core.datastorage.store.compression.Compressor;
-import org.apache.carbondata.core.datastorage.store.compression.SnappyCompression;
+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.dataholder.CarbonReadDataHolder;
 import org.apache.carbondata.core.util.ValueCompressionUtil;
@@ -37,10 +37,9 @@ public class UnCompressNoneFloat implements ValueCompressonHolder.UnCompressValu
   private static final LogService LOGGER =
       LogServiceFactory.getLogService(UnCompressNoneFloat.class.getName());
   /**
-   * floatCompressor
+   * compressor
    */
-  private static Compressor<float[]> floatCompressor =
-      SnappyCompression.SnappyFloatCompression.INSTANCE;
+  private static Compressor compressor = CompressorFactory.getInstance();
   /**
    * value.
    */
@@ -67,11 +66,9 @@ public class UnCompressNoneFloat implements ValueCompressonHolder.UnCompressValu
   }
 
   @Override public ValueCompressonHolder.UnCompressValue compress() {
-    UnCompressNoneByte byte1 = new UnCompressNoneByte(this.actualDataType);
-    byte1.setValue(floatCompressor.compress(value));
-
+    UnCompressNoneByte byte1 = new UnCompressNoneByte(actualDataType);
+    byte1.setValue(compressor.compressFloat(value));
     return byte1;
-
   }
 
   @Override public void setValueInBytes(byte[] value) {



Mime
View raw message