You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@carbondata.apache.org by ch...@apache.org on 2016/08/15 07:09:27 UTC
[42/52] [partial] incubator-carbondata git commit: Renamed packages
to org.apache.carbondata and fixed errors
http://git-wip-us.apache.org/repos/asf/incubator-carbondata/blob/cd6a4ff3/core/src/main/java/org/apache/carbondata/core/datastorage/store/columnar/ColumnarKeyStoreInfo.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/carbondata/core/datastorage/store/columnar/ColumnarKeyStoreInfo.java b/core/src/main/java/org/apache/carbondata/core/datastorage/store/columnar/ColumnarKeyStoreInfo.java
new file mode 100644
index 0000000..8f0621e
--- /dev/null
+++ b/core/src/main/java/org/apache/carbondata/core/datastorage/store/columnar/ColumnarKeyStoreInfo.java
@@ -0,0 +1,262 @@
+/*
+ * 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.columnar;
+
+import org.apache.carbondata.core.keygenerator.mdkey.NumberCompressor;
+
+public class ColumnarKeyStoreInfo {
+ private int numberOfKeys;
+
+ private int[] sizeOfEachBlock;
+
+ private int[] keyBlockLengths;
+
+ private long[] keyBlockOffsets;
+
+ private int[] keyBlockIndexLength;
+
+ private long[] keyBlockIndexOffsets;
+
+ private String filePath;
+
+ private boolean[] isSorted;
+
+ private int[] cardinality;
+
+ private NumberCompressor numberCompressor;
+
+ private NumberCompressor[] keyBlockUnCompressor;
+
+ private ColumnGroupModel hybridStoreModel;
+
+ /**
+ * dataIndexMap
+ */
+ private int[] dataIndexMapLength;
+
+ /**
+ * dataIndexMap
+ */
+ private long[] dataIndexMapOffsets;
+
+ /**
+ * aggKeyBlock
+ */
+ private boolean[] aggKeyBlock;
+
+ /**
+ * @return the numberOfKeys
+ */
+ public int getNumberOfKeys() {
+ return numberOfKeys;
+ }
+
+ /**
+ * @param numberOfKeys the numberOfKeys to set
+ */
+ public void setNumberOfKeys(int numberOfKeys) {
+ this.numberOfKeys = numberOfKeys;
+ }
+
+ /**
+ * @return the sizeOfEachBlock
+ */
+ public int[] getSizeOfEachBlock() {
+ return sizeOfEachBlock;
+ }
+
+ /**
+ * @param sizeOfEachBlock the sizeOfEachBlock to set
+ */
+ public void setSizeOfEachBlock(int[] sizeOfEachBlock) {
+ this.sizeOfEachBlock = sizeOfEachBlock;
+ }
+
+ /**
+ * @return the keyBlockLengths
+ */
+ public int[] getKeyBlockLengths() {
+ return keyBlockLengths;
+ }
+
+ /**
+ * @param keyBlockLengths the keyBlockLengths to set
+ */
+ public void setKeyBlockLengths(int[] keyBlockLengths) {
+ this.keyBlockLengths = keyBlockLengths;
+ }
+
+ /**
+ * @return the keyBlockOffsets
+ */
+ public long[] getKeyBlockOffsets() {
+ return keyBlockOffsets;
+ }
+
+ /**
+ * @param keyBlockOffsets the keyBlockOffsets to set
+ */
+ public void setKeyBlockOffsets(long[] keyBlockOffsets) {
+ this.keyBlockOffsets = keyBlockOffsets;
+ }
+
+ /**
+ * @return the keyBlockIndexLength
+ */
+ public int[] getKeyBlockIndexLength() {
+ return keyBlockIndexLength;
+ }
+
+ /**
+ * @param keyBlockIndexLength the keyBlockIndexLength to set
+ */
+ public void setKeyBlockIndexLength(int[] keyBlockIndexLength) {
+ this.keyBlockIndexLength = keyBlockIndexLength;
+ }
+
+ /**
+ * @return the keyBlockIndexOffsets
+ */
+ public long[] getKeyBlockIndexOffsets() {
+ return keyBlockIndexOffsets;
+ }
+
+ /**
+ * @param keyBlockIndexOffsets the keyBlockIndexOffsets to set
+ */
+ public void setKeyBlockIndexOffsets(long[] keyBlockIndexOffsets) {
+ this.keyBlockIndexOffsets = keyBlockIndexOffsets;
+ }
+
+ /**
+ * @return the filePath
+ */
+ public String getFilePath() {
+ return filePath;
+ }
+
+ /**
+ * @param filePath the filePath to set
+ */
+ public void setFilePath(String filePath) {
+ this.filePath = filePath;
+ }
+
+ /**
+ * @return the isSorted
+ */
+ public boolean[] getIsSorted() {
+ return isSorted;
+ }
+
+ /**
+ * @param isSorted the isSorted to set
+ */
+ public void setIsSorted(boolean[] isSorted) {
+ this.isSorted = isSorted;
+ }
+
+ /**
+ * @return the numberCompressor
+ */
+ public NumberCompressor getNumberCompressor() {
+ return numberCompressor;
+ }
+
+ /**
+ * @param numberCompressor the numberCompressor to set
+ */
+ public void setNumberCompressor(NumberCompressor numberCompressor) {
+ this.numberCompressor = numberCompressor;
+ }
+
+ /**
+ * @return the dataIndexMapLength
+ */
+ public int[] getDataIndexMapLength() {
+ return dataIndexMapLength;
+ }
+
+ /**
+ * @param dataIndexMapLength the dataIndexMapLength to set
+ */
+ public void setDataIndexMapLength(int[] dataIndexMapLength) {
+ this.dataIndexMapLength = dataIndexMapLength;
+ }
+
+ /**
+ * @return the dataIndexMapOffsets
+ */
+ public long[] getDataIndexMapOffsets() {
+ return dataIndexMapOffsets;
+ }
+
+ /**
+ * @param dataIndexMapOffsets the dataIndexMapOffsets to set
+ */
+ public void setDataIndexMapOffsets(long[] dataIndexMapOffsets) {
+ this.dataIndexMapOffsets = dataIndexMapOffsets;
+ }
+
+ /**
+ * @return the aggKeyBlock
+ */
+ public boolean[] getAggKeyBlock() {
+ return aggKeyBlock;
+ }
+
+ /**
+ * @param aggKeyBlock the aggKeyBlock to set
+ */
+ public void setAggKeyBlock(boolean[] aggKeyBlock) {
+ this.aggKeyBlock = aggKeyBlock;
+ }
+
+ /**
+ * @return the keyBlockUnCompressor
+ */
+ public NumberCompressor[] getKeyBlockUnCompressor() {
+ return keyBlockUnCompressor;
+ }
+
+ /**
+ * @param keyBlockUnCompressor the keyBlockUnCompressor to set
+ */
+ public void setKeyBlockUnCompressor(NumberCompressor[] keyBlockUnCompressor) {
+ this.keyBlockUnCompressor = keyBlockUnCompressor;
+ }
+
+ public int[] getCardinality() {
+ return cardinality;
+ }
+
+ public void setCardinality(int[] cardinality) {
+ this.cardinality = cardinality;
+ }
+
+ public ColumnGroupModel getHybridStoreModel() {
+ return hybridStoreModel;
+ }
+
+ public void setHybridStoreModel(ColumnGroupModel hybridStoreModel) {
+ this.hybridStoreModel = hybridStoreModel;
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-carbondata/blob/cd6a4ff3/core/src/main/java/org/apache/carbondata/core/datastorage/store/columnar/ColumnarKeyStoreMetadata.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/carbondata/core/datastorage/store/columnar/ColumnarKeyStoreMetadata.java b/core/src/main/java/org/apache/carbondata/core/datastorage/store/columnar/ColumnarKeyStoreMetadata.java
new file mode 100644
index 0000000..a9dcb35
--- /dev/null
+++ b/core/src/main/java/org/apache/carbondata/core/datastorage/store/columnar/ColumnarKeyStoreMetadata.java
@@ -0,0 +1,150 @@
+/*
+ * 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.columnar;
+
+import org.apache.carbondata.core.keygenerator.KeyGenerator;
+import org.apache.carbondata.core.keygenerator.factory.KeyGeneratorFactory;
+
+public class ColumnarKeyStoreMetadata {
+ private boolean isSorted;
+
+ private int[] columnIndex;
+
+ private int[] columnReverseIndex;
+
+ private int eachRowSize;
+
+ private int[] dataIndex;
+
+ private boolean isUnCompressed;
+
+ private KeyGenerator keyGenerator;
+
+ /**
+ * isNoDictionaryValColumn.
+ */
+ private boolean isNoDictionaryValColumn;
+ private boolean isRowStore;
+
+ public ColumnarKeyStoreMetadata(int eachRowSize) {
+ this.eachRowSize = eachRowSize;
+ keyGenerator = KeyGeneratorFactory.getKeyGenerator(new int[] { eachRowSize });
+ }
+
+ /**
+ * @return the isSorted
+ */
+ public boolean isSorted() {
+ return isSorted;
+ }
+
+ /**
+ * @param isSorted the isSorted to set
+ */
+ public void setSorted(boolean isSorted) {
+ this.isSorted = isSorted;
+ }
+
+ /**
+ * @return the columnIndex
+ */
+ public int[] getColumnIndex() {
+ return columnIndex;
+ }
+
+ /**
+ * @param columnIndex the columnIndex to set
+ */
+ public void setColumnIndex(int[] columnIndex) {
+ this.columnIndex = columnIndex;
+ }
+
+ /**
+ * @return the eachRowSize
+ */
+ public int getEachRowSize() {
+ return eachRowSize;
+ }
+
+ /**
+ * @return the dataIndex
+ */
+ public int[] getDataIndex() {
+ return dataIndex;
+ }
+
+ /**
+ * @param dataIndex the dataIndex to set
+ */
+ public void setDataIndex(int[] dataIndex) {
+ this.dataIndex = dataIndex;
+ }
+
+ /**
+ * @return the columnReverseIndex
+ */
+ public int[] getColumnReverseIndex() {
+ return columnReverseIndex;
+ }
+
+ /**
+ * @param columnReverseIndex the columnReverseIndex to set
+ */
+ public void setColumnReverseIndex(int[] columnReverseIndex) {
+ this.columnReverseIndex = columnReverseIndex;
+ }
+
+ public boolean isUnCompressed() {
+ return isUnCompressed;
+ }
+
+ public void setUnCompressed(boolean isUnCompressed) {
+ this.isUnCompressed = isUnCompressed;
+ }
+
+ public KeyGenerator getKeyGenerator() {
+ return keyGenerator;
+ }
+
+ public boolean isRowStore() {
+ return isRowStore;
+ }
+
+ public void setRowStore(boolean isRowStore) {
+ this.isRowStore = isRowStore;
+ }
+
+ /**
+ * @return
+ */
+ public boolean isNoDictionaryValColumn() {
+ return isNoDictionaryValColumn;
+
+ }
+
+ /**
+ * @param isNoDictionaryValColumn
+ */
+ public void setNoDictionaryValColumn(boolean isNoDictionaryValColumn) {
+ this.isNoDictionaryValColumn = isNoDictionaryValColumn;
+
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-carbondata/blob/cd6a4ff3/core/src/main/java/org/apache/carbondata/core/datastorage/store/columnar/IndexStorage.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/carbondata/core/datastorage/store/columnar/IndexStorage.java b/core/src/main/java/org/apache/carbondata/core/datastorage/store/columnar/IndexStorage.java
new file mode 100644
index 0000000..e1f4548
--- /dev/null
+++ b/core/src/main/java/org/apache/carbondata/core/datastorage/store/columnar/IndexStorage.java
@@ -0,0 +1,44 @@
+/*
+ * 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.columnar;
+
+public interface IndexStorage<T> {
+ boolean isAlreadySorted();
+
+ T getDataAfterComp();
+
+ T getIndexMap();
+
+ byte[][] getKeyBlock();
+
+ T getDataIndexMap();
+
+ int getTotalSize();
+
+ /**
+ * @return min value of block
+ */
+ byte[] getMin();
+
+ /**
+ * @return max value of block
+ */
+ byte[] getMax();
+}
http://git-wip-us.apache.org/repos/asf/incubator-carbondata/blob/cd6a4ff3/core/src/main/java/org/apache/carbondata/core/datastorage/store/columnar/UnBlockIndexer.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/carbondata/core/datastorage/store/columnar/UnBlockIndexer.java b/core/src/main/java/org/apache/carbondata/core/datastorage/store/columnar/UnBlockIndexer.java
new file mode 100644
index 0000000..149facb
--- /dev/null
+++ b/core/src/main/java/org/apache/carbondata/core/datastorage/store/columnar/UnBlockIndexer.java
@@ -0,0 +1,78 @@
+/*
+ * 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.columnar;
+
+import java.util.Arrays;
+
+public final class UnBlockIndexer {
+
+ private UnBlockIndexer() {
+
+ }
+
+ public static int[] uncompressIndex(int[] indexData, int[] indexMap) {
+ int actualSize = indexData.length;
+ for (int i = 0; i < indexMap.length; i++) {
+ actualSize += indexData[indexMap[i] + 1] - indexData[indexMap[i]] - 1;
+ }
+ int[] indexes = new int[actualSize];
+ int k = 0;
+ for (int i = 0; i < indexData.length; i++) {
+ int index = Arrays.binarySearch(indexMap, i);
+ if (index > -1) {
+ for (int j = indexData[indexMap[index]]; j <= indexData[indexMap[index] + 1]; j++) {
+ indexes[k] = j;
+ k++;
+ }
+ i++;
+ } else {
+ indexes[k] = indexData[i];
+ k++;
+ }
+ }
+ return indexes;
+ }
+
+ public static byte[] uncompressData(byte[] data, int[] index, int keyLen) {
+ if (index.length < 1) {
+ return data;
+ }
+ int numberOfCopy = 0;
+ int actualSize = 0;
+ int srcPos = 0;
+ int destPos = 0;
+ for (int i = 1; i < index.length; i += 2) {
+ actualSize += index[i];
+ }
+ byte[] uncompressedData = new byte[actualSize * keyLen];
+ int picIndex = 0;
+ for (int i = 0; i < data.length; i += keyLen) {
+ numberOfCopy = index[picIndex * 2 + 1];
+ picIndex++;
+ for (int j = 0; j < numberOfCopy; j++) {
+ System.arraycopy(data, srcPos, uncompressedData, destPos, keyLen);
+ destPos += keyLen;
+ }
+ srcPos += keyLen;
+ }
+ return uncompressedData;
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-carbondata/blob/cd6a4ff3/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
new file mode 100644
index 0000000..67d4cc1
--- /dev/null
+++ b/core/src/main/java/org/apache/carbondata/core/datastorage/store/compression/Compressor.java
@@ -0,0 +1,28 @@
+/*
+ * 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;
+
+public interface Compressor<T> {
+
+ byte[] compress(T input);
+
+ T unCompress(byte[] input);
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-carbondata/blob/cd6a4ff3/core/src/main/java/org/apache/carbondata/core/datastorage/store/compression/MeasureMetaDataModel.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/carbondata/core/datastorage/store/compression/MeasureMetaDataModel.java b/core/src/main/java/org/apache/carbondata/core/datastorage/store/compression/MeasureMetaDataModel.java
new file mode 100644
index 0000000..7d212bb
--- /dev/null
+++ b/core/src/main/java/org/apache/carbondata/core/datastorage/store/compression/MeasureMetaDataModel.java
@@ -0,0 +1,217 @@
+/*
+ * 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;
+
+public class MeasureMetaDataModel {
+ /**
+ * maxValue
+ */
+ private Object[] maxValue;
+
+ /**
+ * minValue
+ */
+ private Object[] minValue;
+
+ /**
+ * decimal
+ */
+ private int[] decimal;
+
+ /**
+ * measureCount
+ */
+ private int measureCount;
+
+ /**
+ * uniqueValue
+ */
+ private Object[] uniqueValue;
+
+ /**
+ * type
+ */
+ private char[] type;
+
+ /**
+ * dataTypeSelected
+ */
+ private byte[] dataTypeSelected;
+
+ private Object[] minValueFactForAgg;
+
+ public MeasureMetaDataModel() {
+
+ }
+
+ /**
+ * MeasureMetaDataModel Constructor
+ *
+ * @param minValue
+ * @param maxValue
+ * @param decimal
+ * @param measureCount
+ * @param uniqueValue
+ * @param type
+ */
+ public MeasureMetaDataModel(Object[] minValue, Object[] maxValue, int[] decimal, int measureCount,
+ Object[] uniqueValue, char[] type, byte[] dataTypeSelected) {
+ this.minValue = minValue;
+ this.maxValue = maxValue;
+ this.decimal = decimal;
+ this.measureCount = measureCount;
+ this.uniqueValue = uniqueValue;
+ this.type = type;
+ this.dataTypeSelected = dataTypeSelected;
+ }
+
+ /**
+ * get Max value
+ *
+ * @return
+ */
+ public Object[] getMaxValue() {
+ return maxValue;
+ }
+
+ /**
+ * set max value
+ *
+ * @param maxValue
+ */
+ public void setMaxValue(Object[] maxValue) {
+ this.maxValue = maxValue;
+ }
+
+ /**
+ * getMinValue
+ *
+ * @return
+ */
+ public Object[] getMinValue() {
+ return minValue;
+ }
+
+ /**
+ * setMinValue
+ *
+ * @param minValue
+ */
+ public void setMinValue(Object[] minValue) {
+ this.minValue = minValue;
+ }
+
+ /**
+ * getDecimal
+ *
+ * @return
+ */
+ public int[] getDecimal() {
+ return decimal;
+ }
+
+ /**
+ * setDecimal
+ *
+ * @param decimal
+ */
+ public void setDecimal(int[] decimal) {
+ this.decimal = decimal;
+ }
+
+ /**
+ * getMeasureCount
+ *
+ * @return
+ */
+ public int getMeasureCount() {
+ return measureCount;
+ }
+
+ /**
+ * setMeasureCount
+ *
+ * @param measureCount
+ */
+ public void setMeasureCount(int measureCount) {
+ this.measureCount = measureCount;
+ }
+
+ /**
+ * getUniqueValue
+ *
+ * @return
+ */
+ public Object[] getUniqueValue() {
+ return uniqueValue;
+ }
+
+ /**
+ * setUniqueValue
+ *
+ * @param uniqueValue
+ */
+ public void setUniqueValue(Object[] uniqueValue) {
+ this.uniqueValue = uniqueValue;
+ }
+
+ /**
+ * @return the type
+ */
+ public char[] getType() {
+ return type;
+ }
+
+ /**
+ * @param type the type to set
+ */
+ public void setType(char[] type) {
+ this.type = type;
+ }
+
+ /**
+ * @return the dataTypeSelected
+ */
+ public byte[] getDataTypeSelected() {
+ return dataTypeSelected;
+ }
+
+ /**
+ * @param dataTypeSelected the dataTypeSelected to set
+ */
+ public void setDataTypeSelected(byte[] dataTypeSelected) {
+ this.dataTypeSelected = dataTypeSelected;
+ }
+
+ /**
+ * @return the minValueFactForAgg
+ */
+ public Object[] getMinValueFactForAgg() {
+ return minValueFactForAgg;
+ }
+
+ /**
+ * @param minValueFactForAgg the minValueFactForAgg to set
+ */
+ public void setMinValueFactForAgg(Object[] minValueFactForAgg) {
+ this.minValueFactForAgg = minValueFactForAgg;
+ }
+
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-carbondata/blob/cd6a4ff3/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
new file mode 100644
index 0000000..31717a9
--- /dev/null
+++ b/core/src/main/java/org/apache/carbondata/core/datastorage/store/compression/SnappyCompression.java
@@ -0,0 +1,273 @@
+/*
+ * 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/cd6a4ff3/core/src/main/java/org/apache/carbondata/core/datastorage/store/compression/ValueCompressionModel.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/carbondata/core/datastorage/store/compression/ValueCompressionModel.java b/core/src/main/java/org/apache/carbondata/core/datastorage/store/compression/ValueCompressionModel.java
new file mode 100644
index 0000000..94cbf19
--- /dev/null
+++ b/core/src/main/java/org/apache/carbondata/core/datastorage/store/compression/ValueCompressionModel.java
@@ -0,0 +1,236 @@
+/*
+ * 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.util.ValueCompressionUtil;
+
+public class ValueCompressionModel {
+ /**
+ * COMPRESSION_TYPE[] variable.
+ */
+ private ValueCompressionUtil.COMPRESSION_TYPE[] compType;
+
+ /**
+ * DataType[] variable.
+ */
+ private ValueCompressionUtil.DataType[] changedDataType;
+ /**
+ * DataType[] variable.
+ */
+ private ValueCompressionUtil.DataType[] actualDataType;
+
+ /**
+ * maxValue
+ */
+ private Object[] maxValue;
+ /**
+ * minValue.
+ */
+ private Object[] minValue;
+
+ private Object[] minValueFactForAgg;
+
+ /**
+ * uniqueValue
+ */
+ private Object[] uniqueValue;
+ /**
+ * decimal.
+ */
+ private int[] decimal;
+
+ /**
+ * aggType
+ */
+ private char[] type;
+
+ /**
+ * dataTypeSelected
+ */
+ private byte[] dataTypeSelected;
+ /**
+ * unCompressValues.
+ */
+ private ValueCompressonHolder.UnCompressValue[] unCompressValues;
+
+ /**
+ * @return the compType
+ */
+ public ValueCompressionUtil.COMPRESSION_TYPE[] getCompType() {
+ return compType;
+ }
+
+ /**
+ * @param compType the compType to set
+ */
+ public void setCompType(ValueCompressionUtil.COMPRESSION_TYPE[] compType) {
+ this.compType = compType;
+ }
+
+ /**
+ * @return the changedDataType
+ */
+ public ValueCompressionUtil.DataType[] getChangedDataType() {
+ return changedDataType;
+ }
+
+ /**
+ * @param changedDataType the changedDataType to set
+ */
+ public void setChangedDataType(ValueCompressionUtil.DataType[] changedDataType) {
+ this.changedDataType = changedDataType;
+ }
+
+ /**
+ * @return the actualDataType
+ */
+ public ValueCompressionUtil.DataType[] getActualDataType() {
+ return actualDataType;
+ }
+
+ /**
+ * @param actualDataType
+ */
+ public void setActualDataType(ValueCompressionUtil.DataType[] actualDataType) {
+ this.actualDataType = actualDataType;
+ }
+
+ /**
+ * @return the maxValue
+ */
+ public Object[] getMaxValue() {
+ return maxValue;
+ }
+
+ /**
+ * @param maxValue the maxValue to set
+ */
+ public void setMaxValue(Object[] maxValue) {
+ this.maxValue = maxValue;
+ }
+
+ /**
+ * @return the decimal
+ */
+ public int[] getDecimal() {
+ return decimal;
+ }
+
+ /**
+ * @param decimal the decimal to set
+ */
+ public void setDecimal(int[] decimal) {
+ this.decimal = decimal;
+ }
+
+ /**
+ * getUnCompressValues().
+ *
+ * @return the unCompressValues
+ */
+ public ValueCompressonHolder.UnCompressValue[] getUnCompressValues() {
+ return unCompressValues;
+ }
+
+ /**
+ * @param unCompressValues the unCompressValues to set
+ */
+ public void setUnCompressValues(ValueCompressonHolder.UnCompressValue[] unCompressValues) {
+ this.unCompressValues = unCompressValues;
+ }
+
+ /**
+ * getMinValue
+ *
+ * @return
+ */
+ public Object[] getMinValue() {
+ return minValue;
+ }
+
+ /**
+ * setMinValue.
+ *
+ * @param minValue
+ */
+ public void setMinValue(Object[] minValue) {
+ this.minValue = minValue;
+ }
+
+ /**
+ * @return the aggType
+ */
+ public char[] getType() {
+ return type;
+ }
+
+ /**
+ * @param type the type to set
+ */
+ public void setType(char[] type) {
+ this.type = type;
+ }
+
+ /**
+ * @return the dataTypeSelected
+ */
+ public byte[] getDataTypeSelected() {
+ return dataTypeSelected;
+ }
+
+ /**
+ * @param dataTypeSelected the dataTypeSelected to set
+ */
+ public void setDataTypeSelected(byte[] dataTypeSelected) {
+ this.dataTypeSelected = dataTypeSelected;
+ }
+
+ /**
+ * getUniqueValue
+ *
+ * @return
+ */
+ public Object[] getUniqueValue() {
+ return uniqueValue;
+ }
+
+ /**
+ * setUniqueValue
+ *
+ * @param uniqueValue
+ */
+ public void setUniqueValue(Object[] uniqueValue) {
+ this.uniqueValue = uniqueValue;
+ }
+
+ /**
+ * @return the minValueFactForAgg
+ */
+ public Object[] getMinValueFactForAgg() {
+ return minValueFactForAgg;
+ }
+
+ /**
+ * @param minValueFactForAgg the minValueFactForAgg to set
+ */
+ public void setMinValueFactForAgg(Object[] minValueFactForAgg) {
+ this.minValueFactForAgg = minValueFactForAgg;
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-carbondata/blob/cd6a4ff3/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
new file mode 100644
index 0000000..01764ce
--- /dev/null
+++ b/core/src/main/java/org/apache/carbondata/core/datastorage/store/compression/ValueCompressonHolder.java
@@ -0,0 +1,135 @@
+/*
+ * 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.datastorage.store.dataholder.CarbonReadDataHolder;
+import org.apache.carbondata.core.util.ValueCompressionUtil.DataType;
+
+/**
+ * ValueCompressonHolder class.
+ */
+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 ValueCompressonHolder() {
+
+ }
+
+ /**
+ * @param dataType
+ * @param value
+ * @param data
+ */
+ public static void unCompress(DataType dataType, UnCompressValue value, byte[] data) {
+ switch (dataType) {
+ case DATA_BYTE:
+
+ value.setValue(byteCompressor.unCompress(data));
+ break;
+
+ case DATA_SHORT:
+
+ value.setValue(shortCompressor.unCompress(data));
+ break;
+
+ case DATA_INT:
+
+ value.setValue(intCompressor.unCompress(data));
+ break;
+
+ case DATA_LONG:
+ case DATA_BIGINT:
+
+ value.setValue(longCompressor.unCompress(data));
+ break;
+
+ case DATA_FLOAT:
+
+ value.setValue(floatCompressor.unCompress(data));
+ break;
+ default:
+
+ value.setValue(doubleCompressor.unCompress(data));
+ break;
+
+ }
+ }
+
+ /**
+ * interface for UnCompressValue<T>.
+ *
+ * @param <T>
+ */
+
+ public interface UnCompressValue<T> extends Cloneable {
+ // Object getValue(int index, int decimal, double maxValue);
+
+ void setValue(T value);
+
+ void setValueInBytes(byte[] value);
+
+ UnCompressValue<T> getNew();
+
+ UnCompressValue compress();
+
+ UnCompressValue uncompress(DataType dataType);
+
+ byte[] getBackArrayData();
+
+ UnCompressValue getCompressorObject();
+
+ CarbonReadDataHolder getValues(int decimal, Object maxValue);
+
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-carbondata/blob/cd6a4ff3/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
new file mode 100644
index 0000000..b5f7887
--- /dev/null
+++ b/core/src/main/java/org/apache/carbondata/core/datastorage/store/compression/type/UnCompressByteArray.java
@@ -0,0 +1,137 @@
+/*
+ * 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.type;
+
+import java.math.BigDecimal;
+import java.nio.ByteBuffer;
+import java.util.ArrayList;
+import java.util.List;
+
+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.ValueCompressonHolder;
+import org.apache.carbondata.core.datastorage.store.dataholder.CarbonReadDataHolder;
+import org.apache.carbondata.core.util.DataTypeUtil;
+import org.apache.carbondata.core.util.ValueCompressionUtil;
+
+public class UnCompressByteArray implements ValueCompressonHolder.UnCompressValue<byte[]> {
+ /**
+ * Attribute for Carbon LOGGER
+ */
+ private static final LogService LOGGER =
+ LogServiceFactory.getLogService(UnCompressMaxMinByte.class.getName());
+ /**
+ * byteCompressor.
+ */
+ private static Compressor<byte[]> byteCompressor =
+ SnappyCompression.SnappyByteCompression.INSTANCE;
+ private ByteArrayType arrayType;
+ /**
+ * value.
+ */
+ private byte[] value;
+
+ public UnCompressByteArray(ByteArrayType type) {
+ if (type == ByteArrayType.BYTE_ARRAY) {
+ arrayType = ByteArrayType.BYTE_ARRAY;
+ } else {
+ arrayType = ByteArrayType.BIG_DECIMAL;
+ }
+
+ }
+
+ @Override public void setValue(byte[] value) {
+ this.value = value;
+
+ }
+
+ @Override public void setValueInBytes(byte[] value) {
+ this.value = value;
+
+ }
+
+ @Override public ValueCompressonHolder.UnCompressValue<byte[]> getNew() {
+ try {
+ return (ValueCompressonHolder.UnCompressValue) clone();
+ } catch (CloneNotSupportedException e) {
+ LOGGER.error(e, e.getMessage());
+ }
+ return null;
+ }
+
+ @Override public ValueCompressonHolder.UnCompressValue compress() {
+ UnCompressByteArray byte1 = new UnCompressByteArray(arrayType);
+ byte1.setValue(byteCompressor.compress(value));
+ return byte1;
+ }
+
+ @Override
+ public ValueCompressonHolder.UnCompressValue uncompress(ValueCompressionUtil.DataType dataType) {
+ ValueCompressonHolder.UnCompressValue byte1 = new UnCompressByteArray(arrayType);
+ byte1.setValue(byteCompressor.unCompress(value));
+ return byte1;
+ }
+
+ @Override public byte[] getBackArrayData() {
+ return this.value;
+ }
+
+ @Override public ValueCompressonHolder.UnCompressValue getCompressorObject() {
+ return new UnCompressByteArray(arrayType);
+ }
+
+ @Override public CarbonReadDataHolder getValues(int decimal, Object maxValueObject) {
+ List<byte[]> valsList = new ArrayList<byte[]>(CarbonCommonConstants.DEFAULT_COLLECTION_SIZE);
+ ByteBuffer buffer = ByteBuffer.wrap(value);
+ buffer.rewind();
+ int length = 0;
+ byte[] actualValue = null;
+ //CHECKSTYLE:OFF Approval No:Approval-367
+ while (buffer.hasRemaining()) {//CHECKSTYLE:ON
+ length = buffer.getInt();
+ actualValue = new byte[length];
+ buffer.get(actualValue);
+ valsList.add(actualValue);
+
+ }
+ CarbonReadDataHolder holder = new CarbonReadDataHolder();
+ byte[][] value = new byte[valsList.size()][];
+ valsList.toArray(value);
+ if (arrayType == ByteArrayType.BIG_DECIMAL) {
+ BigDecimal[] bigDecimalValues = new BigDecimal[value.length];
+ for (int i = 0; i < value.length; i++) {
+ bigDecimalValues[i] = DataTypeUtil.byteToBigDecimal(value[i]);
+ }
+ holder.setReadableBigDecimalValues(bigDecimalValues);
+ return holder;
+ }
+ holder.setReadableByteValues(value);
+ return holder;
+ }
+
+ public static enum ByteArrayType {
+ BYTE_ARRAY,
+ BIG_DECIMAL
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-carbondata/blob/cd6a4ff3/core/src/main/java/org/apache/carbondata/core/datastorage/store/compression/type/UnCompressDefaultLong.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/carbondata/core/datastorage/store/compression/type/UnCompressDefaultLong.java b/core/src/main/java/org/apache/carbondata/core/datastorage/store/compression/type/UnCompressDefaultLong.java
new file mode 100644
index 0000000..b30932c
--- /dev/null
+++ b/core/src/main/java/org/apache/carbondata/core/datastorage/store/compression/type/UnCompressDefaultLong.java
@@ -0,0 +1,51 @@
+/*
+ * 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.type;
+
+import org.apache.carbondata.common.logging.LogService;
+import org.apache.carbondata.common.logging.LogServiceFactory;
+import org.apache.carbondata.core.datastorage.store.compression.ValueCompressonHolder;
+import org.apache.carbondata.core.datastorage.store.dataholder.CarbonReadDataHolder;
+
+public class UnCompressDefaultLong extends UnCompressNoneLong {
+
+ private static final LogService LOGGER =
+ LogServiceFactory.getLogService(UnCompressDefaultLong.class.getName());
+
+ public ValueCompressonHolder.UnCompressValue getNew() {
+ try {
+ return (ValueCompressonHolder.UnCompressValue) clone();
+ } catch (CloneNotSupportedException clnNotSupportedExc) {
+ LOGGER.error(clnNotSupportedExc,
+ clnNotSupportedExc.getMessage());
+ }
+ return null;
+ }
+
+ @Override public CarbonReadDataHolder getValues(int decimal, Object maxValueObject) {
+ CarbonReadDataHolder dataHolder = new CarbonReadDataHolder();
+ long[] vals = new long[value.length];
+ for (int i = 0; i < vals.length; i++) {
+ vals[i] = value[i];
+ }
+ dataHolder.setReadableLongValues(vals);
+ return dataHolder;
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-carbondata/blob/cd6a4ff3/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
new file mode 100644
index 0000000..e6486c2
--- /dev/null
+++ b/core/src/main/java/org/apache/carbondata/core/datastorage/store/compression/type/UnCompressMaxMinByte.java
@@ -0,0 +1,107 @@
+/*
+ * 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.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.ValueCompressonHolder;
+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;
+import org.apache.carbondata.core.util.ValueCompressionUtil.DataType;
+
+public class UnCompressMaxMinByte implements UnCompressValue<byte[]> {
+
+ /**
+ * Attribute for Carbon LOGGER
+ */
+ private static final LogService LOGGER =
+ LogServiceFactory.getLogService(UnCompressMaxMinByte.class.getName());
+ /**
+ * byteCompressor.
+ */
+ private static Compressor<byte[]> byteCompressor =
+ SnappyCompression.SnappyByteCompression.INSTANCE;
+ /**
+ * value.
+ */
+ protected byte[] value;
+
+ //TODO SIMIAN
+
+ @Override public void setValue(byte[] value) {
+ this.value = value;
+
+ }
+
+ @Override public UnCompressValue getNew() {
+ try {
+ return (UnCompressValue) clone();
+ } catch (CloneNotSupportedException e) {
+ LOGGER.error(e, e.getMessage());
+ }
+ return null;
+ }
+
+ @Override public UnCompressValue compress() {
+
+ UnCompressMaxMinByte byte1 = new UnCompressMaxMinByte();
+ byte1.setValue(byteCompressor.compress(value));
+ return byte1;
+ }
+
+ @Override public UnCompressValue uncompress(DataType dataType) {
+ UnCompressValue byte1 = ValueCompressionUtil.unCompressMaxMin(dataType, dataType);
+ ValueCompressonHolder.unCompress(dataType, byte1, value);
+ return byte1;
+ }
+
+ @Override public byte[] getBackArrayData() {
+ return value;
+ }
+
+ @Override public void setValueInBytes(byte[] value) {
+ this.value = value;
+ }
+
+ /**
+ * @see ValueCompressonHolder.UnCompressValue#getCompressorObject()
+ */
+ @Override public UnCompressValue getCompressorObject() {
+ return new UnCompressMaxMinByte();
+ }
+
+ @Override public CarbonReadDataHolder getValues(int decimal, Object maxValueObject) {
+ double maxValue = (double) maxValueObject;
+ double[] vals = new double[value.length];
+ CarbonReadDataHolder dataHolder = new CarbonReadDataHolder();
+ for (int i = 0; i < vals.length; i++) {
+ if (value[i] == 0) {
+ vals[i] = maxValue;
+ } else {
+ vals[i] = maxValue - value[i];
+ }
+ }
+ dataHolder.setReadableDoubleValues(vals);
+ return dataHolder;
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-carbondata/blob/cd6a4ff3/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
new file mode 100644
index 0000000..c265a44
--- /dev/null
+++ b/core/src/main/java/org/apache/carbondata/core/datastorage/store/compression/type/UnCompressMaxMinByteForLong.java
@@ -0,0 +1,78 @@
+/*
+ * 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.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.ValueCompressonHolder;
+import org.apache.carbondata.core.datastorage.store.dataholder.CarbonReadDataHolder;
+import org.apache.carbondata.core.util.ValueCompressionUtil;
+
+public class UnCompressMaxMinByteForLong extends UnCompressMaxMinByte {
+
+ private static final LogService LOGGER =
+ LogServiceFactory.getLogService(UnCompressMaxMinByteForLong.class.getName());
+ private static Compressor<byte[]> byteCompressor =
+ SnappyCompression.SnappyByteCompression.INSTANCE;
+
+ @Override public ValueCompressonHolder.UnCompressValue getNew() {
+ try {
+ return (ValueCompressonHolder.UnCompressValue) clone();
+ } catch (CloneNotSupportedException e) {
+ LOGGER.error(e, e.getMessage());
+ }
+ return null;
+ }
+
+ @Override public ValueCompressonHolder.UnCompressValue compress() {
+
+ UnCompressMaxMinByteForLong byte1 = new UnCompressMaxMinByteForLong();
+ byte1.setValue(byteCompressor.compress(value));
+ return byte1;
+ }
+
+ @Override
+ public ValueCompressonHolder.UnCompressValue uncompress(ValueCompressionUtil.DataType dataType) {
+ ValueCompressonHolder.UnCompressValue byte1 =
+ ValueCompressionUtil.unCompressMaxMin(dataType, dataType);
+ ValueCompressonHolder.unCompress(dataType, byte1, value);
+ return byte1;
+ }
+
+ @Override public ValueCompressonHolder.UnCompressValue getCompressorObject() {
+ return new UnCompressMaxMinByteForLong();
+ }
+
+ @Override public CarbonReadDataHolder getValues(int decimal, Object maxValueObject) {
+ long maxValue = (long) maxValueObject;
+ long[] vals = new long[value.length];
+ CarbonReadDataHolder dataHolder = new CarbonReadDataHolder();
+ for (int i = 0; i < vals.length; i++) {
+ if (value[i] == 0) {
+ vals[i] = maxValue;
+ } else {
+ vals[i] = maxValue - value[i];
+ }
+ }
+ dataHolder.setReadableLongValues(vals);
+ return dataHolder;
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-carbondata/blob/cd6a4ff3/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
new file mode 100644
index 0000000..df72c61
--- /dev/null
+++ b/core/src/main/java/org/apache/carbondata/core/datastorage/store/compression/type/UnCompressMaxMinDefault.java
@@ -0,0 +1,108 @@
+/*
+ * 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.type;
+
+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.ValueCompressonHolder;
+import org.apache.carbondata.core.datastorage.store.dataholder.CarbonReadDataHolder;
+import org.apache.carbondata.core.util.ValueCompressionUtil;
+import org.apache.carbondata.core.util.ValueCompressionUtil.DataType;
+
+public class UnCompressMaxMinDefault implements ValueCompressonHolder.UnCompressValue<double[]> {
+
+ /**
+ * Attribute for Carbon LOGGER
+ */
+ private static final LogService LOGGER =
+ LogServiceFactory.getLogService(UnCompressMaxMinDefault.class.getName());
+
+ /**
+ * doubleCompressor.
+ */
+ private static Compressor<double[]> doubleCompressor =
+ SnappyCompression.SnappyDoubleCompression.INSTANCE;
+ /**
+ * value.
+ */
+ private double[] value;
+
+ @Override public void setValue(double[] value) {
+ this.value = (double[]) value;
+
+ }
+
+ @Override public ValueCompressonHolder.UnCompressValue getNew() {
+ try {
+ return (ValueCompressonHolder.UnCompressValue) clone();
+ } catch (CloneNotSupportedException ex5) {
+ LOGGER.error(ex5, ex5.getMessage());
+ }
+ return null;
+ }
+
+ @Override public ValueCompressonHolder.UnCompressValue compress() {
+ UnCompressMaxMinByte byte1 = new UnCompressMaxMinByte();
+ byte1.setValue(doubleCompressor.compress(value));
+ return byte1;
+ }
+
+ @Override public ValueCompressonHolder.UnCompressValue uncompress(DataType dataType) {
+ return null;
+ }
+
+ @Override public byte[] getBackArrayData() {
+ return ValueCompressionUtil.convertToBytes(value);
+ }
+
+ @Override public void setValueInBytes(byte[] value) {
+ ByteBuffer buffer = ByteBuffer.wrap(value);
+ this.value = ValueCompressionUtil.convertToDoubleArray(buffer, value.length);
+ }
+
+ /**
+ * @see ValueCompressonHolder.UnCompressValue#getCompressorObject()
+ */
+ @Override public ValueCompressonHolder.UnCompressValue getCompressorObject() {
+ return new UnCompressMaxMinByte();
+ }
+
+ //TODO SIMIAN
+ @Override public CarbonReadDataHolder getValues(int decimal, Object maxValueObject) {
+ double maxValue = (double) maxValueObject;
+ double[] vals = new double[value.length];
+ CarbonReadDataHolder dataHolderInfoObj = new CarbonReadDataHolder();
+ for (int i = 0; i < vals.length; i++) {
+ if (value[i] == 0) {
+ vals[i] = maxValue;
+ } else {
+ vals[i] = maxValue - value[i];
+ }
+
+ }
+ dataHolderInfoObj.setReadableDoubleValues(vals);
+ return dataHolderInfoObj;
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-carbondata/blob/cd6a4ff3/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
new file mode 100644
index 0000000..57a25eb
--- /dev/null
+++ b/core/src/main/java/org/apache/carbondata/core/datastorage/store/compression/type/UnCompressMaxMinDefaultLong.java
@@ -0,0 +1,75 @@
+/*
+ * 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.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.ValueCompressonHolder;
+import org.apache.carbondata.core.datastorage.store.dataholder.CarbonReadDataHolder;
+import org.apache.carbondata.core.util.ValueCompressionUtil;
+
+public class UnCompressMaxMinDefaultLong extends UnCompressMaxMinLong {
+
+ private static final LogService LOGGER =
+ LogServiceFactory.getLogService(UnCompressMaxMinDefaultLong.class.getName());
+ private static Compressor<long[]> longCompressor =
+ SnappyCompression.SnappyLongCompression.INSTANCE;
+
+ @Override public ValueCompressonHolder.UnCompressValue getNew() {
+ try {
+ return (ValueCompressonHolder.UnCompressValue) clone();
+ } catch (CloneNotSupportedException ex5) {
+ LOGGER.error(ex5, ex5.getMessage());
+ }
+ return null;
+ }
+
+ @Override public ValueCompressonHolder.UnCompressValue compress() {
+ UnCompressMaxMinByteForLong byte1 = new UnCompressMaxMinByteForLong();
+ byte1.setValue(longCompressor.compress(value));
+ return byte1;
+ }
+
+ @Override public byte[] getBackArrayData() {
+ return ValueCompressionUtil.convertToBytes(value);
+ }
+
+ @Override public ValueCompressonHolder.UnCompressValue getCompressorObject() {
+ return new UnCompressMaxMinByteForLong();
+ }
+
+ @Override public CarbonReadDataHolder getValues(int decimal, Object maxValueObject) {
+ long maxValue = (long) maxValueObject;
+ long[] vals = new long[value.length];
+ CarbonReadDataHolder dataHolderInfoObj = new CarbonReadDataHolder();
+ for (int i = 0; i < vals.length; i++) {
+ if (value[i] == 0) {
+ vals[i] = maxValue;
+ } else {
+ vals[i] = maxValue - value[i];
+ }
+
+ }
+ dataHolderInfoObj.setReadableLongValues(vals);
+ return dataHolderInfoObj;
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-carbondata/blob/cd6a4ff3/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
new file mode 100644
index 0000000..396c5c0
--- /dev/null
+++ b/core/src/main/java/org/apache/carbondata/core/datastorage/store/compression/type/UnCompressMaxMinFloat.java
@@ -0,0 +1,107 @@
+/*
+ * 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.type;
+
+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.ValueCompressonHolder.UnCompressValue;
+import org.apache.carbondata.core.datastorage.store.dataholder.CarbonReadDataHolder;
+import org.apache.carbondata.core.util.ValueCompressionUtil;
+import org.apache.carbondata.core.util.ValueCompressionUtil.DataType;
+
+public class UnCompressMaxMinFloat implements UnCompressValue<float[]> {
+
+ /**
+ * Attribute for Carbon LOGGER
+ */
+ private static final LogService LOGGER =
+ LogServiceFactory.getLogService(UnCompressMaxMinFloat.class.getName());
+ /**
+ * floatCompressor
+ */
+ private static Compressor<float[]> floatCompressor =
+ SnappyCompression.SnappyFloatCompression.INSTANCE;
+ /**
+ * value.
+ */
+ private float[] value;
+
+ @Override public void setValue(float[] value) {
+ this.value = (float[]) value;
+
+ }
+
+ @Override public UnCompressValue getNew() {
+ try {
+ return (UnCompressValue) clone();
+ } catch (CloneNotSupportedException ex4) {
+ LOGGER.error(ex4, ex4.getMessage());
+ }
+ return null;
+ }
+
+ @Override public UnCompressValue compress() {
+
+ UnCompressMaxMinByte byte1 = new UnCompressMaxMinByte();
+ byte1.setValue(floatCompressor.compress(value));
+ return byte1;
+ }
+
+ @Override public UnCompressValue uncompress(DataType dTypeVal) {
+ return null;
+ }
+
+ @Override public byte[] getBackArrayData() {
+ return ValueCompressionUtil.convertToBytes(value);
+ }
+
+ @Override public void setValueInBytes(byte[] value) {
+ ByteBuffer buffer = ByteBuffer.wrap(value);
+ this.value = ValueCompressionUtil.convertToFloatArray(buffer, value.length);
+ }
+
+ /**
+ * @see ValueCompressonHolder.UnCompressValue#getCompressorObject()
+ */
+ @Override public UnCompressValue getCompressorObject() {
+ return new UnCompressMaxMinByte();
+ }
+
+ @Override public CarbonReadDataHolder getValues(int decimal, Object maxValueObject) {
+ double maxValue = (double) maxValueObject;
+ double[] vals = new double[value.length];
+ CarbonReadDataHolder dataHolderVal = new CarbonReadDataHolder();
+ for (int i = 0; i < vals.length; i++) {
+ if (value[i] == 0) {
+ vals[i] = maxValue;
+ } else {
+ vals[i] = maxValue - value[i];
+ }
+
+ }
+ dataHolderVal.setReadableDoubleValues(vals);
+ return dataHolderVal;
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-carbondata/blob/cd6a4ff3/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
new file mode 100644
index 0000000..a2af61d
--- /dev/null
+++ b/core/src/main/java/org/apache/carbondata/core/datastorage/store/compression/type/UnCompressMaxMinInt.java
@@ -0,0 +1,105 @@
+/*
+ * 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.type;
+
+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.ValueCompressonHolder;
+import org.apache.carbondata.core.datastorage.store.dataholder.CarbonReadDataHolder;
+import org.apache.carbondata.core.util.ValueCompressionUtil;
+
+public class UnCompressMaxMinInt implements ValueCompressonHolder.UnCompressValue<int[]> {
+ /**
+ * Attribute for Carbon LOGGER
+ */
+ private static final LogService LOGGER =
+ LogServiceFactory.getLogService(UnCompressMaxMinInt.class.getName());
+
+ /**
+ * intCompressor.
+ */
+ private static Compressor<int[]> intCompressor = SnappyCompression.SnappyIntCompression.INSTANCE;
+ /**
+ * value.
+ */
+ private int[] value;
+
+ @Override public void setValue(int[] value) {
+ this.value = value;
+
+ }
+
+ @Override public ValueCompressonHolder.UnCompressValue getNew() {
+ try {
+ return (ValueCompressonHolder.UnCompressValue) clone();
+ } catch (CloneNotSupportedException e) {
+ LOGGER.error(e, e.getMessage());
+ }
+ return null;
+ }
+
+ @Override public ValueCompressonHolder.UnCompressValue compress() {
+ UnCompressMaxMinByte byte1 = new UnCompressMaxMinByte();
+ byte1.setValue(intCompressor.compress(value));
+ return byte1;
+ }
+
+ @Override public ValueCompressonHolder.UnCompressValue uncompress(
+ ValueCompressionUtil.DataType dataTypeValue) {
+ return null;
+ }
+
+ @Override public byte[] getBackArrayData() {
+ return ValueCompressionUtil.convertToBytes(value);
+ }
+
+ @Override public void setValueInBytes(byte[] value) {
+ ByteBuffer buffer = ByteBuffer.wrap(value);
+ this.value = ValueCompressionUtil.convertToIntArray(buffer, value.length);
+ }
+
+ /**
+ * @see ValueCompressonHolder.UnCompressValue#getCompressorObject()
+ */
+ @Override public ValueCompressonHolder.UnCompressValue getCompressorObject() {
+ return new UnCompressMaxMinByte();
+ }
+
+ @Override public CarbonReadDataHolder getValues(int decVal, Object maxValueObject) {
+ double maxValue = (double) maxValueObject;
+ double[] vals = new double[value.length];
+ CarbonReadDataHolder dataHolder = new CarbonReadDataHolder();
+ for (int i = 0; i < vals.length; i++) {
+ if (value[i] == 0) {
+ vals[i] = maxValue;
+ } else {
+ vals[i] = maxValue - value[i];
+ }
+
+ }
+ dataHolder.setReadableDoubleValues(vals);
+ return dataHolder;
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-carbondata/blob/cd6a4ff3/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
new file mode 100644
index 0000000..cab3aa2
--- /dev/null
+++ b/core/src/main/java/org/apache/carbondata/core/datastorage/store/compression/type/UnCompressMaxMinLong.java
@@ -0,0 +1,105 @@
+/*
+ * 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.type;
+
+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.ValueCompressonHolder;
+import org.apache.carbondata.core.datastorage.store.dataholder.CarbonReadDataHolder;
+import org.apache.carbondata.core.util.ValueCompressionUtil;
+
+public class UnCompressMaxMinLong implements ValueCompressonHolder.UnCompressValue<long[]> {
+ /**
+ * Attribute for Carbon LOGGER
+ */
+ private static final LogService LOGGER =
+ LogServiceFactory.getLogService(UnCompressMaxMinLong.class.getName());
+ /**
+ * longCompressor.
+ */
+ private static Compressor<long[]> longCompressor =
+ SnappyCompression.SnappyLongCompression.INSTANCE;
+ /**
+ * value.
+ */
+ protected long[] value;
+
+ @Override public ValueCompressonHolder.UnCompressValue getNew() {
+ try {
+ return (ValueCompressonHolder.UnCompressValue) clone();
+ } catch (CloneNotSupportedException e) {
+ LOGGER.error(e, e.getMessage());
+ }
+ return null;
+ }
+
+ @Override public ValueCompressonHolder.UnCompressValue compress() {
+ UnCompressMaxMinByte unCompressByte = new UnCompressMaxMinByte();
+ unCompressByte.setValue(longCompressor.compress(value));
+ return unCompressByte;
+ }
+
+ @Override public void setValue(long[] value) {
+ this.value = value;
+
+ }
+
+ @Override
+ public ValueCompressonHolder.UnCompressValue uncompress(ValueCompressionUtil.DataType dataType) {
+ return null;
+ }
+
+ @Override public byte[] getBackArrayData() {
+ return ValueCompressionUtil.convertToBytes(value);
+ }
+
+ @Override public void setValueInBytes(byte[] value) {
+ ByteBuffer buffer = ByteBuffer.wrap(value);
+ this.value = ValueCompressionUtil.convertToLongArray(buffer, value.length);
+ }
+
+ /**
+ * @see ValueCompressonHolder.UnCompressValue#getCompressorObject()
+ */
+ @Override public ValueCompressonHolder.UnCompressValue getCompressorObject() {
+ return new UnCompressMaxMinByte();
+ }
+
+ @Override public CarbonReadDataHolder getValues(int decimal, Object maxValueObject) {
+ double maxValue = (double) maxValueObject;
+ double[] vals = new double[value.length];
+ CarbonReadDataHolder data = new CarbonReadDataHolder();
+ for (int i = 0; i < vals.length; i++) {
+ if (value[i] == 0) {
+ vals[i] = maxValue;
+ } else {
+ vals[i] = maxValue - value[i];
+ }
+
+ }
+ data.setReadableDoubleValues(vals);
+ return data;
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-carbondata/blob/cd6a4ff3/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
new file mode 100644
index 0000000..884c430
--- /dev/null
+++ b/core/src/main/java/org/apache/carbondata/core/datastorage/store/compression/type/UnCompressMaxMinShort.java
@@ -0,0 +1,106 @@
+/*
+ * 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.type;
+
+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.ValueCompressonHolder;
+import org.apache.carbondata.core.datastorage.store.dataholder.CarbonReadDataHolder;
+import org.apache.carbondata.core.util.ValueCompressionUtil;
+import org.apache.carbondata.core.util.ValueCompressionUtil.DataType;
+
+public class UnCompressMaxMinShort implements ValueCompressonHolder.UnCompressValue<short[]> {
+ /**
+ * Attribute for Carbon LOGGER
+ */
+ private static final LogService LOGGER =
+ LogServiceFactory.getLogService(UnCompressMaxMinShort.class.getName());
+ /**
+ * shortCompressor.
+ */
+ private static Compressor<short[]> shortCompressor =
+ SnappyCompression.SnappyShortCompression.INSTANCE;
+ /**
+ * value.
+ */
+ private short[] value;
+
+ @Override public void setValue(short[] value) {
+ this.value = value;
+
+ }
+
+ @Override public ValueCompressonHolder.UnCompressValue uncompress(DataType dataType) {
+ return null;
+ }
+
+ @Override public byte[] getBackArrayData() {
+ return ValueCompressionUtil.convertToBytes(value);
+ }
+
+ @Override public ValueCompressonHolder.UnCompressValue getNew() {
+ try {
+ return (ValueCompressonHolder.UnCompressValue) clone();
+ } catch (CloneNotSupportedException ex3) {
+ LOGGER.error(ex3, ex3.getMessage());
+ }
+ return null;
+ }
+
+ @Override public ValueCompressonHolder.UnCompressValue compress() {
+
+ UnCompressMaxMinByte byte1 = new UnCompressMaxMinByte();
+ byte1.setValue(shortCompressor.compress(value));
+ return byte1;
+ }
+
+ @Override public void setValueInBytes(byte[] value) {
+ ByteBuffer buffer = ByteBuffer.wrap(value);
+ this.value = ValueCompressionUtil.convertToShortArray(buffer, value.length);
+ }
+
+ /**
+ * @see ValueCompressonHolder.UnCompressValue#getCompressorObject()
+ */
+ @Override public ValueCompressonHolder.UnCompressValue getCompressorObject() {
+ return new UnCompressMaxMinByte();
+ }
+
+ @Override public CarbonReadDataHolder getValues(int decimal, Object maxValueObject) {
+ double maxValue = (double) maxValueObject;
+ double[] vals = new double[value.length];
+ CarbonReadDataHolder carbonDataHolderObj = new CarbonReadDataHolder();
+ for (int i = 0; i < vals.length; i++) {
+ if (value[i] == 0) {
+ vals[i] = maxValue;
+ } else {
+ vals[i] = maxValue - value[i];
+ }
+
+ }
+ carbonDataHolderObj.setReadableDoubleValues(vals);
+ return carbonDataHolderObj;
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-carbondata/blob/cd6a4ff3/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
new file mode 100644
index 0000000..7a81789
--- /dev/null
+++ b/core/src/main/java/org/apache/carbondata/core/datastorage/store/compression/type/UnCompressNonDecimalByte.java
@@ -0,0 +1,97 @@
+/*
+ * 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.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.ValueCompressonHolder;
+import org.apache.carbondata.core.datastorage.store.dataholder.CarbonReadDataHolder;
+import org.apache.carbondata.core.util.ValueCompressionUtil;
+import org.apache.carbondata.core.util.ValueCompressionUtil.DataType;
+
+public class UnCompressNonDecimalByte implements ValueCompressonHolder.UnCompressValue<byte[]> {
+ /**
+ * Attribute for Carbon LOGGER
+ */
+ private static final LogService LOGGER =
+ LogServiceFactory.getLogService(UnCompressNonDecimalByte.class.getName());
+ /**
+ * byteCompressor.
+ */
+ private static Compressor<byte[]> byteCompressor =
+ SnappyCompression.SnappyByteCompression.INSTANCE;
+ /**
+ * value.
+ */
+ private byte[] value;
+
+ @Override public void setValue(byte[] value) {
+ this.value = value;
+ }
+
+ @Override public ValueCompressonHolder.UnCompressValue getNew() {
+ try {
+ return (ValueCompressonHolder.UnCompressValue) clone();
+ } catch (CloneNotSupportedException e) {
+ LOGGER.error(e, e.getMessage());
+ }
+ return null;
+ }
+
+ @Override public ValueCompressonHolder.UnCompressValue compress() {
+ UnCompressNonDecimalByte byte1 = new UnCompressNonDecimalByte();
+ byte1.setValue(byteCompressor.compress(value));
+ return byte1;
+ }
+
+ @Override public ValueCompressonHolder.UnCompressValue uncompress(DataType dataType) {
+ ValueCompressonHolder.UnCompressValue byte1 =
+ ValueCompressionUtil.unCompressNonDecimal(dataType, dataType);
+ ValueCompressonHolder.unCompress(dataType, byte1, value);
+ return byte1;
+ }
+
+ @Override public void setValueInBytes(byte[] value) {
+ this.value = value;
+ }
+
+ @Override public byte[] getBackArrayData() {
+ return value;
+ }
+
+ /**
+ * @see ValueCompressonHolder.UnCompressValue#getCompressorObject()
+ */
+ @Override public ValueCompressonHolder.UnCompressValue getCompressorObject() {
+ return new UnCompressNonDecimalByte();
+ }
+
+ @Override public CarbonReadDataHolder getValues(int decimal, Object maxValueObject) {
+ double[] vals = new double[value.length];
+ CarbonReadDataHolder dataHolder = new CarbonReadDataHolder();
+ for (int i = 0; i < vals.length; i++) {
+ vals[i] = value[i] / Math.pow(10, decimal);
+ }
+ dataHolder.setReadableDoubleValues(vals);
+ return dataHolder;
+ }
+}