carbondata-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ravipes...@apache.org
Subject [7/9] carbondata git commit: add EncodingStrategy
Date Tue, 13 Jun 2017 17:04:56 GMT
http://git-wip-us.apache.org/repos/asf/carbondata/blob/edda2483/core/src/main/java/org/apache/carbondata/core/datastore/compression/nondecimal/CompressionNonDecimalDefault.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/carbondata/core/datastore/compression/nondecimal/CompressionNonDecimalDefault.java b/core/src/main/java/org/apache/carbondata/core/datastore/compression/nondecimal/CompressionNonDecimalDefault.java
deleted file mode 100644
index 40312db..0000000
--- a/core/src/main/java/org/apache/carbondata/core/datastore/compression/nondecimal/CompressionNonDecimalDefault.java
+++ /dev/null
@@ -1,102 +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.datastore.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.datastore.chunk.store.MeasureChunkStoreFactory;
-import org.apache.carbondata.core.datastore.chunk.store.MeasureDataChunkStore;
-import org.apache.carbondata.core.datastore.compression.Compressor;
-import org.apache.carbondata.core.datastore.compression.CompressorFactory;
-import org.apache.carbondata.core.datastore.compression.ValueCompressionHolder;
-import org.apache.carbondata.core.metadata.datatype.DataType;
-import org.apache.carbondata.core.util.ValueCompressionUtil;
-
-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, int numberOfRows) {
-    super.unCompress(compressor, dataType, compressedData, offset, length, numberOfRows,
-        maxValueObject, decimalPlaces);
-  }
-
-  @Override public void compress() {
-    compressedValue = super.compress(compressor, DataType.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");
-  }
-
-  @Override public void freeMemory() {
-    this.measureChunkStore.freeMemory();
-  }
-
-  @Override
-  public void setValue(double[] data, int numberOfRows, Object maxValueObject, int decimalPlaces) {
-    this.measureChunkStore = MeasureChunkStoreFactory.INSTANCE
-        .getMeasureDataChunkStore(DataType.DOUBLE, numberOfRows);
-    this.measureChunkStore.putData(data);
-    this.divisionFactory = Math.pow(10, decimalPlaces);
-
-  }
-}

http://git-wip-us.apache.org/repos/asf/carbondata/blob/edda2483/core/src/main/java/org/apache/carbondata/core/datastore/compression/nondecimal/CompressionNonDecimalInt.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/carbondata/core/datastore/compression/nondecimal/CompressionNonDecimalInt.java b/core/src/main/java/org/apache/carbondata/core/datastore/compression/nondecimal/CompressionNonDecimalInt.java
deleted file mode 100644
index ada751e..0000000
--- a/core/src/main/java/org/apache/carbondata/core/datastore/compression/nondecimal/CompressionNonDecimalInt.java
+++ /dev/null
@@ -1,100 +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.datastore.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.datastore.chunk.store.MeasureChunkStoreFactory;
-import org.apache.carbondata.core.datastore.chunk.store.MeasureDataChunkStore;
-import org.apache.carbondata.core.datastore.compression.Compressor;
-import org.apache.carbondata.core.datastore.compression.CompressorFactory;
-import org.apache.carbondata.core.datastore.compression.ValueCompressionHolder;
-import org.apache.carbondata.core.metadata.datatype.DataType;
-import org.apache.carbondata.core.util.ValueCompressionUtil;
-
-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.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, int numberOfRows) {
-    super.unCompress(compressor, dataType, compressedData, offset, length, numberOfRows,
-        maxValueObject, 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");
-  }
-
-  @Override public void freeMemory() {
-    this.measureChunkStore.freeMemory();
-  }
-
-  @Override
-  public void setValue(int[] data, int numberOfRows, Object maxValueObject, int decimalPlaces) {
-    this.measureChunkStore =
-        MeasureChunkStoreFactory.INSTANCE.getMeasureDataChunkStore(DataType.INT, numberOfRows);
-    this.measureChunkStore.putData(data);
-    this.divisionFactory = Math.pow(10, decimalPlaces);
-  }
-}

http://git-wip-us.apache.org/repos/asf/carbondata/blob/edda2483/core/src/main/java/org/apache/carbondata/core/datastore/compression/nondecimal/CompressionNonDecimalLong.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/carbondata/core/datastore/compression/nondecimal/CompressionNonDecimalLong.java b/core/src/main/java/org/apache/carbondata/core/datastore/compression/nondecimal/CompressionNonDecimalLong.java
deleted file mode 100644
index f0b2323..0000000
--- a/core/src/main/java/org/apache/carbondata/core/datastore/compression/nondecimal/CompressionNonDecimalLong.java
+++ /dev/null
@@ -1,102 +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.datastore.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.datastore.chunk.store.MeasureChunkStoreFactory;
-import org.apache.carbondata.core.datastore.chunk.store.MeasureDataChunkStore;
-import org.apache.carbondata.core.datastore.compression.Compressor;
-import org.apache.carbondata.core.datastore.compression.CompressorFactory;
-import org.apache.carbondata.core.datastore.compression.ValueCompressionHolder;
-import org.apache.carbondata.core.metadata.datatype.DataType;
-import org.apache.carbondata.core.util.ValueCompressionUtil;
-
-public class CompressionNonDecimalLong extends ValueCompressionHolder<long[]> {
-  /**
-   * Attribute for Carbon LOGGER
-   */
-  private static final LogService LOGGER =
-      LogServiceFactory.getLogService(CompressionNonDecimalLong.class.getName());
-
-  /**
-   * longCompressor.
-   */
-  private static Compressor compressor = CompressorFactory.getInstance().getCompressor();
-
-  /**
-   * value.
-   */
-  private long[] value;
-
-  private MeasureDataChunkStore<long[]> measureChunkStore;
-
-  private double divisionFactory;
-
-  @Override public void setValue(long[] value) {
-    this.value = value;
-  }
-
-  @Override public long[] getValue() {
-    return this.value;
-  }
-
-  @Override public void compress() {
-    compressedValue = super.compress(compressor, DataType.LONG, value);
-  }
-
-  @Override public void uncompress(DataType dataType, byte[] compressedData, int offset, int length,
-      int decimalPlaces, Object maxValueObject, int numberOfRows) {
-    super.unCompress(compressor, dataType, compressedData, offset, length, numberOfRows,
-        maxValueObject, decimalPlaces);
-  }
-
-  @Override public void setValueInBytes(byte[] bytes) {
-    ByteBuffer buffer = ByteBuffer.wrap(bytes);
-    this.value = ValueCompressionUtil.convertToLongArray(buffer, bytes.length);
-  }
-
-  @Override public long getLongValue(int index) {
-    throw new UnsupportedOperationException(
-        "Long value is not defined for CompressionNonDecimalLong");
-  }
-
-  @Override public double getDoubleValue(int index) {
-    return (measureChunkStore.getLong(index) / this.divisionFactory);
-  }
-
-  @Override public BigDecimal getBigDecimalValue(int index) {
-    throw new UnsupportedOperationException(
-        "Big decimal value is not defined for CompressionNonDecimalLong");
-  }
-
-  @Override public void freeMemory() {
-    this.measureChunkStore.freeMemory();
-  }
-
-  @Override
-  public void setValue(long[] data, int numberOfRows, Object maxValueObject, int decimalPlaces) {
-    this.measureChunkStore = MeasureChunkStoreFactory.INSTANCE
-        .getMeasureDataChunkStore(DataType.LONG, numberOfRows);
-    this.measureChunkStore.putData(data);
-    this.divisionFactory = Math.pow(10, decimalPlaces);
-  }
-}

http://git-wip-us.apache.org/repos/asf/carbondata/blob/edda2483/core/src/main/java/org/apache/carbondata/core/datastore/compression/nondecimal/CompressionNonDecimalMaxMinByte.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/carbondata/core/datastore/compression/nondecimal/CompressionNonDecimalMaxMinByte.java b/core/src/main/java/org/apache/carbondata/core/datastore/compression/nondecimal/CompressionNonDecimalMaxMinByte.java
deleted file mode 100644
index c425706..0000000
--- a/core/src/main/java/org/apache/carbondata/core/datastore/compression/nondecimal/CompressionNonDecimalMaxMinByte.java
+++ /dev/null
@@ -1,105 +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.datastore.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.datastore.chunk.store.MeasureChunkStoreFactory;
-import org.apache.carbondata.core.datastore.chunk.store.MeasureDataChunkStore;
-import org.apache.carbondata.core.datastore.compression.Compressor;
-import org.apache.carbondata.core.datastore.compression.CompressorFactory;
-import org.apache.carbondata.core.datastore.compression.ValueCompressionHolder;
-import org.apache.carbondata.core.metadata.datatype.DataType;
-
-public class CompressionNonDecimalMaxMinByte extends ValueCompressionHolder<byte[]> {
-  /**
-   * Attribute for Carbon LOGGER
-   */
-  private static final LogService LOGGER =
-      LogServiceFactory.getLogService(CompressionNonDecimalMaxMinByte.class.getName());
-
-  /**
-   * compressor.
-   */
-  private static Compressor compressor = CompressorFactory.getInstance().getCompressor();
-
-  /**
-   * value.
-   */
-  private byte[] value;
-
-  private MeasureDataChunkStore<byte[]> measureChunkStore;
-
-  private BigDecimal maxValue;
-
-  private double divisionFactor;
-
-  @Override public void uncompress(DataType dataType, byte[] compressedData, int offset, int length,
-      int decimalPlaces, Object maxValueObject, int numberOfRows) {
-    super.unCompress(compressor, dataType, compressedData, offset, length, numberOfRows,
-        maxValueObject, decimalPlaces);
-  }
-
-  @Override public void compress() {
-    compressedValue = super.compress(compressor, DataType.BYTE, value);
-  }
-
-  @Override public void setValueInBytes(byte[] value) {
-    this.value = value;
-  }
-
-  @Override public void setValue(byte[] value) {
-    this.value = value;
-  }
-
-  @Override public long getLongValue(int index) {
-    throw new UnsupportedOperationException(
-        "Long value is not defined for CompressionNonDecimalMaxMinByte");
-  }
-
-  @Override public double getDoubleValue(int index) {
-    byte byteValue = measureChunkStore.getByte(index);
-    BigDecimal diff = BigDecimal.valueOf(byteValue / this.divisionFactor);
-    return maxValue.subtract(diff).doubleValue();
-
-  }
-
-  @Override public BigDecimal getBigDecimalValue(int index) {
-    throw new UnsupportedOperationException(
-        "Big decimal value is not defined for CompressionNonDecimalMaxMinByte");
-  }
-
-  @Override public void freeMemory() {
-    this.measureChunkStore.freeMemory();
-  }
-
-  @Override public byte[] getValue() {
-    return this.value;
-  }
-
-  @Override
-  public void setValue(byte[] data, int numberOfRows, Object maxValueObject, int decimalPlaces) {
-    this.measureChunkStore = MeasureChunkStoreFactory.INSTANCE
-        .getMeasureDataChunkStore(DataType.BYTE, numberOfRows);
-    this.measureChunkStore.putData(data);
-    this.maxValue = BigDecimal.valueOf((double) maxValueObject);
-    this.divisionFactor = Math.pow(10, decimalPlaces);
-  }
-}

http://git-wip-us.apache.org/repos/asf/carbondata/blob/edda2483/core/src/main/java/org/apache/carbondata/core/datastore/compression/nondecimal/CompressionNonDecimalMaxMinDefault.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/carbondata/core/datastore/compression/nondecimal/CompressionNonDecimalMaxMinDefault.java b/core/src/main/java/org/apache/carbondata/core/datastore/compression/nondecimal/CompressionNonDecimalMaxMinDefault.java
deleted file mode 100644
index 521328e..0000000
--- a/core/src/main/java/org/apache/carbondata/core/datastore/compression/nondecimal/CompressionNonDecimalMaxMinDefault.java
+++ /dev/null
@@ -1,107 +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.datastore.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.datastore.chunk.store.MeasureChunkStoreFactory;
-import org.apache.carbondata.core.datastore.chunk.store.MeasureDataChunkStore;
-import org.apache.carbondata.core.datastore.compression.Compressor;
-import org.apache.carbondata.core.datastore.compression.CompressorFactory;
-import org.apache.carbondata.core.datastore.compression.ValueCompressionHolder;
-import org.apache.carbondata.core.metadata.datatype.DataType;
-import org.apache.carbondata.core.util.ValueCompressionUtil;
-
-public class CompressionNonDecimalMaxMinDefault extends ValueCompressionHolder<double[]> {
-  /**
-   * Attribute for Carbon LOGGER
-   */
-  private static final LogService LOGGER =
-      LogServiceFactory.getLogService(CompressionNonDecimalMaxMinDefault.class.getName());
-
-  /**
-   * doubleCompressor.
-   */
-  private static Compressor compressor = CompressorFactory.getInstance().getCompressor();
-
-  /**
-   * value.
-   */
-  private double[] value;
-
-  private MeasureDataChunkStore<double[]> measureChunkStore;
-
-  private BigDecimal maxValue;
-
-  private double divisionFactor;
-
-  @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.DOUBLE, value);
-  }
-
-  @Override public void setValueInBytes(byte[] value) {
-    ByteBuffer buffer = ByteBuffer.wrap(value);
-    this.value = ValueCompressionUtil.convertToDoubleArray(buffer, value.length);
-  }
-
-  @Override public void uncompress(DataType dataType, byte[] compressedData, int offset, int length,
-      int decimalPlaces, Object maxValueObject, int numberOfRows) {
-    super.unCompress(compressor, dataType, compressedData, offset, length, numberOfRows,
-        maxValueObject, decimalPlaces);
-  }
-
-  @Override public long getLongValue(int index) {
-    throw new UnsupportedOperationException(
-        "Long value is not defined for CompressionNonDecimalMaxMinDefault");
-  }
-
-  @Override public double getDoubleValue(int index) {
-    double doubleValue = measureChunkStore.getDouble(index);
-    BigDecimal diff = BigDecimal.valueOf(doubleValue / this.divisionFactor);
-    return maxValue.subtract(diff).doubleValue();
-  }
-
-  @Override public BigDecimal getBigDecimalValue(int index) {
-    throw new UnsupportedOperationException(
-        "Big decimal value is not defined for CompressionNonDecimalMaxMinDefault");
-  }
-
-  @Override public void freeMemory() {
-    this.measureChunkStore.freeMemory();
-  }
-
-  @Override
-  public void setValue(double[] data, int numberOfRows, Object maxValueObject, int decimalPlaces) {
-    this.measureChunkStore = MeasureChunkStoreFactory.INSTANCE
-        .getMeasureDataChunkStore(DataType.DOUBLE, numberOfRows);
-    this.measureChunkStore.putData(data);
-    this.maxValue = BigDecimal.valueOf((double) maxValueObject);
-    this.divisionFactor = Math.pow(10, decimalPlaces);
-  }
-}

http://git-wip-us.apache.org/repos/asf/carbondata/blob/edda2483/core/src/main/java/org/apache/carbondata/core/datastore/compression/nondecimal/CompressionNonDecimalMaxMinInt.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/carbondata/core/datastore/compression/nondecimal/CompressionNonDecimalMaxMinInt.java b/core/src/main/java/org/apache/carbondata/core/datastore/compression/nondecimal/CompressionNonDecimalMaxMinInt.java
deleted file mode 100644
index efd21d5..0000000
--- a/core/src/main/java/org/apache/carbondata/core/datastore/compression/nondecimal/CompressionNonDecimalMaxMinInt.java
+++ /dev/null
@@ -1,106 +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.datastore.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.datastore.chunk.store.MeasureChunkStoreFactory;
-import org.apache.carbondata.core.datastore.chunk.store.MeasureDataChunkStore;
-import org.apache.carbondata.core.datastore.compression.Compressor;
-import org.apache.carbondata.core.datastore.compression.CompressorFactory;
-import org.apache.carbondata.core.datastore.compression.ValueCompressionHolder;
-import org.apache.carbondata.core.metadata.datatype.DataType;
-import org.apache.carbondata.core.util.ValueCompressionUtil;
-
-public class CompressionNonDecimalMaxMinInt extends ValueCompressionHolder<int[]> {
-  /**
-   * Attribute for Carbon LOGGER
-   */
-  private static final LogService LOGGER =
-      LogServiceFactory.getLogService(CompressionNonDecimalMaxMinInt.class.getName());
-  /**
-   * intCompressor.
-   */
-  private static Compressor compressor = CompressorFactory.getInstance().getCompressor();
-  /**
-   * value.
-   */
-  private int[] value;
-
-  private MeasureDataChunkStore<int[]> measureChunkStore;
-
-  private double divisionFactor;
-
-  private BigDecimal maxValue;
-
-  @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.INT, value);
-  }
-
-  @Override public void setValueInBytes(byte[] value) {
-    ByteBuffer buffer = ByteBuffer.wrap(value);
-    this.value = ValueCompressionUtil.convertToIntArray(buffer, value.length);
-  }
-
-  @Override public void uncompress(DataType dataType, byte[] compressedData, int offset, int length,
-      int decimalPlaces, Object maxValueObject, int numberOfRows) {
-    super.unCompress(compressor, dataType, compressedData, offset, length, numberOfRows,
-        maxValueObject, decimalPlaces);
-  }
-
-  @Override public long getLongValue(int index) {
-    throw new UnsupportedOperationException(
-        "Long value is not defined for CompressionNonDecimalMaxMinInt");
-  }
-
-  @Override public double getDoubleValue(int index) {
-    int intValue = measureChunkStore.getInt(index);
-    BigDecimal diff = BigDecimal.valueOf(intValue / this.divisionFactor);
-    return maxValue.subtract(diff).doubleValue();
-  }
-
-  @Override public BigDecimal getBigDecimalValue(int index) {
-    throw new UnsupportedOperationException(
-        "Big decimal value is not defined for CompressionNonDecimalMaxMinInt");
-  }
-
-  @Override public void freeMemory() {
-    this.measureChunkStore.freeMemory();
-  }
-
-  @Override
-  public void setValue(int[] data, int numberOfRows, Object maxValueObject, int decimalPlaces) {
-    this.measureChunkStore =
-        MeasureChunkStoreFactory.INSTANCE.getMeasureDataChunkStore(DataType.INT, numberOfRows);
-    this.measureChunkStore.putData(data);
-    this.maxValue = BigDecimal.valueOf((double) maxValueObject);
-    this.divisionFactor = Math.pow(10, decimalPlaces);
-
-  }
-}

http://git-wip-us.apache.org/repos/asf/carbondata/blob/edda2483/core/src/main/java/org/apache/carbondata/core/datastore/compression/nondecimal/CompressionNonDecimalMaxMinLong.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/carbondata/core/datastore/compression/nondecimal/CompressionNonDecimalMaxMinLong.java b/core/src/main/java/org/apache/carbondata/core/datastore/compression/nondecimal/CompressionNonDecimalMaxMinLong.java
deleted file mode 100644
index d2e2771..0000000
--- a/core/src/main/java/org/apache/carbondata/core/datastore/compression/nondecimal/CompressionNonDecimalMaxMinLong.java
+++ /dev/null
@@ -1,106 +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.datastore.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.datastore.chunk.store.MeasureChunkStoreFactory;
-import org.apache.carbondata.core.datastore.chunk.store.MeasureDataChunkStore;
-import org.apache.carbondata.core.datastore.compression.Compressor;
-import org.apache.carbondata.core.datastore.compression.CompressorFactory;
-import org.apache.carbondata.core.datastore.compression.ValueCompressionHolder;
-import org.apache.carbondata.core.metadata.datatype.DataType;
-import org.apache.carbondata.core.util.ValueCompressionUtil;
-
-public class CompressionNonDecimalMaxMinLong extends ValueCompressionHolder<long[]> {
-  /**
-   * Attribute for Carbon LOGGER
-   */
-  private static final LogService LOGGER =
-      LogServiceFactory.getLogService(CompressionNonDecimalMaxMinLong.class.getName());
-
-  /**
-   * longCompressor.
-   */
-  private static Compressor compressor = CompressorFactory.getInstance().getCompressor();
-  /**
-   * value.
-   */
-  private long[] value;
-
-  private MeasureDataChunkStore<long[]> measureChunkStore;
-
-  private BigDecimal maxValue;
-
-  private double divisionFactor;
-
-  @Override public void setValue(long[] value) {
-    this.value = value;
-
-  }
-
-  @Override public long[] getValue() {
-    return this.value;
-  }
-
-  @Override public void uncompress(DataType dataType, byte[] compressedData, int offset, int length,
-      int decimalPlaces, Object maxValueObject, int numberOfRows) {
-    super.unCompress(compressor, dataType, compressedData, offset, length, numberOfRows,
-        maxValueObject, decimalPlaces);
-  }
-
-  @Override public void compress() {
-    compressedValue = super.compress(compressor, DataType.LONG, value);
-  }
-
-  @Override public void setValueInBytes(byte[] value) {
-    ByteBuffer buff = ByteBuffer.wrap(value);
-    this.value = ValueCompressionUtil.convertToLongArray(buff, value.length);
-  }
-
-  @Override public long getLongValue(int index) {
-    throw new UnsupportedOperationException(
-        "Long value is not defined for CompressionNonDecimalMaxMinLong");
-  }
-
-  @Override public double getDoubleValue(int index) {
-    long longValue = measureChunkStore.getLong(index);
-    BigDecimal diff = BigDecimal.valueOf(longValue / this.divisionFactor);
-    return maxValue.subtract(diff).doubleValue();
-  }
-
-  @Override public BigDecimal getBigDecimalValue(int index) {
-    throw new UnsupportedOperationException("Big decimal value is not supported");
-  }
-
-  @Override public void freeMemory() {
-    this.measureChunkStore.freeMemory();
-  }
-
-  @Override
-  public void setValue(long[] data, int numberOfRows, Object maxValueObject, int decimalPlaces) {
-    this.measureChunkStore = MeasureChunkStoreFactory.INSTANCE
-        .getMeasureDataChunkStore(DataType.LONG, numberOfRows);
-    this.measureChunkStore.putData(data);
-    this.maxValue = BigDecimal.valueOf((double) maxValueObject);
-    this.divisionFactor = Math.pow(10, decimalPlaces);
-  }
-}

http://git-wip-us.apache.org/repos/asf/carbondata/blob/edda2483/core/src/main/java/org/apache/carbondata/core/datastore/compression/nondecimal/CompressionNonDecimalMaxMinShort.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/carbondata/core/datastore/compression/nondecimal/CompressionNonDecimalMaxMinShort.java b/core/src/main/java/org/apache/carbondata/core/datastore/compression/nondecimal/CompressionNonDecimalMaxMinShort.java
deleted file mode 100644
index 241344a..0000000
--- a/core/src/main/java/org/apache/carbondata/core/datastore/compression/nondecimal/CompressionNonDecimalMaxMinShort.java
+++ /dev/null
@@ -1,105 +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.datastore.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.datastore.chunk.store.MeasureChunkStoreFactory;
-import org.apache.carbondata.core.datastore.chunk.store.MeasureDataChunkStore;
-import org.apache.carbondata.core.datastore.compression.Compressor;
-import org.apache.carbondata.core.datastore.compression.CompressorFactory;
-import org.apache.carbondata.core.datastore.compression.ValueCompressionHolder;
-import org.apache.carbondata.core.metadata.datatype.DataType;
-import org.apache.carbondata.core.util.ValueCompressionUtil;
-
-public class CompressionNonDecimalMaxMinShort extends ValueCompressionHolder<short[]> {
-  /**
-   * Attribute for Carbon LOGGER
-   */
-  private static final LogService LOGGER =
-      LogServiceFactory.getLogService(CompressionNonDecimalMaxMinShort.class.getName());
-  /**
-   * compressor.
-   */
-  private static Compressor compressor = CompressorFactory.getInstance().getCompressor();
-  /**
-   * value.
-   */
-  private short[] value;
-
-  private MeasureDataChunkStore<short[]> measureChunkStore;
-
-  private BigDecimal maxValue;
-
-  private double divisionFactor;
-
-  @Override public void setValue(short[] value) {
-    this.value = value;
-  }
-
-  @Override public short[] getValue() {
-    return this.value;
-  }
-
-  @Override public void uncompress(DataType dataType, byte[] compressedData, int offset, int length,
-      int decimalPlaces, Object maxValueObject, int numberOfRows) {
-    super.unCompress(compressor, dataType, compressedData, offset, length, numberOfRows,
-        maxValueObject, decimalPlaces);
-  }
-
-  @Override public void compress() {
-    compressedValue = super.compress(compressor, DataType.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) {
-    throw new UnsupportedOperationException(
-        "Long value is not defined for CompressionNonDecimalMaxMinShort");
-  }
-
-  @Override public double getDoubleValue(int index) {
-    short shortValue = measureChunkStore.getShort(index);
-    BigDecimal diff = BigDecimal.valueOf(shortValue / this.divisionFactor);
-    return maxValue.subtract(diff).doubleValue();
-  }
-
-  @Override public BigDecimal getBigDecimalValue(int index) {
-    throw new UnsupportedOperationException("Get big decimal value is not supported");
-  }
-
-  @Override public void freeMemory() {
-    this.measureChunkStore.freeMemory();
-  }
-
-  @Override
-  public void setValue(short[] data, int numberOfRows, Object maxValueObject, int decimalPlaces) {
-    this.measureChunkStore = MeasureChunkStoreFactory.INSTANCE
-        .getMeasureDataChunkStore(DataType.SHORT, numberOfRows);
-    this.measureChunkStore.putData(data);
-    this.maxValue = BigDecimal.valueOf((double) maxValueObject);
-    this.divisionFactor = Math.pow(10, decimalPlaces);
-
-  }
-}

http://git-wip-us.apache.org/repos/asf/carbondata/blob/edda2483/core/src/main/java/org/apache/carbondata/core/datastore/compression/nondecimal/CompressionNonDecimalShort.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/carbondata/core/datastore/compression/nondecimal/CompressionNonDecimalShort.java b/core/src/main/java/org/apache/carbondata/core/datastore/compression/nondecimal/CompressionNonDecimalShort.java
deleted file mode 100644
index 4737e10..0000000
--- a/core/src/main/java/org/apache/carbondata/core/datastore/compression/nondecimal/CompressionNonDecimalShort.java
+++ /dev/null
@@ -1,100 +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.datastore.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.datastore.chunk.store.MeasureChunkStoreFactory;
-import org.apache.carbondata.core.datastore.chunk.store.MeasureDataChunkStore;
-import org.apache.carbondata.core.datastore.compression.Compressor;
-import org.apache.carbondata.core.datastore.compression.CompressorFactory;
-import org.apache.carbondata.core.datastore.compression.ValueCompressionHolder;
-import org.apache.carbondata.core.metadata.datatype.DataType;
-import org.apache.carbondata.core.util.ValueCompressionUtil;
-
-public class CompressionNonDecimalShort extends ValueCompressionHolder<short[]> {
-  /**
-   * Attribute for Carbon LOGGER
-   */
-  private static final LogService LOGGER =
-      LogServiceFactory.getLogService(CompressionNonDecimalShort.class.getName());
-  /**
-   * shortCompressor.
-   */
-  private static Compressor compressor = CompressorFactory.getInstance().getCompressor();
-  /**
-   * value.
-   */
-  private short[] value;
-
-  private MeasureDataChunkStore<short[]> measureChunkStore;
-
-  private double divisionFactory;
-
-  @Override public void setValue(short[] value) {
-    this.value = value;
-  }
-
-  @Override public short[] getValue() {
-    return this.value;
-  }
-
-  @Override public void compress() {
-    compressedValue = super.compress(compressor, DataType.SHORT, value);
-  }
-
-  @Override public void uncompress(DataType dataType, byte[] compressedData, int offset, int length,
-      int decimalPlaces, Object maxValueObject, int numberOfRows) {
-    super.unCompress(compressor, dataType, compressedData, offset, length, numberOfRows,
-        maxValueObject, decimalPlaces);
-  }
-
-  @Override public void setValueInBytes(byte[] value) {
-    ByteBuffer buffer = ByteBuffer.wrap(value);
-    this.value = ValueCompressionUtil.convertToShortArray(buffer, value.length);
-  }
-
-  @Override public long getLongValue(int index) {
-    throw new UnsupportedOperationException(
-        "Long value is not defined for CompressionNonDecimalShort");
-  }
-
-  @Override public double getDoubleValue(int index) {
-    return (measureChunkStore.getShort(index) / this.divisionFactory);
-  }
-
-  @Override public BigDecimal getBigDecimalValue(int index) {
-    throw new UnsupportedOperationException(
-        "Big decimal value is not defined for CompressionNonDecimalShort");
-  }
-
-  @Override public void freeMemory() {
-    this.measureChunkStore.freeMemory();
-  }
-
-  @Override
-  public void setValue(short[] data, int numberOfRows, Object maxValueObject, int decimalPlaces) {
-    this.measureChunkStore = MeasureChunkStoreFactory.INSTANCE
-        .getMeasureDataChunkStore(DataType.SHORT, numberOfRows);
-    this.measureChunkStore.putData(data);
-    this.divisionFactory = Math.pow(10, decimalPlaces);
-  }
-}

http://git-wip-us.apache.org/repos/asf/carbondata/blob/edda2483/core/src/main/java/org/apache/carbondata/core/datastore/compression/none/CompressionNoneByte.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/carbondata/core/datastore/compression/none/CompressionNoneByte.java b/core/src/main/java/org/apache/carbondata/core/datastore/compression/none/CompressionNoneByte.java
deleted file mode 100644
index 13af929..0000000
--- a/core/src/main/java/org/apache/carbondata/core/datastore/compression/none/CompressionNoneByte.java
+++ /dev/null
@@ -1,104 +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.datastore.compression.none;
-
-import java.math.BigDecimal;
-
-import org.apache.carbondata.common.logging.LogService;
-import org.apache.carbondata.common.logging.LogServiceFactory;
-import org.apache.carbondata.core.datastore.chunk.store.MeasureChunkStoreFactory;
-import org.apache.carbondata.core.datastore.chunk.store.MeasureDataChunkStore;
-import org.apache.carbondata.core.datastore.compression.Compressor;
-import org.apache.carbondata.core.datastore.compression.CompressorFactory;
-import org.apache.carbondata.core.datastore.compression.ValueCompressionHolder;
-import org.apache.carbondata.core.metadata.datatype.DataType;
-
-public class CompressionNoneByte extends ValueCompressionHolder<byte[]> {
-  /**
-   * Attribute for Carbon LOGGER
-   */
-  private static final LogService LOGGER =
-      LogServiceFactory.getLogService(CompressionNoneByte.class.getName());
-
-  /**
-   * byteCompressor.
-   */
-  private static Compressor compressor = CompressorFactory.getInstance().getCompressor();
-
-  /**
-   * value.
-   */
-  private byte[] value;
-
-  /**
-   * actual data type
-   */
-  private DataType actualDataType;
-
-  private MeasureDataChunkStore<byte[]> measureChunkStore;
-
-  public CompressionNoneByte(DataType actualDataType) {
-    this.actualDataType = actualDataType;
-  }
-
-  @Override public void setValue(byte[] value) {
-    this.value = value;
-  }
-
-  @Override
-  public void uncompress(DataType dataType, byte[] data, int offset, int length, int decimalPlaces,
-      Object maxValueObject, int numberOfRows) {
-    super.unCompress(compressor, dataType, data, offset, length, numberOfRows, maxValueObject,
-        decimalPlaces);
-  }
-
-  @Override public byte[] getValue() {
-    return this.value;
-  }
-
-  @Override public void compress() {
-    compressedValue = super.compress(compressor, DataType.BYTE, value);
-  }
-
-  @Override public void setValueInBytes(byte[] value) {
-    this.value = value;
-  }
-
-  @Override public long getLongValue(int index) {
-    return measureChunkStore.getByte(index);
-  }
-
-  @Override public double getDoubleValue(int index) {
-    return measureChunkStore.getByte(index);
-  }
-
-  @Override public BigDecimal getBigDecimalValue(int index) {
-    throw new UnsupportedOperationException("Big decimal is not defined for CompressionNoneByte");
-  }
-
-  @Override public void freeMemory() {
-    this.measureChunkStore.freeMemory();
-  }
-
-  @Override
-  public void setValue(byte[] data, int numberOfRows, Object maxValueObject, int decimalPlaces) {
-    this.measureChunkStore = MeasureChunkStoreFactory.INSTANCE
-        .getMeasureDataChunkStore(DataType.BYTE, numberOfRows);
-    this.measureChunkStore.putData(data);
-  }
-}

http://git-wip-us.apache.org/repos/asf/carbondata/blob/edda2483/core/src/main/java/org/apache/carbondata/core/datastore/compression/none/CompressionNoneDefault.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/carbondata/core/datastore/compression/none/CompressionNoneDefault.java b/core/src/main/java/org/apache/carbondata/core/datastore/compression/none/CompressionNoneDefault.java
deleted file mode 100644
index cca7927..0000000
--- a/core/src/main/java/org/apache/carbondata/core/datastore/compression/none/CompressionNoneDefault.java
+++ /dev/null
@@ -1,103 +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.datastore.compression.none;
-
-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.datastore.chunk.store.MeasureChunkStoreFactory;
-import org.apache.carbondata.core.datastore.chunk.store.MeasureDataChunkStore;
-import org.apache.carbondata.core.datastore.compression.Compressor;
-import org.apache.carbondata.core.datastore.compression.CompressorFactory;
-import org.apache.carbondata.core.datastore.compression.ValueCompressionHolder;
-import org.apache.carbondata.core.metadata.datatype.DataType;
-import org.apache.carbondata.core.util.ValueCompressionUtil;
-
-public class CompressionNoneDefault extends ValueCompressionHolder<double[]> {
-  /**
-   * Attribute for Carbon LOGGER
-   */
-  private static final LogService LOGGER =
-      LogServiceFactory.getLogService(CompressionNoneDefault.class.getName());
-  /**
-   * doubleCompressor.
-   */
-  private static Compressor compressor = CompressorFactory.getInstance().getCompressor();
-  /**
-   * value.
-   */
-  private double[] value;
-
-  private DataType actualDataType;
-
-  private MeasureDataChunkStore<double[]> measureChunkStore;
-
-  public CompressionNoneDefault(DataType actualDataType) {
-    this.actualDataType = actualDataType;
-  }
-
-  @Override public void setValue(double[] value) {
-    this.value = value;
-  }
-
-  @Override
-  public void uncompress(DataType dataType, byte[] data, int offset, int length, int decimalPlaces,
-      Object maxValueObject, int numberOfRows) {
-    super.unCompress(compressor, dataType, data, offset, length, numberOfRows, maxValueObject,
-        decimalPlaces);
-  }
-
-  @Override public double[] getValue() {
-    return this.value;
-  }
-
-  @Override public void compress() {
-    compressedValue = super.compress(compressor, DataType.DOUBLE, 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 CompressionNonDefault");
-  }
-
-  @Override public double getDoubleValue(int index) {
-    return measureChunkStore.getDouble(index);
-  }
-
-  @Override public BigDecimal getBigDecimalValue(int index) {
-    throw new UnsupportedOperationException(
-        "Big decimal is not defined for CompressionNoneDefault");
-  }
-
-  @Override public void freeMemory() {
-    this.measureChunkStore.freeMemory();
-  }
-
-  @Override
-  public void setValue(double[] data, int numberOfRows, Object maxValueObject, int decimalPlaces) {
-    this.measureChunkStore = MeasureChunkStoreFactory.INSTANCE
-        .getMeasureDataChunkStore(DataType.DOUBLE, numberOfRows);
-    this.measureChunkStore.putData(data);
-  }
-}

http://git-wip-us.apache.org/repos/asf/carbondata/blob/edda2483/core/src/main/java/org/apache/carbondata/core/datastore/compression/none/CompressionNoneInt.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/carbondata/core/datastore/compression/none/CompressionNoneInt.java b/core/src/main/java/org/apache/carbondata/core/datastore/compression/none/CompressionNoneInt.java
deleted file mode 100644
index f5bb813..0000000
--- a/core/src/main/java/org/apache/carbondata/core/datastore/compression/none/CompressionNoneInt.java
+++ /dev/null
@@ -1,102 +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.datastore.compression.none;
-
-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.datastore.chunk.store.MeasureChunkStoreFactory;
-import org.apache.carbondata.core.datastore.chunk.store.MeasureDataChunkStore;
-import org.apache.carbondata.core.datastore.compression.Compressor;
-import org.apache.carbondata.core.datastore.compression.CompressorFactory;
-import org.apache.carbondata.core.datastore.compression.ValueCompressionHolder;
-import org.apache.carbondata.core.metadata.datatype.DataType;
-import org.apache.carbondata.core.util.ValueCompressionUtil;
-
-public class CompressionNoneInt extends ValueCompressionHolder<int[]> {
-  /**
-   * Attribute for Carbon LOGGER
-   */
-  private static final LogService LOGGER =
-      LogServiceFactory.getLogService(CompressionNoneInt.class.getName());
-  /**
-   * intCompressor.
-   */
-  private static Compressor compressor = CompressorFactory.getInstance().getCompressor();
-  /**
-   * value.
-   */
-  private int[] value;
-
-  private DataType actualDataType;
-
-  private MeasureDataChunkStore<int[]> measureChunkStore;
-
-  public CompressionNoneInt(DataType actualDataType) {
-    this.actualDataType = actualDataType;
-  }
-
-  @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.INT, value);
-  }
-
-  @Override
-  public void uncompress(DataType dataType, byte[] data, int offset, int length, int decimalPlaces,
-      Object maxValueObject, int numberOfRows) {
-    super.unCompress(compressor, dataType, data, offset, length, numberOfRows, maxValueObject,
-        decimalPlaces);
-  }
-
-  @Override public void setValueInBytes(byte[] value) {
-    ByteBuffer buffer = ByteBuffer.wrap(value);
-    this.value = ValueCompressionUtil.convertToIntArray(buffer, value.length);
-  }
-
-  @Override public long getLongValue(int index) {
-    return measureChunkStore.getInt(index);
-  }
-
-  @Override public double getDoubleValue(int index) {
-    return measureChunkStore.getInt(index);
-  }
-
-  @Override public BigDecimal getBigDecimalValue(int index) {
-    throw new UnsupportedOperationException("Big decimal is not defined for CompressionNoneLong");
-  }
-
-  @Override public void freeMemory() {
-    this.measureChunkStore.freeMemory();
-  }
-
-  @Override
-  public void setValue(int[] data, int numberOfRows, Object maxValueObject, int decimalPlaces) {
-    this.measureChunkStore =
-        MeasureChunkStoreFactory.INSTANCE.getMeasureDataChunkStore(DataType.INT, numberOfRows);
-    this.measureChunkStore.putData(data);
-  }
-}

http://git-wip-us.apache.org/repos/asf/carbondata/blob/edda2483/core/src/main/java/org/apache/carbondata/core/datastore/compression/none/CompressionNoneLong.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/carbondata/core/datastore/compression/none/CompressionNoneLong.java b/core/src/main/java/org/apache/carbondata/core/datastore/compression/none/CompressionNoneLong.java
deleted file mode 100644
index 99f24ac..0000000
--- a/core/src/main/java/org/apache/carbondata/core/datastore/compression/none/CompressionNoneLong.java
+++ /dev/null
@@ -1,103 +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.datastore.compression.none;
-
-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.datastore.chunk.store.MeasureChunkStoreFactory;
-import org.apache.carbondata.core.datastore.chunk.store.MeasureDataChunkStore;
-import org.apache.carbondata.core.datastore.compression.Compressor;
-import org.apache.carbondata.core.datastore.compression.CompressorFactory;
-import org.apache.carbondata.core.datastore.compression.ValueCompressionHolder;
-import org.apache.carbondata.core.metadata.datatype.DataType;
-import org.apache.carbondata.core.util.ValueCompressionUtil;
-
-public class CompressionNoneLong extends ValueCompressionHolder<long[]> {
-  /**
-   * Attribute for Carbon LOGGER
-   */
-  private static final LogService LOGGER =
-      LogServiceFactory.getLogService(CompressionNoneLong.class.getName());
-  /**
-   * longCompressor.
-   */
-  private static Compressor compressor = CompressorFactory.getInstance().getCompressor();
-  /**
-   * value.
-   */
-  protected long[] value;
-
-  private DataType actualDataType;
-
-  private MeasureDataChunkStore<long[]> measureChunkStore;
-
-  public CompressionNoneLong(DataType actualDataType) {
-    this.actualDataType = actualDataType;
-  }
-
-  @Override public void setValue(long[] value) {
-    this.value = value;
-  }
-
-  @Override public long[] getValue() {
-    return this.value;
-  }
-
-  @Override public void compress() {
-    compressedValue = super.compress(compressor, DataType.LONG, value);
-  }
-
-  @Override
-  public void uncompress(DataType dataType, byte[] data, int offset, int length, int decimalPlaces,
-      Object maxValueObject, int numberOfRows) {
-    super.unCompress(compressor, dataType, data, offset, length, numberOfRows, maxValueObject,
-        decimalPlaces);
-  }
-
-  @Override public void setValueInBytes(byte[] byteValue) {
-    ByteBuffer buffer = ByteBuffer.wrap(byteValue);
-    this.value = ValueCompressionUtil.convertToLongArray(buffer, byteValue.length);
-  }
-
-  @Override public long getLongValue(int index) {
-    return measureChunkStore.getLong(index);
-  }
-
-  @Override public double getDoubleValue(int index) {
-    return measureChunkStore.getLong(index);
-  }
-
-  @Override public BigDecimal getBigDecimalValue(int index) {
-    throw new UnsupportedOperationException("Get big decimal is not supported");
-  }
-
-  @Override public void freeMemory() {
-    this.measureChunkStore.freeMemory();
-  }
-
-  @Override
-  public void setValue(long[] data, int numberOfRows, Object maxValueObject, int decimalPlaces) {
-    this.measureChunkStore = MeasureChunkStoreFactory.INSTANCE
-        .getMeasureDataChunkStore(DataType.LONG, numberOfRows);
-    this.measureChunkStore.putData(data);
-
-  }
-}

http://git-wip-us.apache.org/repos/asf/carbondata/blob/edda2483/core/src/main/java/org/apache/carbondata/core/datastore/compression/none/CompressionNoneShort.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/carbondata/core/datastore/compression/none/CompressionNoneShort.java b/core/src/main/java/org/apache/carbondata/core/datastore/compression/none/CompressionNoneShort.java
deleted file mode 100644
index 664f9e4..0000000
--- a/core/src/main/java/org/apache/carbondata/core/datastore/compression/none/CompressionNoneShort.java
+++ /dev/null
@@ -1,104 +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.datastore.compression.none;
-
-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.datastore.chunk.store.MeasureChunkStoreFactory;
-import org.apache.carbondata.core.datastore.chunk.store.MeasureDataChunkStore;
-import org.apache.carbondata.core.datastore.compression.Compressor;
-import org.apache.carbondata.core.datastore.compression.CompressorFactory;
-import org.apache.carbondata.core.datastore.compression.ValueCompressionHolder;
-import org.apache.carbondata.core.metadata.datatype.DataType;
-import org.apache.carbondata.core.util.ValueCompressionUtil;
-
-public class CompressionNoneShort extends ValueCompressionHolder<short[]> {
-  /**
-   * Attribute for Carbon LOGGER
-   */
-  private static final LogService LOGGER =
-      LogServiceFactory.getLogService(CompressionNoneShort.class.getName());
-
-  /**
-   * shortCompressor.
-   */
-  private static Compressor compressor = CompressorFactory.getInstance().getCompressor();
-
-  /**
-   * value.
-   */
-  private short[] shortValue;
-
-  private MeasureDataChunkStore<short[]> measureChunkStore;
-
-  private DataType actualDataType;
-
-  public CompressionNoneShort(DataType actualDataType) {
-    this.actualDataType = actualDataType;
-  }
-
-  @Override public void setValue(short[] shortValue) {
-    this.shortValue = shortValue;
-  }
-
-  @Override public short[] getValue() {
-    return this.shortValue;
-  }
-
-  @Override
-  public void uncompress(DataType dataType, byte[] data, int offset, int length, int decimalPlaces,
-      Object maxValueObject, int numberOfRows) {
-    super.unCompress(compressor, dataType, data, offset, length, numberOfRows, maxValueObject,
-        decimalPlaces);
-  }
-
-  @Override public void compress() {
-    compressedValue = super.compress(compressor, DataType.SHORT, shortValue);
-  }
-
-  @Override public void setValueInBytes(byte[] value) {
-    ByteBuffer buffer = ByteBuffer.wrap(value);
-    shortValue = ValueCompressionUtil.convertToShortArray(buffer, value.length);
-  }
-
-  @Override public long getLongValue(int index) {
-    return measureChunkStore.getShort(index);
-  }
-
-  @Override public double getDoubleValue(int index) {
-    return measureChunkStore.getShort(index);
-  }
-
-  @Override public BigDecimal getBigDecimalValue(int index) {
-    throw new UnsupportedOperationException("Big decimal is not defined for CompressionNonShort");
-  }
-
-  @Override public void freeMemory() {
-    this.measureChunkStore.freeMemory();
-  }
-
-  @Override
-  public void setValue(short[] data, int numberOfRows, Object maxValueObject, int decimalPlaces) {
-    this.measureChunkStore = MeasureChunkStoreFactory.INSTANCE
-        .getMeasureDataChunkStore(DataType.SHORT, numberOfRows);
-    this.measureChunkStore.putData(data);
-  }
-}

http://git-wip-us.apache.org/repos/asf/carbondata/blob/edda2483/core/src/main/java/org/apache/carbondata/core/datastore/dataholder/CarbonReadDataHolder.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/carbondata/core/datastore/dataholder/CarbonReadDataHolder.java b/core/src/main/java/org/apache/carbondata/core/datastore/dataholder/CarbonReadDataHolder.java
deleted file mode 100644
index 0916765..0000000
--- a/core/src/main/java/org/apache/carbondata/core/datastore/dataholder/CarbonReadDataHolder.java
+++ /dev/null
@@ -1,48 +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.datastore.dataholder;
-
-import java.math.BigDecimal;
-
-import org.apache.carbondata.core.datastore.compression.ValueCompressionHolder;
-
-// This class is used with Uncompressor to hold the decompressed column chunk in memory
-public class CarbonReadDataHolder {
-
-  private ValueCompressionHolder unCompressValue;
-
-  public CarbonReadDataHolder(ValueCompressionHolder unCompressValue) {
-    this.unCompressValue = unCompressValue;
-  }
-
-  public long getReadableLongValueByIndex(int index) {
-    return this.unCompressValue.getLongValue(index);
-  }
-
-  public BigDecimal getReadableBigDecimalValueByIndex(int index) {
-    return this.unCompressValue.getBigDecimalValue(index);
-  }
-
-  public double getReadableDoubleValueByIndex(int index) {
-    return this.unCompressValue.getDoubleValue(index);
-  }
-
-  public void freeMemory() {
-    unCompressValue.freeMemory();
-  }
-}

http://git-wip-us.apache.org/repos/asf/carbondata/blob/edda2483/core/src/main/java/org/apache/carbondata/core/datastore/impl/CompressedDataMeasureDataWrapper.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/carbondata/core/datastore/impl/CompressedDataMeasureDataWrapper.java b/core/src/main/java/org/apache/carbondata/core/datastore/impl/CompressedDataMeasureDataWrapper.java
deleted file mode 100644
index 0fd80b4..0000000
--- a/core/src/main/java/org/apache/carbondata/core/datastore/impl/CompressedDataMeasureDataWrapper.java
+++ /dev/null
@@ -1,35 +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.datastore.impl;
-
-import org.apache.carbondata.core.datastore.MeasureDataWrapper;
-import org.apache.carbondata.core.datastore.dataholder.CarbonReadDataHolder;
-
-public class CompressedDataMeasureDataWrapper implements MeasureDataWrapper {
-
-  private final CarbonReadDataHolder[] values;
-
-  public CompressedDataMeasureDataWrapper(final CarbonReadDataHolder[] values) {
-    this.values = values;
-  }
-
-  @Override public CarbonReadDataHolder[] getValues() {
-    return values;
-  }
-
-}

http://git-wip-us.apache.org/repos/asf/carbondata/blob/edda2483/core/src/main/java/org/apache/carbondata/core/datastore/page/ColumnPage.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/carbondata/core/datastore/page/ColumnPage.java b/core/src/main/java/org/apache/carbondata/core/datastore/page/ColumnPage.java
index da3a82e..863d1b0 100644
--- a/core/src/main/java/org/apache/carbondata/core/datastore/page/ColumnPage.java
+++ b/core/src/main/java/org/apache/carbondata/core/datastore/page/ColumnPage.java
@@ -22,22 +22,38 @@ import java.nio.ByteBuffer;
 import java.util.BitSet;
 
 import org.apache.carbondata.core.constants.CarbonCommonConstants;
-import org.apache.carbondata.core.datastore.page.statistics.ColumnPageStatistics;
+import org.apache.carbondata.core.constants.CarbonV3DataFormatConstants;
+import org.apache.carbondata.core.datastore.compression.Compressor;
+import org.apache.carbondata.core.datastore.page.statistics.ColumnPageStatsVO;
 import org.apache.carbondata.core.metadata.datatype.DataType;
+import org.apache.carbondata.core.util.ByteUtil;
+import org.apache.carbondata.core.util.CarbonProperties;
 import org.apache.carbondata.core.util.DataTypeUtil;
 
-// Represent a columnar data in one page for one column.
+import static org.apache.carbondata.core.metadata.datatype.DataType.BYTE;
+import static org.apache.carbondata.core.metadata.datatype.DataType.BYTE_ARRAY;
+import static org.apache.carbondata.core.metadata.datatype.DataType.DECIMAL;
+import static org.apache.carbondata.core.metadata.datatype.DataType.DOUBLE;
+import static org.apache.carbondata.core.metadata.datatype.DataType.FLOAT;
+import static org.apache.carbondata.core.metadata.datatype.DataType.INT;
+import static org.apache.carbondata.core.metadata.datatype.DataType.LONG;
+import static org.apache.carbondata.core.metadata.datatype.DataType.SHORT;
+
+/**
+ * Represent a columnar data in one page for one column.
+ */
 public class ColumnPage {
 
-  protected final DataType dataType;
-  protected final int pageSize;
-  protected ColumnPageStatistics stats;
+  private final int pageSize;
+  private DataType dataType;
+  private ColumnPageStatsVO stats;
 
   // Only one of following fields will be used
   private byte[] byteData;
   private short[] shortData;
   private int[] intData;
   private long[] longData;
+  private float[] floatData;
   private double[] doubleData;
 
   // for string and decimal data
@@ -46,51 +62,123 @@ public class ColumnPage {
   // The index of the rowId whose value is null, will be set to 1
   private BitSet nullBitSet;
 
-  public ColumnPage(DataType dataType, int pageSize) {
-    this.dataType = dataType;
+  protected ColumnPage(DataType dataType, int pageSize) {
     this.pageSize = pageSize;
-    this.stats = new ColumnPageStatistics(dataType);
-    this.nullBitSet = new BitSet(pageSize);
+    this.dataType = dataType;
+  }
+
+  // create a new page
+  public static ColumnPage newPage(DataType dataType, int pageSize) {
+    ColumnPage instance;
     switch (dataType) {
+      case BYTE:
+        instance = newBytePage(new byte[pageSize]);
+        break;
       case SHORT:
+        instance = newShortPage(new short[pageSize]);
+        break;
       case INT:
+        instance = newIntPage(new int[pageSize]);
+        break;
       case LONG:
-        longData = new long[pageSize];
+        instance = newLongPage(new long[pageSize]);
+        break;
+      case FLOAT:
+        instance = newFloatPage(new float[pageSize]);
         break;
       case DOUBLE:
-        doubleData = new double[pageSize];
+        instance = newDoublePage(new double[pageSize]);
         break;
       case DECIMAL:
-        byteArrayData = new byte[pageSize][];
+        instance = newDecimalPage(new byte[pageSize][]);
         break;
-      case STRING:
-        byteArrayData = new byte[pageSize][];
+      case BYTE_ARRAY:
+        instance = newVarLengthPage(new byte[pageSize][]);
         break;
       default:
         throw new RuntimeException("Unsupported data dataType: " + dataType);
     }
+    instance.stats = new ColumnPageStatsVO(dataType);
+    instance.nullBitSet = new BitSet(pageSize);
+    return instance;
+  }
+
+  protected static ColumnPage newBytePage(byte[] byteData) {
+    ColumnPage columnPage = new ColumnPage(BYTE, byteData.length);
+    columnPage.byteData = byteData;
+    return columnPage;
+  }
+
+  protected static ColumnPage newShortPage(short[] shortData) {
+    ColumnPage columnPage = new ColumnPage(SHORT, shortData.length);
+    columnPage.shortData = shortData;
+    return columnPage;
+  }
+
+  protected static ColumnPage newIntPage(int[] intData) {
+    ColumnPage columnPage = new ColumnPage(INT, intData.length);
+    columnPage.intData = intData;
+    return columnPage;
+  }
+
+  protected static ColumnPage newLongPage(long[] longData) {
+    ColumnPage columnPage = new ColumnPage(LONG, longData.length);
+    columnPage.longData = longData;
+    return columnPage;
+  }
+
+  protected static ColumnPage newFloatPage(float[] floatData) {
+    ColumnPage columnPage = new ColumnPage(FLOAT, floatData.length);
+    columnPage.floatData = floatData;
+    return columnPage;
+  }
+
+  protected static ColumnPage newDoublePage(double[] doubleData) {
+    ColumnPage columnPage = new ColumnPage(DOUBLE, doubleData.length);
+    columnPage.doubleData = doubleData;
+    return columnPage;
+  }
+
+  protected static ColumnPage newDecimalPage(byte[][] decimalData) {
+    ColumnPage columnPage = new ColumnPage(DECIMAL, decimalData.length);
+    columnPage.byteArrayData = decimalData;
+    return columnPage;
+  }
+
+  protected static ColumnPage newVarLengthPage(byte[][] stringData) {
+    ColumnPage columnPage = new ColumnPage(BYTE_ARRAY, stringData.length);
+    columnPage.byteArrayData = stringData;
+    return columnPage;
   }
 
   public DataType getDataType() {
     return dataType;
   }
 
-  public ColumnPageStatistics getStatistics() {
+  public ColumnPageStatsVO getStatistics() {
     return stats;
   }
 
+  public int getPageSize() {
+    return pageSize;
+  }
+
   public void putData(int rowId, Object value) {
     if (value == null) {
       putNull(rowId);
+      stats.updateNull();
       return;
     }
     switch (dataType) {
       case BYTE:
+        // TODO: change sort step to store as exact data type
+        putByte(rowId, (byte) value);
+        break;
       case SHORT:
-        putLong(rowId, ((Short) value).longValue());
+        putShort(rowId, (short) value);
         break;
       case INT:
-        putLong(rowId, ((Integer) value).longValue());
+        putInt(rowId, (int) value);
         break;
       case LONG:
         putLong(rowId, (long) value);
@@ -101,8 +189,8 @@ public class ColumnPage {
       case DECIMAL:
         putDecimalBytes(rowId, (byte[]) value);
         break;
-      case STRING:
-        putStringBytes(rowId, (byte[]) value);
+      case BYTE_ARRAY:
+        putBytes(rowId, (byte[]) value);
         break;
       default:
         throw new RuntimeException("unsupported data type: " + dataType);
@@ -161,8 +249,8 @@ public class ColumnPage {
   /**
    * Set string value at rowId
    */
-  public void putStringBytes(int rowId, byte[] stringInBytes) {
-    byteArrayData[rowId] = stringInBytes;
+  public void putBytes(int rowId, byte[] bytes) {
+    byteArrayData[rowId] = bytes;
   }
 
   /**
@@ -172,8 +260,14 @@ public class ColumnPage {
     nullBitSet.set(rowId);
     switch (dataType) {
       case BYTE:
+        putByte(rowId, (byte) 0);
+        break;
       case SHORT:
+        putShort(rowId, (short) 0);
+        break;
       case INT:
+        putInt(rowId, 0);
+        break;
       case LONG:
         putLong(rowId, 0L);
         break;
@@ -188,6 +282,81 @@ public class ColumnPage {
   }
 
   /**
+   * Get byte value at rowId
+   */
+  public byte getByte(int rowId) {
+    return byteData[rowId];
+  }
+
+  /**
+   * Get short value at rowId
+   */
+  public short getShort(int rowId) {
+    return shortData[rowId];
+  }
+
+  /**
+   * Get int value at rowId
+   */
+  public int getInt(int rowId) {
+    return intData[rowId];
+  }
+
+  /**
+   * Get long value at rowId
+   */
+  public long getLong(int rowId) {
+    return longData[rowId];
+  }
+
+  /**
+   * Get float value at rowId
+   */
+  public float getFloat(int rowId) {
+    return floatData[rowId];
+  }
+
+  /**
+   * Get double value at rowId
+   */
+  public double getDouble(int rowId) {
+    return doubleData[rowId];
+  }
+
+  /**
+   * Get decimal value at rowId
+   */
+  public byte[] getDecimalBytes(int rowId) {
+    return byteArrayData[rowId];
+  }
+
+  public BigDecimal getDecimal(int rowId) {
+    byte[] bytes = getDecimalBytes(rowId);
+    return DataTypeUtil.byteToBigDecimal(bytes);
+  }
+
+  /**
+   * Get byte value page
+   */
+  public byte[] getBytePage() {
+    return byteData;
+  }
+
+  /**
+   * Get short value page
+   */
+  public short[] getShortPage() {
+    return shortData;
+  }
+
+  /**
+   * Get int value page
+   */
+  public int[] getIntPage() {
+    return intData;
+  }
+
+  /**
    * Get long value page
    */
   public long[] getLongPage() {
@@ -195,6 +364,13 @@ public class ColumnPage {
   }
 
   /**
+   * Get float value page
+   */
+  public float[] getFloatPage() {
+    return floatData;
+  }
+
+  /**
    * Get double value page
    */
   public double[] getDoublePage() {
@@ -211,7 +387,7 @@ public class ColumnPage {
   /**
    * Get string page
    */
-  public byte[][] getStringPage() {
+  public byte[][] getByteArrayPage() {
     return byteArrayData;
   }
 
@@ -221,4 +397,152 @@ public class ColumnPage {
   public BitSet getNullBitSet() {
     return nullBitSet;
   }
+
+  public void freeMemory() {
+  }
+
+  /**
+   * apply encoding to page data
+   * @param codec type of transformation
+   */
+  public void encode(PrimitiveCodec codec) {
+    switch (dataType) {
+      case BYTE:
+        for (int i = 0; i < pageSize; i++) {
+          codec.encode(i, byteData[i]);
+        }
+        break;
+      case SHORT:
+        for (int i = 0; i < pageSize; i++) {
+          codec.encode(i, shortData[i]);
+        }
+        break;
+      case INT:
+        for (int i = 0; i < pageSize; i++) {
+          codec.encode(i, intData[i]);
+        }
+        break;
+      case LONG:
+        for (int i = 0; i < pageSize; i++) {
+          codec.encode(i, longData[i]);
+        }
+        break;
+      case FLOAT:
+        for (int i = 0; i < pageSize; i++) {
+          codec.encode(i, floatData[i]);
+        }
+        break;
+      case DOUBLE:
+        for (int i = 0; i < pageSize; i++) {
+          codec.encode(i, doubleData[i]);
+        }
+        break;
+      default:
+        throw new UnsupportedOperationException("not support encode on " + dataType + " page");
+    }
+  }
+
+  /**
+   * compress page data using specified compressor
+   */
+  public byte[] compress(Compressor compressor) {
+    switch (dataType) {
+      case BYTE:
+        return compressor.compressByte(getBytePage());
+      case SHORT:
+        return compressor.compressShort(getShortPage());
+      case INT:
+        return compressor.compressInt(getIntPage());
+      case LONG:
+        return compressor.compressLong(getLongPage());
+      case FLOAT:
+        return compressor.compressFloat(getFloatPage());
+      case DOUBLE:
+        return compressor.compressDouble(getDoublePage());
+      case DECIMAL:
+        byte[] flattenedDecimal = ByteUtil.flatten(getDecimalPage());
+        return compressor.compressByte(flattenedDecimal);
+      case BYTE_ARRAY:
+        byte[] flattenedString = ByteUtil.flatten(getByteArrayPage());
+        return compressor.compressByte(flattenedString);
+      default:
+        throw new UnsupportedOperationException("unsupport compress column page: " + dataType);
+    }
+  }
+
+  /**
+   * decompress data and create a column page using the decompressed data
+   */
+  public static ColumnPage decompress(Compressor compressor, DataType dataType,
+      byte[] compressedData, int offset, int length) {
+    switch (dataType) {
+      case BYTE:
+        byte[] byteData = compressor.unCompressByte(compressedData, offset, length);
+        return newBytePage(byteData);
+      case SHORT:
+        short[] shortData = compressor.unCompressShort(compressedData, offset, length);
+        return newShortPage(shortData);
+      case INT:
+        int[] intData = compressor.unCompressInt(compressedData, offset, length);
+        return newIntPage(intData);
+      case LONG:
+        long[] longData = compressor.unCompressLong(compressedData, offset, length);
+        return newLongPage(longData);
+      case FLOAT:
+        float[] floatData = compressor.unCompressFloat(compressedData, offset, length);
+        return newFloatPage(floatData);
+      case DOUBLE:
+        double[] doubleData = compressor.unCompressDouble(compressedData, offset, length);
+        return newDoublePage(doubleData);
+      case DECIMAL:
+        byte[] decompressed = compressor.unCompressByte(compressedData, offset, length);
+        byte[][] decimal = deflatten(decompressed);
+        return newDecimalPage(decimal);
+      case BYTE_ARRAY:
+        decompressed = compressor.unCompressByte(compressedData, offset, length);
+        byte[][] string = deflatten(decompressed);
+        return newVarLengthPage(string);
+      default:
+        throw new UnsupportedOperationException("unsupport uncompress column page: " + dataType);
+    }
+  }
+
+  // input byte[] is LV encoded, this function can expand it into byte[][]
+  private static byte[][] deflatten(byte[] input) {
+    int pageSize = Integer.valueOf(
+        CarbonProperties.getInstance().getProperty(
+            CarbonV3DataFormatConstants.NUMBER_OF_ROWS_PER_BLOCKLET_COLUMN_PAGE,
+            CarbonV3DataFormatConstants.NUMBER_OF_ROWS_PER_BLOCKLET_COLUMN_PAGE_DEFAULT));
+    int numRows = 0;
+    // offset of value of each row in input data
+    int[] offsetOfRow = new int[pageSize];
+    ByteBuffer buffer = ByteBuffer.allocate(CarbonCommonConstants.INT_SIZE_IN_BYTE);
+    for (int currentLength = 0; currentLength < input.length;) {
+      buffer.put(input, currentLength, CarbonCommonConstants.INT_SIZE_IN_BYTE);
+      buffer.flip();
+      int valueLength = buffer.getInt();
+      offsetOfRow[numRows] = currentLength + CarbonCommonConstants.INT_SIZE_IN_BYTE;
+      currentLength += CarbonCommonConstants.INT_SIZE_IN_BYTE + valueLength;
+      buffer.clear();
+      numRows++;
+    }
+    byte[][] byteArrayData = new byte[numRows][];
+    for (int rowId = 0; rowId < numRows; rowId++) {
+      int valueOffset = offsetOfRow[rowId];
+      int valueLength;
+      if (rowId != numRows - 1) {
+        valueLength = offsetOfRow[rowId + 1] - valueOffset - CarbonCommonConstants.INT_SIZE_IN_BYTE;
+      } else {
+        // last row
+        buffer.put(input, offsetOfRow[rowId] - CarbonCommonConstants.INT_SIZE_IN_BYTE,
+            CarbonCommonConstants.INT_SIZE_IN_BYTE);
+        buffer.flip();
+        valueLength = buffer.getInt();
+      }
+      byte[] value = new byte[valueLength];
+      System.arraycopy(input, valueOffset, value, 0, valueLength);
+      byteArrayData[rowId] = value;
+    }
+    return byteArrayData;
+  }
 }

http://git-wip-us.apache.org/repos/asf/carbondata/blob/edda2483/core/src/main/java/org/apache/carbondata/core/datastore/page/ComplexColumnPage.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/carbondata/core/datastore/page/ComplexColumnPage.java b/core/src/main/java/org/apache/carbondata/core/datastore/page/ComplexColumnPage.java
index d50ea4b..d9b8e54 100644
--- a/core/src/main/java/org/apache/carbondata/core/datastore/page/ComplexColumnPage.java
+++ b/core/src/main/java/org/apache/carbondata/core/datastore/page/ComplexColumnPage.java
@@ -23,6 +23,7 @@ import java.util.List;
 
 import org.apache.carbondata.common.CarbonIterator;
 
+
 // Represent a complex column page, e.g. Array, Struct type column
 public class ComplexColumnPage {
 

http://git-wip-us.apache.org/repos/asf/carbondata/blob/edda2483/core/src/main/java/org/apache/carbondata/core/datastore/page/KeyColumnPage.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/carbondata/core/datastore/page/KeyColumnPage.java b/core/src/main/java/org/apache/carbondata/core/datastore/page/KeyColumnPage.java
deleted file mode 100644
index c2c448c..0000000
--- a/core/src/main/java/org/apache/carbondata/core/datastore/page/KeyColumnPage.java
+++ /dev/null
@@ -1,42 +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.datastore.page;
-
-// Represent a MDK columnar data in one page.
-public class KeyColumnPage {
-
-  private byte[][][] keyVector;
-
-  public KeyColumnPage(int pageSize, int numColumn) {
-    keyVector = new byte[numColumn][][];
-    for (int i = 0; i < numColumn; i++) {
-      keyVector[i] = new byte[pageSize][];
-    }
-  }
-
-  public void putKey(int rowId, byte[][] key) {
-    for (int i = 0; i < keyVector.length; i++) {
-      keyVector[i][rowId] = key[i];
-    }
-  }
-
-  public byte[][] getKeyVector(int columnIndex) {
-    return keyVector[columnIndex];
-  }
-
-}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/carbondata/blob/edda2483/core/src/main/java/org/apache/carbondata/core/datastore/page/LazyColumnPage.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/carbondata/core/datastore/page/LazyColumnPage.java b/core/src/main/java/org/apache/carbondata/core/datastore/page/LazyColumnPage.java
new file mode 100644
index 0000000..165e027
--- /dev/null
+++ b/core/src/main/java/org/apache/carbondata/core/datastore/page/LazyColumnPage.java
@@ -0,0 +1,82 @@
+/*
+ * 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.datastore.page;
+
+/**
+ * This is a decorator of column page, it performs transformation lazily (when caller calls getXXX
+ * method to get the value from the page)
+ */
+public class LazyColumnPage extends ColumnPage {
+
+  // decorated column page
+  private ColumnPage columnPage;
+
+  // encode that will apply to page data in getXXX
+  private PrimitiveCodec codec;
+
+  private LazyColumnPage(ColumnPage columnPage, PrimitiveCodec codec) {
+    super(columnPage.getDataType(), columnPage.getPageSize());
+    this.columnPage = columnPage;
+    this.codec = codec;
+  }
+
+  public static ColumnPage newPage(ColumnPage columnPage, PrimitiveCodec transform) {
+    return new LazyColumnPage(columnPage, transform);
+  }
+
+  @Override
+  public String toString() {
+    return String.format("[encode: %s, data type: %s", codec, columnPage.getDataType());
+  }
+
+  @Override
+  public long getLong(int rowId) {
+    switch (columnPage.getDataType()) {
+      case BYTE:
+        return codec.decodeLong(columnPage.getByte(rowId));
+      case SHORT:
+        return codec.decodeLong(columnPage.getShort(rowId));
+      case INT:
+        return codec.decodeLong(columnPage.getInt(rowId));
+      case LONG:
+        return columnPage.getLong(rowId);
+      default:
+        throw new RuntimeException("internal error: " + this.toString());
+    }
+  }
+
+  @Override
+  public double getDouble(int rowId) {
+    switch (columnPage.getDataType()) {
+      case BYTE:
+        return codec.decodeDouble(columnPage.getByte(rowId));
+      case SHORT:
+        return codec.decodeDouble(columnPage.getShort(rowId));
+      case INT:
+        return codec.decodeDouble(columnPage.getInt(rowId));
+      case LONG:
+        return codec.decodeDouble(columnPage.getLong(rowId));
+      case FLOAT:
+        return codec.decodeDouble(columnPage.getFloat(rowId));
+      case DOUBLE:
+        return columnPage.getDouble(rowId);
+      default:
+        throw new RuntimeException("internal error: " + this.toString());
+    }
+  }
+}


Mime
View raw message