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/12/06 15:49:43 UTC
[4/6] incubator-carbondata git commit: change package name
http://git-wip-us.apache.org/repos/asf/incubator-carbondata/blob/360edc8d/core/src/main/java/org/apache/carbondata/core/datastorage/store/compression/nondecimal/UnCompressNonDecimalLong.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/carbondata/core/datastorage/store/compression/nondecimal/UnCompressNonDecimalLong.java b/core/src/main/java/org/apache/carbondata/core/datastorage/store/compression/nondecimal/UnCompressNonDecimalLong.java
new file mode 100644
index 0000000..c717846
--- /dev/null
+++ b/core/src/main/java/org/apache/carbondata/core/datastorage/store/compression/nondecimal/UnCompressNonDecimalLong.java
@@ -0,0 +1,96 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.carbondata.core.datastorage.store.compression.nondecimal;
+
+import java.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.CompressorFactory;
+import org.apache.carbondata.core.datastorage.store.compression.ValueCompressonHolder.UnCompressValue;
+import org.apache.carbondata.core.datastorage.store.dataholder.CarbonReadDataHolder;
+import org.apache.carbondata.core.util.ValueCompressionUtil;
+import org.apache.carbondata.core.util.ValueCompressionUtil.DataType;
+
+public class UnCompressNonDecimalLong implements UnCompressValue<long[]> {
+ /**
+ * Attribute for Carbon LOGGER
+ */
+ private static final LogService LOGGER =
+ LogServiceFactory.getLogService(UnCompressNonDecimalLong.class.getName());
+
+ /**
+ * longCompressor.
+ */
+ private static Compressor compressor = CompressorFactory.getInstance();
+
+ /**
+ * value.
+ */
+ private long[] value;
+
+ @Override public void setValue(long[] value) {
+ this.value = value;
+ }
+
+ @Override public UnCompressValue compress() {
+ UnCompressNonDecimalByte byte1 = new UnCompressNonDecimalByte();
+ byte1.setValue(compressor.compressLong(value));
+ return byte1;
+ }
+
+ @Override public UnCompressValue getNew() {
+ try {
+ return (UnCompressValue) clone();
+ } catch (CloneNotSupportedException e) {
+ LOGGER.error(e, e.getMessage());
+ }
+ return null;
+ }
+
+ @Override public UnCompressValue uncompress(DataType dataType) {
+ return null;
+ }
+
+ @Override public byte[] getBackArrayData() {
+ return ValueCompressionUtil.convertToBytes(value);
+ }
+
+ @Override public void setValueInBytes(byte[] bytes) {
+ ByteBuffer buffer = ByteBuffer.wrap(bytes);
+ this.value = ValueCompressionUtil.convertToLongArray(buffer, bytes.length);
+ }
+
+ @Override public UnCompressValue getCompressorObject() {
+ return new UnCompressNonDecimalByte();
+ }
+
+ @Override public CarbonReadDataHolder getValues(int decimal, Object maxValueObject) {
+ double[] vals = new double[value.length];
+ for (int i = 0; i < vals.length; i++) {
+ vals[i] = value[i] / Math.pow(10, decimal);
+ }
+ CarbonReadDataHolder dataHolder = new CarbonReadDataHolder();
+ dataHolder.setReadableDoubleValues(vals);
+ return dataHolder;
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-carbondata/blob/360edc8d/core/src/main/java/org/apache/carbondata/core/datastorage/store/compression/nondecimal/UnCompressNonDecimalMaxMinByte.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/carbondata/core/datastorage/store/compression/nondecimal/UnCompressNonDecimalMaxMinByte.java b/core/src/main/java/org/apache/carbondata/core/datastorage/store/compression/nondecimal/UnCompressNonDecimalMaxMinByte.java
new file mode 100644
index 0000000..42629ff
--- /dev/null
+++ b/core/src/main/java/org/apache/carbondata/core/datastorage/store/compression/nondecimal/UnCompressNonDecimalMaxMinByte.java
@@ -0,0 +1,111 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.carbondata.core.datastorage.store.compression.nondecimal;
+
+import java.math.BigDecimal;
+
+import org.apache.carbondata.common.logging.LogService;
+import org.apache.carbondata.common.logging.LogServiceFactory;
+import org.apache.carbondata.core.datastorage.store.compression.Compressor;
+import org.apache.carbondata.core.datastorage.store.compression.CompressorFactory;
+import org.apache.carbondata.core.datastorage.store.compression.ValueCompressonHolder;
+import org.apache.carbondata.core.datastorage.store.dataholder.CarbonReadDataHolder;
+import org.apache.carbondata.core.util.ValueCompressionUtil;
+import org.apache.carbondata.core.util.ValueCompressionUtil.DataType;
+
+public class UnCompressNonDecimalMaxMinByte
+ implements ValueCompressonHolder.UnCompressValue<byte[]> {
+ /**
+ * Attribute for Carbon LOGGER
+ */
+ private static final LogService LOGGER =
+ LogServiceFactory.getLogService(UnCompressNonDecimalMaxMinByte.class.getName());
+ /**
+ * compressor.
+ */
+ private static Compressor compressor = CompressorFactory.getInstance();
+ /**
+ * value.
+ */
+ private byte[] value;
+
+ @Override public ValueCompressonHolder.UnCompressValue<byte[]> getNew() {
+ try {
+ return (ValueCompressonHolder.UnCompressValue<byte[]>) clone();
+ } catch (CloneNotSupportedException cloneNotSupportedException) {
+ LOGGER.error(cloneNotSupportedException,
+ cloneNotSupportedException.getMessage());
+ }
+ return null;
+ }
+
+ @Override public ValueCompressonHolder.UnCompressValue compress() {
+ UnCompressNonDecimalMaxMinByte byte1 = new UnCompressNonDecimalMaxMinByte();
+ byte1.setValue(compressor.compressByte(value));
+ return byte1;
+ }
+
+ @Override public ValueCompressonHolder.UnCompressValue uncompress(DataType dataType) {
+ ValueCompressonHolder.UnCompressValue byte1 =
+ ValueCompressionUtil.getUnCompressNonDecimalMaxMin(dataType);
+ ValueCompressonHolder.unCompress(dataType, byte1, value);
+ return byte1;
+ }
+
+ @Override public byte[] getBackArrayData() {
+ return value;
+ }
+
+ /**
+ * @see ValueCompressonHolder.UnCompressValue#getCompressorObject()
+ */
+ @Override public ValueCompressonHolder.UnCompressValue getCompressorObject() {
+ return new UnCompressNonDecimalMaxMinByte();
+ }
+
+ @Override public void setValueInBytes(byte[] value) {
+ this.value = value;
+ }
+
+ @Override public CarbonReadDataHolder getValues(int decimalVal, Object maxValueObject) {
+ double maxValue = (double) 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, decimalVal);
+
+ if (value[i] == 0) {
+ vals[i] = maxValue;
+ } else {
+ BigDecimal diff = BigDecimal.valueOf(value[i] / Math.pow(10, decimalVal));
+ BigDecimal max = BigDecimal.valueOf(maxValue);
+ vals[i] = max.subtract(diff).doubleValue();
+ }
+
+ }
+ dataHolder.setReadableDoubleValues(vals);
+ return dataHolder;
+ }
+
+ @Override public void setValue(byte[] value) {
+ this.value = value;
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-carbondata/blob/360edc8d/core/src/main/java/org/apache/carbondata/core/datastorage/store/compression/nondecimal/UnCompressNonDecimalMaxMinDefault.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/carbondata/core/datastorage/store/compression/nondecimal/UnCompressNonDecimalMaxMinDefault.java b/core/src/main/java/org/apache/carbondata/core/datastorage/store/compression/nondecimal/UnCompressNonDecimalMaxMinDefault.java
new file mode 100644
index 0000000..190adbf
--- /dev/null
+++ b/core/src/main/java/org/apache/carbondata/core/datastorage/store/compression/nondecimal/UnCompressNonDecimalMaxMinDefault.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.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.datastorage.store.compression.Compressor;
+import org.apache.carbondata.core.datastorage.store.compression.CompressorFactory;
+import org.apache.carbondata.core.datastorage.store.compression.ValueCompressonHolder.UnCompressValue;
+import org.apache.carbondata.core.datastorage.store.dataholder.CarbonReadDataHolder;
+import org.apache.carbondata.core.util.ValueCompressionUtil;
+import org.apache.carbondata.core.util.ValueCompressionUtil.DataType;
+
+public class UnCompressNonDecimalMaxMinDefault implements UnCompressValue<double[]> {
+ /**
+ * Attribute for Carbon LOGGER
+ */
+ private static final LogService LOGGER =
+ LogServiceFactory.getLogService(UnCompressNonDecimalMaxMinDefault.class.getName());
+ /**
+ * doubleCompressor.
+ */
+ private static Compressor compressor = CompressorFactory.getInstance();
+ /**
+ * value.
+ */
+ private double[] value;
+
+ @Override public void setValue(double[] value) {
+ this.value = value;
+ }
+
+ @Override public UnCompressValue getNew() {
+ try {
+ return (UnCompressValue) clone();
+ } catch (CloneNotSupportedException exce) {
+ LOGGER.error(exce, exce.getMessage());
+ }
+ return null;
+ }
+
+ @Override public UnCompressValue compress() {
+ UnCompressNonDecimalMaxMinByte byte1 = new UnCompressNonDecimalMaxMinByte();
+ byte1.setValue(compressor.compressDouble(value));
+ return byte1;
+ }
+
+ @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);
+ }
+
+ @Override public UnCompressValue getCompressorObject() {
+ return new UnCompressNonDecimalMaxMinByte();
+ }
+
+ @Override public UnCompressValue uncompress(DataType dataType) {
+ return null;
+ }
+
+ @Override public CarbonReadDataHolder getValues(int decimal, Object maxValueObject) {
+ double maxVal = (double) maxValueObject;
+ double[] vals = new double[value.length];
+ CarbonReadDataHolder holder = new CarbonReadDataHolder();
+ for (int i = 0; i < vals.length; i++) {
+ vals[i] = value[i] / Math.pow(10, decimal);
+
+ if (value[i] == 0) {
+ vals[i] = maxVal;
+ } else {
+ BigDecimal diff = BigDecimal.valueOf(value[i] / Math.pow(10, decimal));
+ BigDecimal max = BigDecimal.valueOf(maxVal);
+ vals[i] = max.subtract(diff).doubleValue();
+ }
+
+ }
+ holder.setReadableDoubleValues(vals);
+ return holder;
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-carbondata/blob/360edc8d/core/src/main/java/org/apache/carbondata/core/datastorage/store/compression/nondecimal/UnCompressNonDecimalMaxMinFloat.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/carbondata/core/datastorage/store/compression/nondecimal/UnCompressNonDecimalMaxMinFloat.java b/core/src/main/java/org/apache/carbondata/core/datastorage/store/compression/nondecimal/UnCompressNonDecimalMaxMinFloat.java
new file mode 100644
index 0000000..54ca7b4
--- /dev/null
+++ b/core/src/main/java/org/apache/carbondata/core/datastorage/store/compression/nondecimal/UnCompressNonDecimalMaxMinFloat.java
@@ -0,0 +1,110 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.carbondata.core.datastorage.store.compression.nondecimal;
+
+import java.math.BigDecimal;
+import java.nio.ByteBuffer;
+
+import org.apache.carbondata.common.logging.LogService;
+import org.apache.carbondata.common.logging.LogServiceFactory;
+import org.apache.carbondata.core.datastorage.store.compression.Compressor;
+import org.apache.carbondata.core.datastorage.store.compression.CompressorFactory;
+import org.apache.carbondata.core.datastorage.store.compression.ValueCompressonHolder;
+import org.apache.carbondata.core.datastorage.store.dataholder.CarbonReadDataHolder;
+import org.apache.carbondata.core.util.ValueCompressionUtil;
+
+public class UnCompressNonDecimalMaxMinFloat
+ implements ValueCompressonHolder.UnCompressValue<float[]> {
+ /**
+ * Attribute for Carbon LOGGER
+ */
+ private static final LogService LOGGER =
+ LogServiceFactory.getLogService(UnCompressNonDecimalMaxMinFloat.class.getName());
+ /**
+ * floatCompressor
+ */
+ private static Compressor compressor = CompressorFactory.getInstance();
+ /**
+ * value.
+ */
+ private float[] value;
+
+ @Override public void setValue(float[] value) {
+ this.value = value;
+
+ }
+
+ @Override public ValueCompressonHolder.UnCompressValue getNew() {
+ try {
+ return (ValueCompressonHolder.UnCompressValue) clone();
+ } catch (CloneNotSupportedException exc1) {
+ LOGGER.error(exc1, exc1.getMessage());
+ }
+ return null;
+ }
+
+ @Override public ValueCompressonHolder.UnCompressValue compress() {
+
+ UnCompressNonDecimalMaxMinByte byte1 = new UnCompressNonDecimalMaxMinByte();
+ byte1.setValue(compressor.compressFloat(value));
+ return byte1;
+ }
+
+ @Override public byte[] getBackArrayData() {
+ return ValueCompressionUtil.convertToBytes(value);
+ }
+
+ @Override
+ public ValueCompressonHolder.UnCompressValue uncompress(ValueCompressionUtil.DataType dataType) {
+ return null;
+ }
+
+ @Override public void setValueInBytes(byte[] value) {
+ ByteBuffer buffer = ByteBuffer.wrap(value);
+ this.value = ValueCompressionUtil.convertToFloatArray(buffer, value.length);
+ }
+
+ /**
+ * @see ValueCompressonHolder.UnCompressValue#getCompressorObject()
+ */
+ @Override public ValueCompressonHolder.UnCompressValue getCompressorObject() {
+ return new UnCompressNonDecimalMaxMinByte();
+ }
+
+ @Override public CarbonReadDataHolder getValues(int decimal, Object maxValueObject) {
+ double maxValue = (double) maxValueObject;
+ double[] vals = new double[value.length];
+ CarbonReadDataHolder holder = new CarbonReadDataHolder();
+ for (int i = 0; i < vals.length; i++) {
+ vals[i] = value[i] / Math.pow(10, decimal);
+
+ if (value[i] == 0) {
+ vals[i] = maxValue;
+ } else {
+ BigDecimal diff = BigDecimal.valueOf(value[i] / Math.pow(10, decimal));
+ BigDecimal max = BigDecimal.valueOf(maxValue);
+ vals[i] = max.subtract(diff).doubleValue();
+ }
+ }
+ holder.setReadableDoubleValues(vals);
+ return holder;
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-carbondata/blob/360edc8d/core/src/main/java/org/apache/carbondata/core/datastorage/store/compression/nondecimal/UnCompressNonDecimalMaxMinInt.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/carbondata/core/datastorage/store/compression/nondecimal/UnCompressNonDecimalMaxMinInt.java b/core/src/main/java/org/apache/carbondata/core/datastorage/store/compression/nondecimal/UnCompressNonDecimalMaxMinInt.java
new file mode 100644
index 0000000..3e1b241
--- /dev/null
+++ b/core/src/main/java/org/apache/carbondata/core/datastorage/store/compression/nondecimal/UnCompressNonDecimalMaxMinInt.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.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.datastorage.store.compression.Compressor;
+import org.apache.carbondata.core.datastorage.store.compression.CompressorFactory;
+import org.apache.carbondata.core.datastorage.store.compression.ValueCompressonHolder.UnCompressValue;
+import org.apache.carbondata.core.datastorage.store.dataholder.CarbonReadDataHolder;
+import org.apache.carbondata.core.util.ValueCompressionUtil;
+import org.apache.carbondata.core.util.ValueCompressionUtil.DataType;
+
+public class UnCompressNonDecimalMaxMinInt implements UnCompressValue<int[]> {
+ /**
+ * Attribute for Carbon LOGGER
+ */
+ private static final LogService LOGGER =
+ LogServiceFactory.getLogService(UnCompressNonDecimalMaxMinInt.class.getName());
+ /**
+ * intCompressor.
+ */
+ private static Compressor compressor = CompressorFactory.getInstance();
+ /**
+ * value.
+ */
+ private int[] value;
+
+ @Override public void setValue(int[] value) {
+ this.value = value;
+
+ }
+
+ @Override public UnCompressValue getNew() {
+ try {
+ return (UnCompressValue) clone();
+ } catch (CloneNotSupportedException ex1) {
+ LOGGER.error(ex1, ex1.getMessage());
+ }
+ return null;
+ }
+
+ @Override public UnCompressValue compress() {
+
+ UnCompressNonDecimalMaxMinByte byte1 = new UnCompressNonDecimalMaxMinByte();
+ byte1.setValue(compressor.compressInt(value));
+ return byte1;
+
+ }
+
+ @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);
+ }
+
+ @Override public UnCompressValue getCompressorObject() {
+ return new UnCompressNonDecimalMaxMinByte();
+ }
+
+ @Override public CarbonReadDataHolder getValues(int decimal, Object maxValueObject) {
+ double maxValue = (double) maxValueObject;
+ double[] vals = new double[value.length];
+ CarbonReadDataHolder dataHolderInfo = new CarbonReadDataHolder();
+ for (int i = 0; i < vals.length; i++) {
+ vals[i] = value[i] / Math.pow(10, decimal);
+
+ if (value[i] == 0) {
+ vals[i] = maxValue;
+ } else {
+ BigDecimal diff = BigDecimal.valueOf(value[i] / Math.pow(10, decimal));
+ BigDecimal max = BigDecimal.valueOf(maxValue);
+ vals[i] = max.subtract(diff).doubleValue();
+ }
+
+ }
+ dataHolderInfo.setReadableDoubleValues(vals);
+ return dataHolderInfo;
+ }
+
+ @Override public UnCompressValue uncompress(DataType dataType) {
+ return null;
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-carbondata/blob/360edc8d/core/src/main/java/org/apache/carbondata/core/datastorage/store/compression/nondecimal/UnCompressNonDecimalMaxMinLong.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/carbondata/core/datastorage/store/compression/nondecimal/UnCompressNonDecimalMaxMinLong.java b/core/src/main/java/org/apache/carbondata/core/datastorage/store/compression/nondecimal/UnCompressNonDecimalMaxMinLong.java
new file mode 100644
index 0000000..83976f0
--- /dev/null
+++ b/core/src/main/java/org/apache/carbondata/core/datastorage/store/compression/nondecimal/UnCompressNonDecimalMaxMinLong.java
@@ -0,0 +1,112 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.carbondata.core.datastorage.store.compression.nondecimal;
+
+import java.math.BigDecimal;
+import java.nio.ByteBuffer;
+
+import org.apache.carbondata.common.logging.LogService;
+import org.apache.carbondata.common.logging.LogServiceFactory;
+import org.apache.carbondata.core.datastorage.store.compression.Compressor;
+import org.apache.carbondata.core.datastorage.store.compression.CompressorFactory;
+import org.apache.carbondata.core.datastorage.store.compression.ValueCompressonHolder;
+import org.apache.carbondata.core.datastorage.store.dataholder.CarbonReadDataHolder;
+import org.apache.carbondata.core.util.ValueCompressionUtil;
+
+public class UnCompressNonDecimalMaxMinLong
+ implements ValueCompressonHolder.UnCompressValue<long[]> {
+ /**
+ * Attribute for Carbon LOGGER
+ */
+ private static final LogService LOGGER =
+ LogServiceFactory.getLogService(UnCompressNonDecimalMaxMinLong.class.getName());
+
+ /**
+ * longCompressor.
+ */
+ private static Compressor compressor = CompressorFactory.getInstance();
+ /**
+ * value.
+ */
+ private long[] value;
+
+ @Override public void setValue(long[] value) {
+ this.value = value;
+
+ }
+
+ @Override public ValueCompressonHolder.UnCompressValue getNew() {
+ try {
+ return (ValueCompressonHolder.UnCompressValue) clone();
+ } catch (CloneNotSupportedException exc) {
+ LOGGER.error(exc, exc.getMessage());
+ }
+ return null;
+ }
+
+ @Override public ValueCompressonHolder.UnCompressValue compress() {
+
+ UnCompressNonDecimalMaxMinByte uNonDecByte = new UnCompressNonDecimalMaxMinByte();
+ uNonDecByte.setValue(compressor.compressLong(value));
+ return uNonDecByte;
+ }
+
+ @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 buff = ByteBuffer.wrap(value);
+ this.value = ValueCompressionUtil.convertToLongArray(buff, value.length);
+ }
+
+ /**
+ * @see ValueCompressonHolder.UnCompressValue#getCompressorObject()
+ */
+ @Override public ValueCompressonHolder.UnCompressValue getCompressorObject() {
+ return new UnCompressNonDecimalMaxMinByte();
+ }
+
+ @Override public CarbonReadDataHolder getValues(int decimal, Object maxValueObject) {
+ double maxValue = (double) maxValueObject;
+ double[] vals = new double[value.length];
+ CarbonReadDataHolder carbonDataHolder = new CarbonReadDataHolder();
+ for (int i = 0; i < vals.length; i++) {
+ vals[i] = value[i] / Math.pow(10, decimal);
+
+ if (value[i] == 0) {
+ vals[i] = maxValue;
+ } else {
+ BigDecimal diff = BigDecimal.valueOf(value[i] / Math.pow(10, decimal));
+ BigDecimal max = BigDecimal.valueOf(maxValue);
+ vals[i] = max.subtract(diff).doubleValue();
+ }
+
+ }
+ carbonDataHolder.setReadableDoubleValues(vals);
+ return carbonDataHolder;
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-carbondata/blob/360edc8d/core/src/main/java/org/apache/carbondata/core/datastorage/store/compression/nondecimal/UnCompressNonDecimalMaxMinShort.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/carbondata/core/datastorage/store/compression/nondecimal/UnCompressNonDecimalMaxMinShort.java b/core/src/main/java/org/apache/carbondata/core/datastorage/store/compression/nondecimal/UnCompressNonDecimalMaxMinShort.java
new file mode 100644
index 0000000..60476bd
--- /dev/null
+++ b/core/src/main/java/org/apache/carbondata/core/datastorage/store/compression/nondecimal/UnCompressNonDecimalMaxMinShort.java
@@ -0,0 +1,110 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.carbondata.core.datastorage.store.compression.nondecimal;
+
+import java.math.BigDecimal;
+import java.nio.ByteBuffer;
+
+import org.apache.carbondata.common.logging.LogService;
+import org.apache.carbondata.common.logging.LogServiceFactory;
+import org.apache.carbondata.core.datastorage.store.compression.Compressor;
+import org.apache.carbondata.core.datastorage.store.compression.CompressorFactory;
+import org.apache.carbondata.core.datastorage.store.compression.ValueCompressonHolder;
+import org.apache.carbondata.core.datastorage.store.dataholder.CarbonReadDataHolder;
+import org.apache.carbondata.core.util.ValueCompressionUtil;
+
+public class UnCompressNonDecimalMaxMinShort
+ implements ValueCompressonHolder.UnCompressValue<short[]> {
+ /**
+ * Attribute for Carbon LOGGER
+ */
+ private static final LogService LOGGER =
+ LogServiceFactory.getLogService(UnCompressNonDecimalMaxMinShort.class.getName());
+ /**
+ * compressor.
+ */
+ private static Compressor compressor = CompressorFactory.getInstance();
+ /**
+ * value.
+ */
+ private short[] value;
+
+ @Override public void setValue(short[] value) {
+ this.value = value;
+
+ }
+
+ @Override public ValueCompressonHolder.UnCompressValue getNew() {
+ try {
+ return (ValueCompressonHolder.UnCompressValue) clone();
+ } catch (CloneNotSupportedException exception5) {
+ LOGGER.error(exception5, exception5.getMessage());
+ }
+ return null;
+ }
+
+ @Override public ValueCompressonHolder.UnCompressValue compress() {
+ UnCompressNonDecimalMaxMinByte byte1 = new UnCompressNonDecimalMaxMinByte();
+ byte1.setValue(compressor.compressShort(value));
+ return byte1;
+ }
+
+ @Override public ValueCompressonHolder.UnCompressValue uncompress(
+ ValueCompressionUtil.DataType dataTypeVal) {
+ return null;
+ }
+
+ @Override public byte[] getBackArrayData() {
+ return ValueCompressionUtil.convertToBytes(value);
+ }
+
+ @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 UnCompressNonDecimalMaxMinByte();
+ }
+
+ @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++) {
+ vals[i] = value[i] / Math.pow(10, decimal);
+
+ if (value[i] == 0) {
+ vals[i] = maxValue;
+ } else {
+ BigDecimal diff = BigDecimal.valueOf(value[i] / Math.pow(10, decimal));
+ BigDecimal max = BigDecimal.valueOf(maxValue);
+ vals[i] = max.subtract(diff).doubleValue();
+ }
+
+ }
+ dataHolder.setReadableDoubleValues(vals);
+ return dataHolder;
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-carbondata/blob/360edc8d/core/src/main/java/org/apache/carbondata/core/datastorage/store/compression/nondecimal/UnCompressNonDecimalShort.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/carbondata/core/datastorage/store/compression/nondecimal/UnCompressNonDecimalShort.java b/core/src/main/java/org/apache/carbondata/core/datastorage/store/compression/nondecimal/UnCompressNonDecimalShort.java
new file mode 100644
index 0000000..acf7dd8
--- /dev/null
+++ b/core/src/main/java/org/apache/carbondata/core/datastorage/store/compression/nondecimal/UnCompressNonDecimalShort.java
@@ -0,0 +1,98 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.carbondata.core.datastorage.store.compression.nondecimal;
+
+import java.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.CompressorFactory;
+import org.apache.carbondata.core.datastorage.store.compression.ValueCompressonHolder;
+import org.apache.carbondata.core.datastorage.store.dataholder.CarbonReadDataHolder;
+import org.apache.carbondata.core.util.ValueCompressionUtil;
+
+public class UnCompressNonDecimalShort implements ValueCompressonHolder.UnCompressValue<short[]> {
+ /**
+ * Attribute for Carbon LOGGER
+ */
+ private static final LogService LOGGER =
+ LogServiceFactory.getLogService(UnCompressNonDecimalShort.class.getName());
+ /**
+ * shortCompressor.
+ */
+ private static Compressor compressor = CompressorFactory.getInstance();
+ /**
+ * value.
+ */
+ private short[] value;
+
+ @Override public void setValue(short[] value) {
+ this.value = value;
+
+ }
+
+ @Override public byte[] getBackArrayData() {
+ return ValueCompressionUtil.convertToBytes(value);
+ }
+
+ @Override public ValueCompressonHolder.UnCompressValue getNew() {
+ try {
+ return (ValueCompressonHolder.UnCompressValue) clone();
+ } catch (CloneNotSupportedException exception1) {
+ LOGGER.error(exception1, exception1.getMessage());
+ }
+ return null;
+ }
+
+ @Override public ValueCompressonHolder.UnCompressValue compress() {
+ UnCompressNonDecimalByte byte1 = new UnCompressNonDecimalByte();
+ byte1.setValue(compressor.compressShort(value));
+ return byte1;
+ }
+
+ @Override
+ public ValueCompressonHolder.UnCompressValue uncompress(ValueCompressionUtil.DataType dataType) {
+ return null;
+ }
+
+ @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 UnCompressNonDecimalByte();
+ }
+
+ @Override public CarbonReadDataHolder getValues(int decimal, Object maxValueObject) {
+ CarbonReadDataHolder dataHolder = new CarbonReadDataHolder();
+ double[] vals = new double[value.length];
+ for (int i = 0; i < vals.length; i++) {
+ vals[i] = value[i] / Math.pow(10, decimal);
+ }
+ dataHolder.setReadableDoubleValues(vals);
+ return dataHolder;
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-carbondata/blob/360edc8d/core/src/main/java/org/apache/carbondata/core/datastorage/store/compression/none/UnCompressNoneByte.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/carbondata/core/datastorage/store/compression/none/UnCompressNoneByte.java b/core/src/main/java/org/apache/carbondata/core/datastorage/store/compression/none/UnCompressNoneByte.java
new file mode 100644
index 0000000..1a30f73
--- /dev/null
+++ b/core/src/main/java/org/apache/carbondata/core/datastorage/store/compression/none/UnCompressNoneByte.java
@@ -0,0 +1,128 @@
+/*
+ * 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.none;
+
+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.CompressorFactory;
+import org.apache.carbondata.core.datastorage.store.compression.ValueCompressonHolder;
+import org.apache.carbondata.core.datastorage.store.compression.ValueCompressonHolder.UnCompressValue;
+import org.apache.carbondata.core.datastorage.store.dataholder.CarbonReadDataHolder;
+import org.apache.carbondata.core.util.ValueCompressionUtil;
+import org.apache.carbondata.core.util.ValueCompressionUtil.DataType;
+
+public class UnCompressNoneByte implements UnCompressValue<byte[]> {
+ /**
+ * Attribute for Carbon LOGGER
+ */
+ private static final LogService LOGGER =
+ LogServiceFactory.getLogService(UnCompressNoneByte.class.getName());
+
+ /**
+ * byteCompressor.
+ */
+ private static Compressor compressor = CompressorFactory.getInstance();
+
+ /**
+ * value.
+ */
+ private byte[] value;
+
+ /**
+ * actual data type
+ */
+ private DataType actualDataType;
+
+ public UnCompressNoneByte(DataType actualDataType) {
+ this.actualDataType = actualDataType;
+ }
+
+ @Override public UnCompressValue getNew() {
+ try {
+ return (UnCompressValue) clone();
+ } catch (CloneNotSupportedException e) {
+ LOGGER.error(e, e.getMessage());
+ }
+ return null;
+ }
+
+ @Override public void setValue(byte[] value) {
+ this.value = value;
+ }
+
+ @Override public UnCompressValue uncompress(DataType dataType) {
+ UnCompressValue byte1 = ValueCompressionUtil.getUnCompressNone(dataType, actualDataType);
+ ValueCompressonHolder.unCompress(dataType, byte1, value);
+ return byte1;
+ }
+
+ @Override public UnCompressValue compress() {
+ UnCompressNoneByte byte1 = new UnCompressNoneByte(actualDataType);
+ byte1.setValue(compressor.compressByte(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 UnCompressNoneByte(actualDataType);
+ }
+
+ @Override public CarbonReadDataHolder getValues(int decimal, Object maxValueObject) {
+ switch (actualDataType) {
+ case DATA_BIGINT:
+ return unCompressLong();
+ default:
+ return unCompressDouble();
+ }
+
+ }
+
+ private CarbonReadDataHolder unCompressDouble() {
+ CarbonReadDataHolder dataHldr = new CarbonReadDataHolder();
+ double[] vals = new double[value.length];
+ for (int i = 0; i < vals.length; i++) {
+ vals[i] = value[i];
+ }
+ dataHldr.setReadableDoubleValues(vals);
+ return dataHldr;
+ }
+
+ private CarbonReadDataHolder unCompressLong() {
+ CarbonReadDataHolder dataHldr = new CarbonReadDataHolder();
+ long[] vals = new long[value.length];
+ for (int i = 0; i < vals.length; i++) {
+ vals[i] = value[i];
+ }
+ dataHldr.setReadableLongValues(vals);
+ return dataHldr;
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-carbondata/blob/360edc8d/core/src/main/java/org/apache/carbondata/core/datastorage/store/compression/none/UnCompressNoneDefault.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/carbondata/core/datastorage/store/compression/none/UnCompressNoneDefault.java b/core/src/main/java/org/apache/carbondata/core/datastorage/store/compression/none/UnCompressNoneDefault.java
new file mode 100644
index 0000000..e7e2e4e
--- /dev/null
+++ b/core/src/main/java/org/apache/carbondata/core/datastorage/store/compression/none/UnCompressNoneDefault.java
@@ -0,0 +1,100 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.carbondata.core.datastorage.store.compression.none;
+
+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.CompressorFactory;
+import org.apache.carbondata.core.datastorage.store.compression.ValueCompressonHolder.UnCompressValue;
+import org.apache.carbondata.core.datastorage.store.dataholder.CarbonReadDataHolder;
+import org.apache.carbondata.core.util.ValueCompressionUtil;
+import org.apache.carbondata.core.util.ValueCompressionUtil.DataType;
+
+public class UnCompressNoneDefault implements UnCompressValue<double[]> {
+ /**
+ * Attribute for Carbon LOGGER
+ */
+ private static final LogService LOGGER =
+ LogServiceFactory.getLogService(UnCompressNoneDefault.class.getName());
+ /**
+ * doubleCompressor.
+ */
+ private static Compressor compressor = CompressorFactory.getInstance();
+ /**
+ * value.
+ */
+ private double[] value;
+
+ private DataType actualDataType;
+
+ public UnCompressNoneDefault(DataType actualDataType) {
+ this.actualDataType = actualDataType;
+ }
+
+ @Override public void setValue(double[] value) {
+ this.value = value;
+
+ }
+
+ @Override public UnCompressValue getNew() {
+ try {
+ return (UnCompressValue) clone();
+ } catch (CloneNotSupportedException exception1) {
+ LOGGER.error(exception1, exception1.getMessage());
+ }
+ return null;
+ }
+
+ @Override public UnCompressValue compress() {
+ UnCompressNoneByte byte1 = new UnCompressNoneByte(actualDataType);
+ byte1.setValue(compressor.compressDouble(value));
+ return byte1;
+ }
+
+ @Override public UnCompressValue uncompress(DataType dataType) {
+ return null;
+ }
+
+ /**
+ * @see ValueCompressonHolder.UnCompressValue#getCompressorObject()
+ */
+ @Override public UnCompressValue getCompressorObject() {
+ return new UnCompressNoneByte(actualDataType);
+ }
+
+ @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);
+ }
+
+ @Override public CarbonReadDataHolder getValues(int decimal, Object maxValueObject) {
+ CarbonReadDataHolder dataHolder = new CarbonReadDataHolder();
+ dataHolder.setReadableDoubleValues(value);
+ return dataHolder;
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-carbondata/blob/360edc8d/core/src/main/java/org/apache/carbondata/core/datastorage/store/compression/none/UnCompressNoneFloat.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/carbondata/core/datastorage/store/compression/none/UnCompressNoneFloat.java b/core/src/main/java/org/apache/carbondata/core/datastorage/store/compression/none/UnCompressNoneFloat.java
new file mode 100644
index 0000000..01c9422
--- /dev/null
+++ b/core/src/main/java/org/apache/carbondata/core/datastorage/store/compression/none/UnCompressNoneFloat.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.none;
+
+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.CompressorFactory;
+import org.apache.carbondata.core.datastorage.store.compression.ValueCompressonHolder;
+import org.apache.carbondata.core.datastorage.store.dataholder.CarbonReadDataHolder;
+import org.apache.carbondata.core.util.ValueCompressionUtil;
+import org.apache.carbondata.core.util.ValueCompressionUtil.DataType;
+
+public class UnCompressNoneFloat implements ValueCompressonHolder.UnCompressValue<float[]> {
+ /**
+ * Attribute for Carbon LOGGER
+ */
+ private static final LogService LOGGER =
+ LogServiceFactory.getLogService(UnCompressNoneFloat.class.getName());
+ /**
+ * compressor
+ */
+ private static Compressor compressor = CompressorFactory.getInstance();
+ /**
+ * value.
+ */
+ private float[] value;
+
+ private DataType actualDataType;
+
+ public UnCompressNoneFloat(DataType actualDataType) {
+ this.actualDataType = actualDataType;
+ }
+
+ @Override public void setValue(float[] value) {
+ this.value = value;
+
+ }
+
+ @Override public ValueCompressonHolder.UnCompressValue getNew() {
+ try {
+ return (ValueCompressonHolder.UnCompressValue) clone();
+ } catch (CloneNotSupportedException ex5) {
+ LOGGER.error(ex5, ex5.getMessage());
+ }
+ return null;
+ }
+
+ @Override public ValueCompressonHolder.UnCompressValue compress() {
+ UnCompressNoneByte byte1 = new UnCompressNoneByte(actualDataType);
+ byte1.setValue(compressor.compressFloat(value));
+ return byte1;
+ }
+
+ @Override public void setValueInBytes(byte[] value) {
+ ByteBuffer buffer = ByteBuffer.wrap(value);
+ this.value = ValueCompressionUtil.convertToFloatArray(buffer, value.length);
+ }
+
+ /**
+ * @see ValueCompressonHolder.UnCompressValue#getCompressorObject()
+ */
+ @Override public ValueCompressonHolder.UnCompressValue getCompressorObject() {
+ return new UnCompressNoneByte(this.actualDataType);
+ }
+
+ @Override public CarbonReadDataHolder getValues(int decimal, Object maxValueObject) {
+ CarbonReadDataHolder dataHolder = new CarbonReadDataHolder();
+ double[] val = new double[value.length];
+ for (int i = 0; i < val.length; i++) {
+ val[i] = value[i];
+ }
+ dataHolder.setReadableDoubleValues(val);
+ return dataHolder;
+ }
+
+ @Override
+ public ValueCompressonHolder.UnCompressValue uncompress(ValueCompressionUtil.DataType dataType) {
+ return null;
+ }
+
+ @Override public byte[] getBackArrayData() {
+ return ValueCompressionUtil.convertToBytes(value);
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-carbondata/blob/360edc8d/core/src/main/java/org/apache/carbondata/core/datastorage/store/compression/none/UnCompressNoneInt.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/carbondata/core/datastorage/store/compression/none/UnCompressNoneInt.java b/core/src/main/java/org/apache/carbondata/core/datastorage/store/compression/none/UnCompressNoneInt.java
new file mode 100644
index 0000000..4edd330
--- /dev/null
+++ b/core/src/main/java/org/apache/carbondata/core/datastorage/store/compression/none/UnCompressNoneInt.java
@@ -0,0 +1,143 @@
+/*
+ * 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.none;
+
+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.CompressorFactory;
+import org.apache.carbondata.core.datastorage.store.compression.ValueCompressonHolder;
+import org.apache.carbondata.core.datastorage.store.dataholder.CarbonReadDataHolder;
+import org.apache.carbondata.core.util.ValueCompressionUtil;
+import org.apache.carbondata.core.util.ValueCompressionUtil.DataType;
+
+public class UnCompressNoneInt implements ValueCompressonHolder.UnCompressValue<int[]> {
+ /**
+ * Attribute for Carbon LOGGER
+ */
+ private static final LogService LOGGER =
+ LogServiceFactory.getLogService(UnCompressNoneInt.class.getName());
+ /**
+ * intCompressor.
+ */
+ private static Compressor compressor = CompressorFactory.getInstance();
+ /**
+ * value.
+ */
+ private int[] value;
+
+ private DataType actualDataType;
+
+ public UnCompressNoneInt(DataType actualDataType) {
+ this.actualDataType = actualDataType;
+ }
+
+ @Override public void setValue(int[] value) {
+ this.value = value;
+ }
+
+ @Override public byte[] getBackArrayData() {
+ return ValueCompressionUtil.convertToBytes(value);
+ }
+
+ @Override public ValueCompressonHolder.UnCompressValue getNew() {
+ try {
+ return (ValueCompressonHolder.UnCompressValue) clone();
+ } catch (CloneNotSupportedException exc) {
+ LOGGER.error(exc, exc.getMessage());
+ }
+ return null;
+ }
+
+ @Override public ValueCompressonHolder.UnCompressValue compress() {
+ UnCompressNoneByte byte1 = new UnCompressNoneByte(actualDataType);
+ byte1.setValue(compressor.compressInt(value));
+ return byte1;
+ }
+
+ @Override public ValueCompressonHolder.UnCompressValue uncompress(DataType dataType) {
+ return null;
+ }
+
+ @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 UnCompressNoneByte(this.actualDataType);
+ }
+
+ @Override public CarbonReadDataHolder getValues(int decimal, Object maxValueObject) {
+ switch (actualDataType) {
+ case DATA_SHORT:
+ return unCompressShort();
+ case DATA_INT:
+ return unCompressInt();
+ case DATA_LONG:
+ case DATA_BIGINT:
+ return unCompressLong();
+ default:
+ return unCompressDouble();
+ }
+ }
+
+ private CarbonReadDataHolder unCompressShort() {
+ CarbonReadDataHolder dataHolder = new CarbonReadDataHolder();
+ short[] vals = new short[value.length];
+ for (int i = 0; i < vals.length; i++) {
+ vals[i] = (short)value[i];
+ }
+ dataHolder.setReadableShortValues(vals);
+ return dataHolder;
+ }
+
+ private CarbonReadDataHolder unCompressInt() {
+ CarbonReadDataHolder dataHolder = new CarbonReadDataHolder();
+ dataHolder.setReadableIntValues(value);
+ return dataHolder;
+ }
+
+ private CarbonReadDataHolder unCompressDouble() {
+ CarbonReadDataHolder dataHolderInfoObj = new CarbonReadDataHolder();
+ double[] vals = new double[value.length];
+ for (int i = 0; i < vals.length; i++) {
+ vals[i] = value[i];
+ }
+ dataHolderInfoObj.setReadableDoubleValues(vals);
+ return dataHolderInfoObj;
+ }
+
+ private CarbonReadDataHolder unCompressLong() {
+ CarbonReadDataHolder dataHolderInfoObj = new CarbonReadDataHolder();
+ long[] vals = new long[value.length];
+ for (int i = 0; i < vals.length; i++) {
+ vals[i] = value[i];
+ }
+
+ dataHolderInfoObj.setReadableLongValues(vals);
+ return dataHolderInfoObj;
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-carbondata/blob/360edc8d/core/src/main/java/org/apache/carbondata/core/datastorage/store/compression/none/UnCompressNoneLong.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/carbondata/core/datastorage/store/compression/none/UnCompressNoneLong.java b/core/src/main/java/org/apache/carbondata/core/datastorage/store/compression/none/UnCompressNoneLong.java
new file mode 100644
index 0000000..e4e5a75
--- /dev/null
+++ b/core/src/main/java/org/apache/carbondata/core/datastorage/store/compression/none/UnCompressNoneLong.java
@@ -0,0 +1,129 @@
+/*
+ * 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.none;
+
+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.CompressorFactory;
+import org.apache.carbondata.core.datastorage.store.compression.ValueCompressonHolder;
+import org.apache.carbondata.core.datastorage.store.dataholder.CarbonReadDataHolder;
+import org.apache.carbondata.core.util.ValueCompressionUtil;
+import org.apache.carbondata.core.util.ValueCompressionUtil.DataType;
+
+public class UnCompressNoneLong implements ValueCompressonHolder.UnCompressValue<long[]> {
+ /**
+ * Attribute for Carbon LOGGER
+ */
+ private static final LogService LOGGER =
+ LogServiceFactory.getLogService(UnCompressNoneLong.class.getName());
+ /**
+ * longCompressor.
+ */
+ private static Compressor compressor = CompressorFactory.getInstance();
+ /**
+ * value.
+ */
+ protected long[] value;
+
+ private DataType actualDataType;
+
+ public UnCompressNoneLong(DataType actualDataType) {
+ this.actualDataType = actualDataType;
+ }
+
+ @Override public void setValue(long[] value) {
+ this.value = value;
+
+ }
+
+ @Override public ValueCompressonHolder.UnCompressValue getNew() {
+ try {
+ return (ValueCompressonHolder.UnCompressValue) clone();
+ } catch (CloneNotSupportedException clnNotSupportedExc) {
+ LOGGER.error(clnNotSupportedExc,
+ clnNotSupportedExc.getMessage());
+ }
+ return null;
+ }
+
+ @Override public ValueCompressonHolder.UnCompressValue compress() {
+ UnCompressNoneByte byte1 = new UnCompressNoneByte(actualDataType);
+ byte1.setValue(compressor.compressLong(value));
+ return byte1;
+
+ }
+
+ @Override
+ public ValueCompressonHolder.UnCompressValue uncompress(ValueCompressionUtil.DataType dType) {
+ return null;
+ }
+
+ @Override public byte[] getBackArrayData() {
+ return ValueCompressionUtil.convertToBytes(value);
+ }
+
+ @Override public void setValueInBytes(byte[] byteValue) {
+ ByteBuffer buffer = ByteBuffer.wrap(byteValue);
+ this.value = ValueCompressionUtil.convertToLongArray(buffer, byteValue.length);
+ }
+
+ /**
+ * @see ValueCompressonHolder.UnCompressValue#getCompressorObject()
+ */
+ @Override public ValueCompressonHolder.UnCompressValue getCompressorObject() {
+ return new UnCompressNoneByte(this.actualDataType);
+ }
+
+ @Override public CarbonReadDataHolder getValues(int decimal, Object maxValueObject) {
+ switch (actualDataType) {
+ case DATA_BIGINT:
+ return unCompressLong();
+ default:
+ return unCompressDouble();
+ }
+ }
+
+ private CarbonReadDataHolder unCompressDouble() {
+ CarbonReadDataHolder dataHldr = new CarbonReadDataHolder();
+
+ double[] vals = new double[value.length];
+
+ for (int i = 0; i < vals.length; i++) {
+ vals[i] = value[i];
+ }
+ dataHldr.setReadableDoubleValues(vals);
+ return dataHldr;
+ }
+
+ private CarbonReadDataHolder unCompressLong() {
+ CarbonReadDataHolder dataHldr = new CarbonReadDataHolder();
+
+ long[] vals = new long[value.length];
+
+ for (int i = 0; i < vals.length; i++) {
+ vals[i] = value[i];
+ }
+ dataHldr.setReadableLongValues(vals);
+ return dataHldr;
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-carbondata/blob/360edc8d/core/src/main/java/org/apache/carbondata/core/datastorage/store/compression/none/UnCompressNoneShort.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/carbondata/core/datastorage/store/compression/none/UnCompressNoneShort.java b/core/src/main/java/org/apache/carbondata/core/datastorage/store/compression/none/UnCompressNoneShort.java
new file mode 100644
index 0000000..7b8762d
--- /dev/null
+++ b/core/src/main/java/org/apache/carbondata/core/datastorage/store/compression/none/UnCompressNoneShort.java
@@ -0,0 +1,127 @@
+/*
+ * 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.none;
+
+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.CompressorFactory;
+import org.apache.carbondata.core.datastorage.store.compression.ValueCompressonHolder;
+import org.apache.carbondata.core.datastorage.store.dataholder.CarbonReadDataHolder;
+import org.apache.carbondata.core.util.ValueCompressionUtil;
+import org.apache.carbondata.core.util.ValueCompressionUtil.DataType;
+
+public class UnCompressNoneShort implements ValueCompressonHolder.UnCompressValue<short[]> {
+ /**
+ * Attribute for Carbon LOGGER
+ */
+ private static final LogService LOGGER =
+ LogServiceFactory.getLogService(UnCompressNoneShort.class.getName());
+
+ /**
+ * shortCompressor.
+ */
+ private static Compressor compressor = CompressorFactory.getInstance();
+
+ /**
+ * value.
+ */
+ private short[] shortValue;
+
+ private DataType actualDataType;
+
+ public UnCompressNoneShort(DataType actualDataType) {
+ this.actualDataType = actualDataType;
+ }
+
+ @Override public void setValue(short[] shortValue) {
+ this.shortValue = shortValue;
+ }
+
+ @Override public ValueCompressonHolder.UnCompressValue getNew() {
+ try {
+ return (ValueCompressonHolder.UnCompressValue) clone();
+ } catch (CloneNotSupportedException cns1) {
+ LOGGER.error(cns1, cns1.getMessage());
+ }
+ return null;
+ }
+
+ @Override public ValueCompressonHolder.UnCompressValue compress() {
+ UnCompressNoneByte byte1 = new UnCompressNoneByte(actualDataType);
+ byte1.setValue(compressor.compressShort(shortValue));
+ return byte1;
+ }
+
+ @Override public ValueCompressonHolder.UnCompressValue uncompress(DataType dataType) {
+ return null;
+ }
+
+ @Override public byte[] getBackArrayData() {
+ return ValueCompressionUtil.convertToBytes(shortValue);
+ }
+
+ @Override public void setValueInBytes(byte[] value) {
+ ByteBuffer buffer = ByteBuffer.wrap(value);
+ shortValue = ValueCompressionUtil.convertToShortArray(buffer, value.length);
+ }
+
+ /**
+ * @see ValueCompressonHolder.UnCompressValue#getCompressorObject()
+ */
+ @Override public ValueCompressonHolder.UnCompressValue getCompressorObject() {
+ return new UnCompressNoneByte(this.actualDataType);
+ }
+
+ @Override public CarbonReadDataHolder getValues(int decimal, Object maxValueObject) {
+ switch (actualDataType) {
+ case DATA_BIGINT:
+ return unCompressLong();
+ default:
+ return unCompressDouble();
+ }
+ }
+
+ private CarbonReadDataHolder unCompressDouble() {
+ CarbonReadDataHolder dataHldr = new CarbonReadDataHolder();
+
+ double[] vals = new double[shortValue.length];
+
+ for (int i = 0; i < vals.length; i++) {
+ vals[i] = shortValue[i];
+ }
+ dataHldr.setReadableDoubleValues(vals);
+ return dataHldr;
+ }
+
+ private CarbonReadDataHolder unCompressLong() {
+ CarbonReadDataHolder dataHldr = new CarbonReadDataHolder();
+
+ long[] vals = new long[shortValue.length];
+
+ for (int i = 0; i < vals.length; i++) {
+ vals[i] = shortValue[i];
+ }
+ dataHldr.setReadableLongValues(vals);
+ return dataHldr;
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-carbondata/blob/360edc8d/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
deleted file mode 100644
index 5009cd3..0000000
--- a/core/src/main/java/org/apache/carbondata/core/datastorage/store/compression/type/UnCompressByteArray.java
+++ /dev/null
@@ -1,137 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.carbondata.core.datastorage.store.compression.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.CompressorFactory;
-import org.apache.carbondata.core.datastorage.store.compression.ValueCompressonHolder;
-import org.apache.carbondata.core.datastorage.store.dataholder.CarbonReadDataHolder;
-import org.apache.carbondata.core.util.DataTypeUtil;
-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());
- /**
- * compressor.
- */
- private static Compressor compressor = CompressorFactory.getInstance();
-
- 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(compressor.compressByte(value));
- return byte1;
- }
-
- @Override
- public ValueCompressonHolder.UnCompressValue uncompress(ValueCompressionUtil.DataType dataType) {
- ValueCompressonHolder.UnCompressValue byte1 = new UnCompressByteArray(arrayType);
- byte1.setValue(compressor.unCompressByte(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/360edc8d/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
deleted file mode 100644
index 444fb5c..0000000
--- a/core/src/main/java/org/apache/carbondata/core/datastorage/store/compression/type/UnCompressDefaultLong.java
+++ /dev/null
@@ -1,52 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.carbondata.core.datastorage.store.compression.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;
-import org.apache.carbondata.core.util.ValueCompressionUtil.DataType;
-
-public class UnCompressDefaultLong extends UnCompressNoneLong {
- private static final LogService LOGGER = LogServiceFactory
- .getLogService(UnCompressDefaultLong.class.getName());
-
- public UnCompressDefaultLong(DataType actualDataType) {
- super(actualDataType);
- }
-
- 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];
- System.arraycopy(value, 0, vals, 0, vals.length);
- dataHolder.setReadableLongValues(vals);
- return dataHolder;
- }
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-carbondata/blob/360edc8d/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
deleted file mode 100644
index e6baf91..0000000
--- a/core/src/main/java/org/apache/carbondata/core/datastorage/store/compression/type/UnCompressMaxMinByte.java
+++ /dev/null
@@ -1,138 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.carbondata.core.datastorage.store.compression.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.CompressorFactory;
-import org.apache.carbondata.core.datastorage.store.compression.ValueCompressonHolder;
-import org.apache.carbondata.core.datastorage.store.compression.ValueCompressonHolder.UnCompressValue;
-import org.apache.carbondata.core.datastorage.store.dataholder.CarbonReadDataHolder;
-import org.apache.carbondata.core.util.ValueCompressionUtil;
-import org.apache.carbondata.core.util.ValueCompressionUtil.DataType;
-
-public class UnCompressMaxMinByte implements UnCompressValue<byte[]> {
-
- /**
- * Attribute for Carbon LOGGER
- */
- private static final LogService LOGGER =
- LogServiceFactory.getLogService(UnCompressMaxMinByte.class.getName());
- /**
- * compressor.
- */
- private static Compressor compressor = CompressorFactory.getInstance();
- /**
- * value.
- */
- protected byte[] value;
-
- /**
- * actual data type
- */
- protected DataType actualDataType;
-
- //TODO SIMIAN
-
- public UnCompressMaxMinByte(DataType actualDataType) {
- this.actualDataType = actualDataType;
- }
-
- @Override public void setValue(byte[] value) {
- this.value = value;
-
- }
-
- @Override public UnCompressValue getNew() {
- try {
- return (UnCompressValue) clone();
- } catch (CloneNotSupportedException e) {
- LOGGER.error(e, e.getMessage());
- }
- return null;
- }
-
- @Override public UnCompressValue compress() {
- UnCompressMaxMinByte byte1 = new UnCompressMaxMinByte(actualDataType);
- byte1.setValue(compressor.compressByte(value));
- return byte1;
- }
-
- @Override public UnCompressValue uncompress(DataType dataType) {
- UnCompressValue byte1 = ValueCompressionUtil.unCompressMaxMin(dataType, actualDataType);
- 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(actualDataType);
- }
-
- @Override public CarbonReadDataHolder getValues(int decimal, Object maxValueObject) {
- switch (actualDataType) {
- case DATA_BIGINT:
- return unCompressLong(decimal, maxValueObject);
- default:
- return unCompressDouble(decimal, maxValueObject);
- }
- }
-
- private CarbonReadDataHolder unCompressLong(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;
- }
-
- private CarbonReadDataHolder unCompressDouble(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/360edc8d/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
deleted file mode 100644
index d38c49a..0000000
--- a/core/src/main/java/org/apache/carbondata/core/datastorage/store/compression/type/UnCompressMaxMinByteForLong.java
+++ /dev/null
@@ -1,80 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.carbondata.core.datastorage.store.compression.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.CompressorFactory;
-import org.apache.carbondata.core.datastorage.store.compression.ValueCompressonHolder;
-import org.apache.carbondata.core.datastorage.store.dataholder.CarbonReadDataHolder;
-import org.apache.carbondata.core.util.ValueCompressionUtil;
-import org.apache.carbondata.core.util.ValueCompressionUtil.DataType;
-
-public class UnCompressMaxMinByteForLong extends UnCompressMaxMinByte {
-
- private static final LogService LOGGER =
- LogServiceFactory.getLogService(UnCompressMaxMinByteForLong.class.getName());
- private static Compressor compressor = CompressorFactory.getInstance();
-
- public UnCompressMaxMinByteForLong(DataType actualDataType) {
- super(actualDataType);
- }
- @Override public ValueCompressonHolder.UnCompressValue getNew() {
- try {
- return (ValueCompressonHolder.UnCompressValue) clone();
- } catch (CloneNotSupportedException e) {
- LOGGER.error(e, e.getMessage());
- }
- return null;
- }
-
- @Override public ValueCompressonHolder.UnCompressValue compress() {
- UnCompressMaxMinByteForLong byte1 = new UnCompressMaxMinByteForLong(actualDataType);
- byte1.setValue(compressor.compressByte(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(actualDataType);
- }
-
- @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/360edc8d/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
deleted file mode 100644
index f076221..0000000
--- a/core/src/main/java/org/apache/carbondata/core/datastorage/store/compression/type/UnCompressMaxMinDefault.java
+++ /dev/null
@@ -1,116 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.carbondata.core.datastorage.store.compression.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.CompressorFactory;
-import org.apache.carbondata.core.datastorage.store.compression.ValueCompressonHolder;
-import org.apache.carbondata.core.datastorage.store.dataholder.CarbonReadDataHolder;
-import org.apache.carbondata.core.util.ValueCompressionUtil;
-import org.apache.carbondata.core.util.ValueCompressionUtil.DataType;
-
-public class UnCompressMaxMinDefault implements ValueCompressonHolder.UnCompressValue<double[]> {
-
- /**
- * Attribute for Carbon LOGGER
- */
- private static final LogService LOGGER =
- LogServiceFactory.getLogService(UnCompressMaxMinDefault.class.getName());
-
- /**
- * compressor.
- */
- private static Compressor compressor = CompressorFactory.getInstance();
- /**
- * value.
- */
- private double[] value;
-
- /**
- * actual data type
- */
- private DataType actualDataType;
-
- public UnCompressMaxMinDefault(DataType actualDataType) {
- this.actualDataType = actualDataType;
- }
-
- @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(actualDataType);
- byte1.setValue(compressor.compressDouble(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(actualDataType);
- }
-
- //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;
- }
-
-}