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 2017/01/16 14:52:47 UTC
[10/52] [partial] incubator-carbondata git commit: move core package
http://git-wip-us.apache.org/repos/asf/incubator-carbondata/blob/ce09aaaf/core/src/main/java/org/apache/carbondata/scan/result/iterator/VectorDetailQueryResultIterator.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/carbondata/scan/result/iterator/VectorDetailQueryResultIterator.java b/core/src/main/java/org/apache/carbondata/scan/result/iterator/VectorDetailQueryResultIterator.java
deleted file mode 100644
index 417f597..0000000
--- a/core/src/main/java/org/apache/carbondata/scan/result/iterator/VectorDetailQueryResultIterator.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.scan.result.iterator;
-
-import java.util.List;
-import java.util.concurrent.ExecutorService;
-
-import org.apache.carbondata.scan.executor.infos.BlockExecutionInfo;
-import org.apache.carbondata.scan.model.QueryModel;
-import org.apache.carbondata.scan.result.vector.CarbonColumnarBatch;
-
-/**
- * It reads the data vector batch format
- */
-public class VectorDetailQueryResultIterator extends AbstractDetailQueryResultIterator<Object> {
-
- private final Object lock = new Object();
-
- public VectorDetailQueryResultIterator(List<BlockExecutionInfo> infos, QueryModel queryModel,
- ExecutorService execService) {
- super(infos, queryModel, execService);
- }
-
- @Override public Object next() {
- throw new UnsupportedOperationException("call processNextBatch instaed");
- }
-
- public void processNextBatch(CarbonColumnarBatch columnarBatch) {
- synchronized (lock) {
- updateDataBlockIterator();
- if (dataBlockIterator != null) {
- dataBlockIterator.processNextBatch(columnarBatch);
- }
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-carbondata/blob/ce09aaaf/core/src/main/java/org/apache/carbondata/scan/result/vector/CarbonColumnVector.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/carbondata/scan/result/vector/CarbonColumnVector.java b/core/src/main/java/org/apache/carbondata/scan/result/vector/CarbonColumnVector.java
deleted file mode 100644
index 0af1857..0000000
--- a/core/src/main/java/org/apache/carbondata/scan/result/vector/CarbonColumnVector.java
+++ /dev/null
@@ -1,47 +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.scan.result.vector;
-
-import org.apache.spark.sql.types.Decimal;
-
-public interface CarbonColumnVector {
-
- void putShort(int rowId, short value);
-
- void putInt(int rowId, int value);
-
- void putLong(int rowId, long value);
-
- void putDecimal(int rowId, Decimal value, int precision);
-
- void putDouble(int rowId, double value);
-
- void putBytes(int rowId, byte[] value);
-
- void putBytes(int rowId, int offset, int length, byte[] value);
-
- void putNull(int rowId);
-
- boolean isNull(int rowId);
-
- void putObject(int rowId, Object obj);
-
- Object getData(int rowId);
-
- void reset();
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-carbondata/blob/ce09aaaf/core/src/main/java/org/apache/carbondata/scan/result/vector/CarbonColumnarBatch.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/carbondata/scan/result/vector/CarbonColumnarBatch.java b/core/src/main/java/org/apache/carbondata/scan/result/vector/CarbonColumnarBatch.java
deleted file mode 100644
index afc53ca..0000000
--- a/core/src/main/java/org/apache/carbondata/scan/result/vector/CarbonColumnarBatch.java
+++ /dev/null
@@ -1,62 +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.scan.result.vector;
-
-public class CarbonColumnarBatch {
-
- public CarbonColumnVector[] columnVectors;
-
- private int batchSize;
-
- private int actualSize;
-
- private int rowCounter;
-
- public CarbonColumnarBatch(CarbonColumnVector[] columnVectors, int batchSize) {
- this.columnVectors = columnVectors;
- this.batchSize = batchSize;
- }
-
- public int getBatchSize() {
- return batchSize;
- }
-
- public int getActualSize() {
- return actualSize;
- }
-
- public void setActualSize(int actualSize) {
- this.actualSize = actualSize;
- }
-
- public void reset() {
- actualSize = 0;
- rowCounter = 0;
- for (int i = 0; i < columnVectors.length; i++) {
- columnVectors[i].reset();
- }
- }
-
- public int getRowCounter() {
- return rowCounter;
- }
-
- public void setRowCounter(int rowCounter) {
- this.rowCounter = rowCounter;
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-carbondata/blob/ce09aaaf/core/src/main/java/org/apache/carbondata/scan/result/vector/ColumnVectorInfo.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/carbondata/scan/result/vector/ColumnVectorInfo.java b/core/src/main/java/org/apache/carbondata/scan/result/vector/ColumnVectorInfo.java
deleted file mode 100644
index 4b0d7b3..0000000
--- a/core/src/main/java/org/apache/carbondata/scan/result/vector/ColumnVectorInfo.java
+++ /dev/null
@@ -1,41 +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.scan.result.vector;
-
-import org.apache.carbondata.core.keygenerator.directdictionary.DirectDictionaryGenerator;
-import org.apache.carbondata.scan.filter.GenericQueryType;
-import org.apache.carbondata.scan.model.QueryDimension;
-import org.apache.carbondata.scan.model.QueryMeasure;
-
-public class ColumnVectorInfo implements Comparable<ColumnVectorInfo> {
- public int offset;
- public int size;
- public CarbonColumnVector vector;
- public int vectorOffset;
- public QueryDimension dimension;
- public QueryMeasure measure;
- public int ordinal;
- public DirectDictionaryGenerator directDictionaryGenerator;
- public MeasureDataVectorProcessor.MeasureVectorFiller measureVectorFiller;
- public GenericQueryType genericQueryType;
-
- @Override public int compareTo(ColumnVectorInfo o) {
- return ordinal - o.ordinal;
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-carbondata/blob/ce09aaaf/core/src/main/java/org/apache/carbondata/scan/result/vector/MeasureDataVectorProcessor.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/carbondata/scan/result/vector/MeasureDataVectorProcessor.java b/core/src/main/java/org/apache/carbondata/scan/result/vector/MeasureDataVectorProcessor.java
deleted file mode 100644
index c7060a3..0000000
--- a/core/src/main/java/org/apache/carbondata/scan/result/vector/MeasureDataVectorProcessor.java
+++ /dev/null
@@ -1,268 +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.scan.result.vector;
-
-import java.math.BigDecimal;
-import java.util.BitSet;
-
-import org.apache.carbondata.core.carbon.datastore.chunk.MeasureColumnDataChunk;
-import org.apache.carbondata.core.carbon.metadata.datatype.DataType;
-
-import org.apache.spark.sql.types.Decimal;
-
-public class MeasureDataVectorProcessor {
-
- public interface MeasureVectorFiller {
-
- void fillMeasureVector(MeasureColumnDataChunk dataChunk, ColumnVectorInfo info);
-
- void fillMeasureVectorForFilter(int[] rowMapping, MeasureColumnDataChunk dataChunk,
- ColumnVectorInfo info);
- }
-
- public static class IntegralMeasureVectorFiller implements MeasureVectorFiller {
-
- @Override
- public void fillMeasureVector(MeasureColumnDataChunk dataChunk, ColumnVectorInfo info) {
- int offset = info.offset;
- int len = offset + info.size;
- int vectorOffset = info.vectorOffset;
- CarbonColumnVector vector = info.vector;
- BitSet nullBitSet = dataChunk.getNullValueIndexHolder().getBitSet();
- for (int i = offset; i < len; i++) {
- if (nullBitSet.get(i)) {
- vector.putNull(vectorOffset);
- } else {
- vector.putInt(vectorOffset,
- (int)dataChunk.getMeasureDataHolder().getReadableLongValueByIndex(i));
- }
- vectorOffset++;
- }
- }
-
- @Override
- public void fillMeasureVectorForFilter(int[] rowMapping, MeasureColumnDataChunk dataChunk,
- ColumnVectorInfo info) {
- int offset = info.offset;
- int len = offset + info.size;
- int vectorOffset = info.vectorOffset;
- CarbonColumnVector vector = info.vector;
- BitSet nullBitSet = dataChunk.getNullValueIndexHolder().getBitSet();
- for (int i = offset; i < len; i++) {
- int currentRow = rowMapping[i];
- if (nullBitSet.get(currentRow)) {
- vector.putNull(vectorOffset);
- } else {
- vector.putInt(vectorOffset,
- (int)dataChunk.getMeasureDataHolder().getReadableLongValueByIndex(currentRow));
- }
- vectorOffset++;
- }
- }
- }
-
- public static class ShortMeasureVectorFiller implements MeasureVectorFiller {
-
- @Override
- public void fillMeasureVector(MeasureColumnDataChunk dataChunk, ColumnVectorInfo info) {
- int offset = info.offset;
- int len = offset + info.size;
- int vectorOffset = info.vectorOffset;
- CarbonColumnVector vector = info.vector;
- BitSet nullBitSet = dataChunk.getNullValueIndexHolder().getBitSet();
- for (int i = offset; i < len; i++) {
- if (nullBitSet.get(i)) {
- vector.putNull(vectorOffset);
- } else {
- vector.putShort(vectorOffset,
- (short) dataChunk.getMeasureDataHolder().getReadableLongValueByIndex(i));
- }
- vectorOffset++;
- }
- }
-
- @Override
- public void fillMeasureVectorForFilter(int[] rowMapping, MeasureColumnDataChunk dataChunk,
- ColumnVectorInfo info) {
- int offset = info.offset;
- int len = offset + info.size;
- int vectorOffset = info.vectorOffset;
- CarbonColumnVector vector = info.vector;
- BitSet nullBitSet = dataChunk.getNullValueIndexHolder().getBitSet();
- for (int i = offset; i < len; i++) {
- int currentRow = rowMapping[i];
- if (nullBitSet.get(currentRow)) {
- vector.putNull(vectorOffset);
- } else {
- vector.putShort(vectorOffset,
- (short) dataChunk.getMeasureDataHolder().getReadableLongValueByIndex(currentRow));
- }
- vectorOffset++;
- }
- }
- }
-
- public static class LongMeasureVectorFiller implements MeasureVectorFiller {
-
- @Override
- public void fillMeasureVector(MeasureColumnDataChunk dataChunk, ColumnVectorInfo info) {
- int offset = info.offset;
- int len = offset + info.size;
- int vectorOffset = info.vectorOffset;
- CarbonColumnVector vector = info.vector;
- BitSet nullBitSet = dataChunk.getNullValueIndexHolder().getBitSet();
- for (int i = offset; i < len; i++) {
- if (nullBitSet.get(i)) {
- vector.putNull(vectorOffset);
- } else {
- vector.putLong(vectorOffset,
- dataChunk.getMeasureDataHolder().getReadableLongValueByIndex(i));
- }
- vectorOffset++;
- }
- }
-
- @Override
- public void fillMeasureVectorForFilter(int[] rowMapping, MeasureColumnDataChunk dataChunk,
- ColumnVectorInfo info) {
- int offset = info.offset;
- int len = offset + info.size;
- int vectorOffset = info.vectorOffset;
- CarbonColumnVector vector = info.vector;
- BitSet nullBitSet = dataChunk.getNullValueIndexHolder().getBitSet();
- for (int i = offset; i < len; i++) {
- int currentRow = rowMapping[i];
- if (nullBitSet.get(currentRow)) {
- vector.putNull(vectorOffset);
- } else {
- vector.putLong(vectorOffset,
- dataChunk.getMeasureDataHolder().getReadableLongValueByIndex(currentRow));
- }
- vectorOffset++;
- }
- }
- }
-
- public static class DecimalMeasureVectorFiller implements MeasureVectorFiller {
-
- @Override
- public void fillMeasureVector(MeasureColumnDataChunk dataChunk, ColumnVectorInfo info) {
- int offset = info.offset;
- int len = offset + info.size;
- int vectorOffset = info.vectorOffset;
- CarbonColumnVector vector = info.vector;
- int precision = info.measure.getMeasure().getPrecision();
- BitSet nullBitSet = dataChunk.getNullValueIndexHolder().getBitSet();
- for (int i = offset; i < len; i++) {
- if (nullBitSet.get(i)) {
- vector.putNull(vectorOffset);
- } else {
- BigDecimal decimal =
- dataChunk.getMeasureDataHolder().getReadableBigDecimalValueByIndex(i);
- Decimal toDecimal = org.apache.spark.sql.types.Decimal.apply(decimal);
- vector.putDecimal(vectorOffset, toDecimal, precision);
- }
- vectorOffset++;
- }
- }
-
- @Override
- public void fillMeasureVectorForFilter(int[] rowMapping, MeasureColumnDataChunk dataChunk,
- ColumnVectorInfo info) {
- int offset = info.offset;
- int len = offset + info.size;
- int vectorOffset = info.vectorOffset;
- CarbonColumnVector vector = info.vector;
- int precision = info.measure.getMeasure().getPrecision();
- BitSet nullBitSet = dataChunk.getNullValueIndexHolder().getBitSet();
- for (int i = offset; i < len; i++) {
- int currentRow = rowMapping[i];
- if (nullBitSet.get(currentRow)) {
- vector.putNull(vectorOffset);
- } else {
- BigDecimal decimal =
- dataChunk.getMeasureDataHolder().getReadableBigDecimalValueByIndex(currentRow);
- Decimal toDecimal = org.apache.spark.sql.types.Decimal.apply(decimal);
- vector.putDecimal(vectorOffset, toDecimal, precision);
- }
- vectorOffset++;
- }
- }
- }
-
- public static class DefaultMeasureVectorFiller implements MeasureVectorFiller {
-
- @Override
- public void fillMeasureVector(MeasureColumnDataChunk dataChunk, ColumnVectorInfo info) {
- int offset = info.offset;
- int len = offset + info.size;
- int vectorOffset = info.vectorOffset;
- CarbonColumnVector vector = info.vector;
- BitSet nullBitSet = dataChunk.getNullValueIndexHolder().getBitSet();
- for (int i = offset; i < len; i++) {
- if (nullBitSet.get(i)) {
- vector.putNull(vectorOffset);
- } else {
- vector.putDouble(vectorOffset,
- dataChunk.getMeasureDataHolder().getReadableDoubleValueByIndex(i));
- }
- vectorOffset++;
- }
- }
-
- @Override
- public void fillMeasureVectorForFilter(int[] rowMapping, MeasureColumnDataChunk dataChunk,
- ColumnVectorInfo info) {
- int offset = info.offset;
- int len = offset + info.size;
- int vectorOffset = info.vectorOffset;
- CarbonColumnVector vector = info.vector;
- BitSet nullBitSet = dataChunk.getNullValueIndexHolder().getBitSet();
- for (int i = offset; i < len; i++) {
- int currentRow = rowMapping[i];
- if (nullBitSet.get(currentRow)) {
- vector.putNull(vectorOffset);
- } else {
- vector.putDouble(vectorOffset,
- dataChunk.getMeasureDataHolder().getReadableDoubleValueByIndex(currentRow));
- }
- vectorOffset++;
- }
- }
- }
-
- public static class MeasureVectorFillerFactory {
-
- public static MeasureVectorFiller getMeasureVectorFiller(DataType dataType) {
- switch (dataType) {
- case SHORT:
- return new ShortMeasureVectorFiller();
- case INT:
- return new IntegralMeasureVectorFiller();
- case LONG:
- return new LongMeasureVectorFiller();
- case DECIMAL:
- return new DecimalMeasureVectorFiller();
- default:
- return new DefaultMeasureVectorFiller();
- }
- }
- }
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-carbondata/blob/ce09aaaf/core/src/main/java/org/apache/carbondata/scan/result/vector/impl/CarbonColumnVectorImpl.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/carbondata/scan/result/vector/impl/CarbonColumnVectorImpl.java b/core/src/main/java/org/apache/carbondata/scan/result/vector/impl/CarbonColumnVectorImpl.java
deleted file mode 100644
index 369e1b7..0000000
--- a/core/src/main/java/org/apache/carbondata/scan/result/vector/impl/CarbonColumnVectorImpl.java
+++ /dev/null
@@ -1,154 +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.scan.result.vector.impl;
-
-import java.util.Arrays;
-import java.util.BitSet;
-
-import org.apache.carbondata.core.carbon.metadata.datatype.DataType;
-import org.apache.carbondata.scan.result.vector.CarbonColumnVector;
-
-import org.apache.spark.sql.types.Decimal;
-import org.apache.spark.unsafe.types.UTF8String;
-
-public class CarbonColumnVectorImpl implements CarbonColumnVector {
-
- private Object[] data;
-
- private int[] ints;
-
- private long[] longs;
-
- private Decimal[] decimals;
-
- private byte[][] bytes;
-
- private double[] doubles;
-
- private BitSet nullBytes;
-
- private DataType dataType;
-
- public CarbonColumnVectorImpl(int batchSize, DataType dataType) {
- nullBytes = new BitSet(batchSize);
- this.dataType = dataType;
- switch (dataType) {
- case INT:
- ints = new int[batchSize];
- break;
- case LONG:
- longs = new long[batchSize];
- break;
- case DOUBLE:
- doubles = new double[batchSize];
- break;
- case STRING:
- bytes = new byte[batchSize][];
- break;
- case DECIMAL:
- decimals = new Decimal[batchSize];
- break;
- default:
- data = new Object[batchSize];
- }
- }
-
- @Override public void putShort(int rowId, short value) {
-
- }
-
- @Override public void putInt(int rowId, int value) {
- ints[rowId] = value;
- }
-
- @Override public void putLong(int rowId, long value) {
- longs[rowId] = value;
- }
-
- @Override public void putDecimal(int rowId, Decimal value, int precision) {
- decimals[rowId] = value;
- }
-
- @Override public void putDouble(int rowId, double value) {
- doubles[rowId] = value;
- }
-
- @Override public void putBytes(int rowId, byte[] value) {
- bytes[rowId] = value;
- }
-
- @Override public void putBytes(int rowId, int offset, int length, byte[] value) {
-
- }
-
- @Override public void putNull(int rowId) {
- nullBytes.set(rowId);
- }
-
- @Override public boolean isNull(int rowId) {
- return nullBytes.get(rowId);
- }
-
- @Override public void putObject(int rowId, Object obj) {
- data[rowId] = obj;
- }
-
- @Override public Object getData(int rowId) {
- if (nullBytes.get(rowId)) {
- return null;
- }
- switch (dataType) {
- case INT:
- return ints[rowId];
- case LONG:
- return longs[rowId];
- case DOUBLE:
- return doubles[rowId];
- case STRING:
- return UTF8String.fromBytes(bytes[rowId]);
- case DECIMAL:
- return decimals[rowId];
- default:
- return data[rowId];
- }
- }
-
- @Override public void reset() {
- nullBytes.clear();
- switch (dataType) {
- case INT:
- Arrays.fill(ints, 0);
- break;
- case LONG:
- Arrays.fill(longs, 0);
- break;
- case DOUBLE:
- Arrays.fill(doubles, 0);
- break;
- case STRING:
- Arrays.fill(bytes, null);
- break;
- case DECIMAL:
- Arrays.fill(decimals, null);
- break;
- default:
- Arrays.fill(data, null);
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-carbondata/blob/ce09aaaf/core/src/main/java/org/apache/carbondata/scan/scanner/AbstractBlockletScanner.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/carbondata/scan/scanner/AbstractBlockletScanner.java b/core/src/main/java/org/apache/carbondata/scan/scanner/AbstractBlockletScanner.java
deleted file mode 100644
index 8f7b269..0000000
--- a/core/src/main/java/org/apache/carbondata/scan/scanner/AbstractBlockletScanner.java
+++ /dev/null
@@ -1,93 +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.scan.scanner;
-
-import java.io.IOException;
-
-import org.apache.carbondata.common.iudprocessor.iuddata.BlockletDeleteDeltaCacheLoader;
-import org.apache.carbondata.common.iudprocessor.iuddata.DeleteDeltaCacheLoaderIntf;
-import org.apache.carbondata.core.carbon.querystatistics.QueryStatistic;
-import org.apache.carbondata.core.carbon.querystatistics.QueryStatisticsConstants;
-import org.apache.carbondata.core.carbon.querystatistics.QueryStatisticsModel;
-import org.apache.carbondata.core.constants.CarbonCommonConstants;
-import org.apache.carbondata.scan.executor.infos.BlockExecutionInfo;
-import org.apache.carbondata.scan.expression.exception.FilterUnsupportedException;
-import org.apache.carbondata.scan.processor.BlocksChunkHolder;
-import org.apache.carbondata.scan.result.AbstractScannedResult;
-
-/**
- * Blocklet scanner class to process the block
- */
-public abstract class AbstractBlockletScanner implements BlockletScanner {
-
- /**
- * scanner result
- */
- protected AbstractScannedResult scannedResult;
-
- /**
- * block execution info
- */
- protected BlockExecutionInfo blockExecutionInfo;
-
- public QueryStatisticsModel queryStatisticsModel;
-
- public AbstractBlockletScanner(BlockExecutionInfo tableBlockExecutionInfos) {
- this.blockExecutionInfo = tableBlockExecutionInfos;
- }
-
- @Override public AbstractScannedResult scanBlocklet(BlocksChunkHolder blocksChunkHolder)
- throws IOException, FilterUnsupportedException {
- fillKeyValue(blocksChunkHolder);
- return scannedResult;
- }
-
- protected void fillKeyValue(BlocksChunkHolder blocksChunkHolder) throws IOException {
-
- QueryStatistic totalBlockletStatistic = queryStatisticsModel.getStatisticsTypeAndObjMap()
- .get(QueryStatisticsConstants.TOTAL_BLOCKLET_NUM);
- totalBlockletStatistic.addCountStatistic(QueryStatisticsConstants.TOTAL_BLOCKLET_NUM,
- totalBlockletStatistic.getCount() + 1);
- queryStatisticsModel.getRecorder().recordStatistics(totalBlockletStatistic);
- QueryStatistic validScannedBlockletStatistic = queryStatisticsModel
- .getStatisticsTypeAndObjMap().get(QueryStatisticsConstants.VALID_SCAN_BLOCKLET_NUM);
- validScannedBlockletStatistic
- .addCountStatistic(QueryStatisticsConstants.VALID_SCAN_BLOCKLET_NUM,
- validScannedBlockletStatistic.getCount() + 1);
- queryStatisticsModel.getRecorder().recordStatistics(validScannedBlockletStatistic);
- scannedResult.reset();
- scannedResult.setNumberOfRows(blocksChunkHolder.getDataBlock().nodeSize());
- scannedResult.setBlockletId(
- blockExecutionInfo.getBlockId() + CarbonCommonConstants.FILE_SEPARATOR
- + blocksChunkHolder.getDataBlock().nodeNumber());
- scannedResult.setDimensionChunks(blocksChunkHolder.getDataBlock()
- .getDimensionChunks(blocksChunkHolder.getFileReader(),
- blockExecutionInfo.getAllSelectedDimensionBlocksIndexes()));
- scannedResult.setMeasureChunks(blocksChunkHolder.getDataBlock()
- .getMeasureChunks(blocksChunkHolder.getFileReader(),
- blockExecutionInfo.getAllSelectedMeasureBlocksIndexes()));
- // loading delete data cache in blockexecutioninfo instance
- DeleteDeltaCacheLoaderIntf deleteCacheLoader =
- new BlockletDeleteDeltaCacheLoader(scannedResult.getBlockletId(),
- blocksChunkHolder.getDataBlock(), blockExecutionInfo.getAbsoluteTableIdentifier());
- deleteCacheLoader.loadDeleteDeltaFileDataToCache();
- scannedResult
- .setBlockletDeleteDeltaCache(blocksChunkHolder.getDataBlock().getDeleteDeltaDataCache());
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-carbondata/blob/ce09aaaf/core/src/main/java/org/apache/carbondata/scan/scanner/BlockletScanner.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/carbondata/scan/scanner/BlockletScanner.java b/core/src/main/java/org/apache/carbondata/scan/scanner/BlockletScanner.java
deleted file mode 100644
index 39a20b2..0000000
--- a/core/src/main/java/org/apache/carbondata/scan/scanner/BlockletScanner.java
+++ /dev/null
@@ -1,42 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.carbondata.scan.scanner;
-
-import java.io.IOException;
-
-import org.apache.carbondata.scan.expression.exception.FilterUnsupportedException;
-import org.apache.carbondata.scan.processor.BlocksChunkHolder;
-import org.apache.carbondata.scan.result.AbstractScannedResult;
-
-/**
- * Interface for processing the block
- * Processing can be filter based processing or non filter based processing
- */
-public interface BlockletScanner {
-
- /**
- * Below method will used to process the block data and get the scanned result
- *
- * @param blocksChunkHolder block chunk which holds the block data
- * @return scannerResult
- * result after processing
- */
- AbstractScannedResult scanBlocklet(BlocksChunkHolder blocksChunkHolder)
- throws IOException, FilterUnsupportedException;
-}
http://git-wip-us.apache.org/repos/asf/incubator-carbondata/blob/ce09aaaf/core/src/main/java/org/apache/carbondata/scan/scanner/impl/FilterScanner.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/carbondata/scan/scanner/impl/FilterScanner.java b/core/src/main/java/org/apache/carbondata/scan/scanner/impl/FilterScanner.java
deleted file mode 100644
index 2b2b8bf..0000000
--- a/core/src/main/java/org/apache/carbondata/scan/scanner/impl/FilterScanner.java
+++ /dev/null
@@ -1,202 +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.scan.scanner.impl;
-
-import java.io.IOException;
-import java.util.BitSet;
-
-import org.apache.carbondata.common.iudprocessor.iuddata.BlockletDeleteDeltaCacheLoader;
-import org.apache.carbondata.common.iudprocessor.iuddata.DeleteDeltaCacheLoaderIntf;
-import org.apache.carbondata.core.carbon.datastore.chunk.DimensionColumnDataChunk;
-import org.apache.carbondata.core.carbon.datastore.chunk.MeasureColumnDataChunk;
-import org.apache.carbondata.core.carbon.querystatistics.QueryStatistic;
-import org.apache.carbondata.core.carbon.querystatistics.QueryStatisticsConstants;
-import org.apache.carbondata.core.carbon.querystatistics.QueryStatisticsModel;
-import org.apache.carbondata.core.constants.CarbonCommonConstants;
-import org.apache.carbondata.core.datastorage.store.FileHolder;
-import org.apache.carbondata.core.util.CarbonProperties;
-import org.apache.carbondata.core.util.CarbonUtil;
-import org.apache.carbondata.scan.executor.infos.BlockExecutionInfo;
-import org.apache.carbondata.scan.expression.exception.FilterUnsupportedException;
-import org.apache.carbondata.scan.filter.executer.FilterExecuter;
-import org.apache.carbondata.scan.processor.BlocksChunkHolder;
-import org.apache.carbondata.scan.result.AbstractScannedResult;
-import org.apache.carbondata.scan.result.impl.FilterQueryScannedResult;
-import org.apache.carbondata.scan.scanner.AbstractBlockletScanner;
-
-/**
- * Below class will be used for filter query processing
- * this class will be first apply the filter then it will read the block if
- * required and return the scanned result
- */
-public class FilterScanner extends AbstractBlockletScanner {
-
- /**
- * filter tree
- */
- private FilterExecuter filterExecuter;
- /**
- * this will be used to apply min max
- * this will be useful for dimension column which is on the right side
- * as node finder will always give tentative blocks, if column data stored individually
- * and data is in sorted order then we can check whether filter is in the range of min max or not
- * if it present then only we can apply filter on complete data.
- * this will be very useful in case of sparse data when rows are
- * repeating.
- */
- private boolean isMinMaxEnabled;
-
- private QueryStatisticsModel queryStatisticsModel;
-
- public FilterScanner(BlockExecutionInfo blockExecutionInfo,
- QueryStatisticsModel queryStatisticsModel) {
- super(blockExecutionInfo);
- scannedResult = new FilterQueryScannedResult(blockExecutionInfo);
- // to check whether min max is enabled or not
- String minMaxEnableValue = CarbonProperties.getInstance()
- .getProperty(CarbonCommonConstants.CARBON_QUERY_MIN_MAX_ENABLED,
- CarbonCommonConstants.MIN_MAX_DEFAULT_VALUE);
- if (null != minMaxEnableValue) {
- isMinMaxEnabled = Boolean.parseBoolean(minMaxEnableValue);
- }
- // get the filter tree
- this.filterExecuter = blockExecutionInfo.getFilterExecuterTree();
- this.queryStatisticsModel = queryStatisticsModel;
- }
-
- /**
- * Below method will be used to process the block
- *
- * @param blocksChunkHolder block chunk holder which holds the data
- * @throws FilterUnsupportedException
- */
- @Override public AbstractScannedResult scanBlocklet(BlocksChunkHolder blocksChunkHolder)
- throws IOException, FilterUnsupportedException {
- fillScannedResult(blocksChunkHolder);
- return scannedResult;
- }
-
- /**
- * This method will process the data in below order
- * 1. first apply min max on the filter tree and check whether any of the filter
- * is fall on the range of min max, if not then return empty result
- * 2. If filter falls on min max range then apply filter on actual
- * data and get the filtered row index
- * 3. if row index is empty then return the empty result
- * 4. if row indexes is not empty then read only those blocks(measure or dimension)
- * which was present in the query but not present in the filter, as while applying filter
- * some of the blocks where already read and present in chunk holder so not need to
- * read those blocks again, this is to avoid reading of same blocks which was already read
- * 5. Set the blocks and filter indexes to result
- *
- * @param blocksChunkHolder
- * @throws FilterUnsupportedException
- */
- private void fillScannedResult(BlocksChunkHolder blocksChunkHolder)
- throws FilterUnsupportedException, IOException {
- scannedResult.reset();
- scannedResult.setBlockletId(
- blockExecutionInfo.getBlockId() + CarbonCommonConstants.FILE_SEPARATOR + blocksChunkHolder
- .getDataBlock().nodeNumber());
- // apply min max
- if (isMinMaxEnabled) {
- BitSet bitSet = this.filterExecuter
- .isScanRequired(blocksChunkHolder.getDataBlock().getColumnsMaxValue(),
- blocksChunkHolder.getDataBlock().getColumnsMinValue());
- if (bitSet.isEmpty()) {
- scannedResult.setNumberOfRows(0);
- scannedResult.setIndexes(new int[0]);
- CarbonUtil.freeMemory(blocksChunkHolder.getDimensionDataChunk(),
- blocksChunkHolder.getMeasureDataChunk());
- return;
- }
- }
- // apply filter on actual data
- BitSet bitSet = this.filterExecuter.applyFilter(blocksChunkHolder);
- // if indexes is empty then return with empty result
- if (bitSet.isEmpty()) {
- scannedResult.setNumberOfRows(0);
- scannedResult.setIndexes(new int[0]);
- CarbonUtil.freeMemory(blocksChunkHolder.getDimensionDataChunk(),
- blocksChunkHolder.getMeasureDataChunk());
- return;
- }
- // valid scanned blocklet
- QueryStatistic validScannedBlockletStatistic = queryStatisticsModel.getStatisticsTypeAndObjMap()
- .get(QueryStatisticsConstants.VALID_SCAN_BLOCKLET_NUM);
- validScannedBlockletStatistic
- .addCountStatistic(QueryStatisticsConstants.VALID_SCAN_BLOCKLET_NUM,
- validScannedBlockletStatistic.getCount() + 1);
- queryStatisticsModel.getRecorder().recordStatistics(validScannedBlockletStatistic);
- // get the row indexes from bot set
- int[] indexes = new int[bitSet.cardinality()];
- int index = 0;
- for (int i = bitSet.nextSetBit(0); i >= 0; i = bitSet.nextSetBit(i + 1)) {
- indexes[index++] = i;
- }
- // loading delete data cache in blockexecutioninfo instance
- DeleteDeltaCacheLoaderIntf deleteCacheLoader =
- new BlockletDeleteDeltaCacheLoader(scannedResult.getBlockletId(),
- blocksChunkHolder.getDataBlock(), blockExecutionInfo.getAbsoluteTableIdentifier());
- deleteCacheLoader.loadDeleteDeltaFileDataToCache();
- scannedResult
- .setBlockletDeleteDeltaCache(blocksChunkHolder.getDataBlock().getDeleteDeltaDataCache());
- FileHolder fileReader = blocksChunkHolder.getFileReader();
- int[][] allSelectedDimensionBlocksIndexes =
- blockExecutionInfo.getAllSelectedDimensionBlocksIndexes();
- DimensionColumnDataChunk[] projectionListDimensionChunk = blocksChunkHolder.getDataBlock()
- .getDimensionChunks(fileReader, allSelectedDimensionBlocksIndexes);
-
- DimensionColumnDataChunk[] dimensionColumnDataChunk =
- new DimensionColumnDataChunk[blockExecutionInfo.getTotalNumberDimensionBlock()];
- // read dimension chunk blocks from file which is not present
- for (int i = 0; i < dimensionColumnDataChunk.length; i++) {
- if (null != blocksChunkHolder.getDimensionDataChunk()[i]) {
- dimensionColumnDataChunk[i] = blocksChunkHolder.getDimensionDataChunk()[i];
- }
- }
- for (int i = 0; i < allSelectedDimensionBlocksIndexes.length; i++) {
- System.arraycopy(projectionListDimensionChunk, allSelectedDimensionBlocksIndexes[i][0],
- dimensionColumnDataChunk, allSelectedDimensionBlocksIndexes[i][0],
- allSelectedDimensionBlocksIndexes[i][1] + 1 - allSelectedDimensionBlocksIndexes[i][0]);
- }
- MeasureColumnDataChunk[] measureColumnDataChunk =
- new MeasureColumnDataChunk[blockExecutionInfo.getTotalNumberOfMeasureBlock()];
- int[][] allSelectedMeasureBlocksIndexes =
- blockExecutionInfo.getAllSelectedMeasureBlocksIndexes();
- MeasureColumnDataChunk[] projectionListMeasureChunk = blocksChunkHolder.getDataBlock()
- .getMeasureChunks(fileReader, allSelectedMeasureBlocksIndexes);
- // read the measure chunk blocks which is not present
- for (int i = 0; i < measureColumnDataChunk.length; i++) {
- if (null != blocksChunkHolder.getMeasureDataChunk()[i]) {
- measureColumnDataChunk[i] = blocksChunkHolder.getMeasureDataChunk()[i];
- }
- }
- for (int i = 0; i < allSelectedMeasureBlocksIndexes.length; i++) {
- System.arraycopy(projectionListMeasureChunk, allSelectedMeasureBlocksIndexes[i][0],
- measureColumnDataChunk, allSelectedMeasureBlocksIndexes[i][0],
- allSelectedMeasureBlocksIndexes[i][1] + 1 - allSelectedMeasureBlocksIndexes[i][0]);
- }
- scannedResult.setDimensionChunks(dimensionColumnDataChunk);
- scannedResult.setIndexes(indexes);
- scannedResult.setMeasureChunks(measureColumnDataChunk);
- scannedResult.setNumberOfRows(indexes.length);
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-carbondata/blob/ce09aaaf/core/src/main/java/org/apache/carbondata/scan/scanner/impl/NonFilterScanner.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/carbondata/scan/scanner/impl/NonFilterScanner.java b/core/src/main/java/org/apache/carbondata/scan/scanner/impl/NonFilterScanner.java
deleted file mode 100644
index 5c5dd3a..0000000
--- a/core/src/main/java/org/apache/carbondata/scan/scanner/impl/NonFilterScanner.java
+++ /dev/null
@@ -1,40 +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.scan.scanner.impl;
-
-import org.apache.carbondata.core.carbon.querystatistics.QueryStatisticsModel;
-import org.apache.carbondata.scan.executor.infos.BlockExecutionInfo;
-import org.apache.carbondata.scan.result.impl.NonFilterQueryScannedResult;
-import org.apache.carbondata.scan.scanner.AbstractBlockletScanner;
-
-/**
- * Non filter processor which will be used for non filter query
- * In case of non filter query we just need to read all the blocks requested in the
- * query and pass it to scanned result
- */
-public class NonFilterScanner extends AbstractBlockletScanner {
-
- public NonFilterScanner(BlockExecutionInfo blockExecutionInfo,
- QueryStatisticsModel queryStatisticsModel) {
- super(blockExecutionInfo);
- // as its a non filter query creating a non filter query scanned result object
- scannedResult = new NonFilterQueryScannedResult(blockExecutionInfo);
- super.queryStatisticsModel = queryStatisticsModel;
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-carbondata/blob/ce09aaaf/core/src/main/java/org/apache/carbondata/scan/wrappers/ByteArrayWrapper.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/carbondata/scan/wrappers/ByteArrayWrapper.java b/core/src/main/java/org/apache/carbondata/scan/wrappers/ByteArrayWrapper.java
deleted file mode 100644
index 1805636..0000000
--- a/core/src/main/java/org/apache/carbondata/scan/wrappers/ByteArrayWrapper.java
+++ /dev/null
@@ -1,221 +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.scan.wrappers;
-
-import org.apache.carbondata.core.util.ByteUtil.UnsafeComparer;
-
-/**
- * This class will store the dimension column data when query is executed
- * This can be used as a key for aggregation
- */
-public class ByteArrayWrapper implements Comparable<ByteArrayWrapper> {
-
- /**
- * to store key which is generated using
- * key generator
- */
- protected byte[] dictionaryKey;
-
- /**
- * to store no dictionary column data
- */
- protected byte[][] complexTypesKeys;
-
- /**
- * to store no dictionary column data
- */
- protected byte[][] noDictionaryKeys;
-
- /**
- * contains value of implicit columns in byte array format
- */
- protected byte[] implicitColumnByteArray;
-
- public ByteArrayWrapper() {
- }
-
- /**
- * @return the dictionaryKey
- */
- public byte[] getDictionaryKey() {
- return dictionaryKey;
- }
-
- /**
- * @param dictionaryKey the dictionaryKey to set
- */
- public void setDictionaryKey(byte[] dictionaryKey) {
- this.dictionaryKey = dictionaryKey;
- }
-
- /**
- * @param noDictionaryKeys the noDictionaryKeys to set
- */
- public void setNoDictionaryKeys(byte[][] noDictionaryKeys) {
- this.noDictionaryKeys = noDictionaryKeys;
- }
-
- /**
- * to get the no dictionary column data
- *
- * @param index of the no dictionary key
- * @return no dictionary key for the index
- */
- public byte[] getNoDictionaryKeyByIndex(int index) {
- return this.noDictionaryKeys[index];
- }
-
- /**
- * to get the no dictionary column data
- *
- * @param index of the no dictionary key
- * @return no dictionary key for the index
- */
- public byte[] getComplexTypeByIndex(int index) {
- return this.complexTypesKeys[index];
- }
-
- /**
- * to generate the hash code
- */
- @Override public int hashCode() {
- // first generate the has code of the dictionary column
- int len = dictionaryKey.length;
- int result = 1;
- for (int j = 0; j < len; j++) {
- result = 31 * result + dictionaryKey[j];
- }
- // then no dictionary column
- for (byte[] directSurrogateValue : noDictionaryKeys) {
- for (int i = 0; i < directSurrogateValue.length; i++) {
- result = 31 * result + directSurrogateValue[i];
- }
- }
- // then for complex type
- for (byte[] complexTypeKey : complexTypesKeys) {
- for (int i = 0; i < complexTypeKey.length; i++) {
- result = 31 * result + complexTypeKey[i];
- }
- }
- return result;
- }
-
- /**
- * to validate the two
- *
- * @param other object
- */
- @Override public boolean equals(Object other) {
- if (null == other || !(other instanceof ByteArrayWrapper)) {
- return false;
- }
- boolean result = false;
- // Comparison will be as follows
- // first compare the no dictionary column
- // if it is not equal then return false
- // if it is equal then compare the complex column
- // if it is also equal then compare dictionary column
- byte[][] noDictionaryKeysOther = ((ByteArrayWrapper) other).noDictionaryKeys;
- if (noDictionaryKeysOther.length != noDictionaryKeys.length) {
- return false;
- } else {
- for (int i = 0; i < noDictionaryKeys.length; i++) {
- result = UnsafeComparer.INSTANCE.equals(noDictionaryKeys[i], noDictionaryKeysOther[i]);
- if (!result) {
- return false;
- }
- }
- }
-
- byte[][] complexTypesKeysOther = ((ByteArrayWrapper) other).complexTypesKeys;
- if (complexTypesKeysOther.length != complexTypesKeys.length) {
- return false;
- } else {
- for (int i = 0; i < complexTypesKeys.length; i++) {
- result = UnsafeComparer.INSTANCE.equals(complexTypesKeys[i], complexTypesKeysOther[i]);
- if (!result) {
- return false;
- }
- }
- }
-
- return UnsafeComparer.INSTANCE.equals(dictionaryKey, ((ByteArrayWrapper) other).dictionaryKey);
- }
-
- /**
- * Compare method for ByteArrayWrapper class this will used to compare Two
- * ByteArrayWrapper data object, basically it will compare two byte array
- *
- * @param other ArrayWrapper Object
- */
- @Override public int compareTo(ByteArrayWrapper other) {
- // compare will be as follows
- //compare dictionary column
- // then no dictionary column
- // then complex type column data
- int compareTo = UnsafeComparer.INSTANCE.compareTo(dictionaryKey, other.dictionaryKey);
- if (compareTo == 0) {
- for (int i = 0; i < noDictionaryKeys.length; i++) {
- compareTo =
- UnsafeComparer.INSTANCE.compareTo(noDictionaryKeys[i], other.noDictionaryKeys[i]);
- if (compareTo != 0) {
- return compareTo;
- }
- }
- }
- if (compareTo == 0) {
- for (int i = 0; i < complexTypesKeys.length; i++) {
- compareTo =
- UnsafeComparer.INSTANCE.compareTo(complexTypesKeys[i], other.complexTypesKeys[i]);
- if (compareTo != 0) {
- return compareTo;
- }
- }
- }
- return compareTo;
- }
-
- /**
- * @return the complexTypesKeys
- */
- public byte[][] getComplexTypesKeys() {
- return complexTypesKeys;
- }
-
- /**
- * @param complexTypesKeys the complexTypesKeys to set
- */
- public void setComplexTypesKeys(byte[][] complexTypesKeys) {
- this.complexTypesKeys = complexTypesKeys;
- }
-
- /**
- * @return
- */
- public byte[] getImplicitColumnByteArray() {
- return implicitColumnByteArray;
- }
-
- /**
- * @param implicitColumnByteArray
- */
- public void setImplicitColumnByteArray(byte[] implicitColumnByteArray) {
- this.implicitColumnByteArray = implicitColumnByteArray;
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-carbondata/blob/ce09aaaf/core/src/test/java/org/apache/carbondata/core/cache/dictionary/AbstractDictionaryCacheTest.java
----------------------------------------------------------------------
diff --git a/core/src/test/java/org/apache/carbondata/core/cache/dictionary/AbstractDictionaryCacheTest.java b/core/src/test/java/org/apache/carbondata/core/cache/dictionary/AbstractDictionaryCacheTest.java
index 0b64846..f398337 100644
--- a/core/src/test/java/org/apache/carbondata/core/cache/dictionary/AbstractDictionaryCacheTest.java
+++ b/core/src/test/java/org/apache/carbondata/core/cache/dictionary/AbstractDictionaryCacheTest.java
@@ -32,13 +32,13 @@ import java.util.List;
import java.util.Properties;
import org.apache.carbondata.core.cache.Cache;
-import org.apache.carbondata.core.carbon.CarbonTableIdentifier;
-import org.apache.carbondata.core.carbon.ColumnIdentifier;
-import org.apache.carbondata.core.carbon.metadata.datatype.DataType;
-import org.apache.carbondata.core.carbon.path.CarbonStorePath;
-import org.apache.carbondata.core.carbon.path.CarbonTablePath;
-import org.apache.carbondata.core.datastorage.store.filesystem.CarbonFile;
-import org.apache.carbondata.core.datastorage.store.impl.FileFactory;
+import org.apache.carbondata.core.metadata.CarbonTableIdentifier;
+import org.apache.carbondata.core.metadata.ColumnIdentifier;
+import org.apache.carbondata.core.metadata.datatype.DataType;
+import org.apache.carbondata.core.util.path.CarbonStorePath;
+import org.apache.carbondata.core.util.path.CarbonTablePath;
+import org.apache.carbondata.core.datastore.filesystem.CarbonFile;
+import org.apache.carbondata.core.datastore.impl.FileFactory;
import org.apache.carbondata.core.util.CarbonUtil;
import org.apache.carbondata.core.writer.CarbonDictionaryWriter;
import org.apache.carbondata.core.writer.CarbonDictionaryWriterImpl;
http://git-wip-us.apache.org/repos/asf/incubator-carbondata/blob/ce09aaaf/core/src/test/java/org/apache/carbondata/core/cache/dictionary/ColumnDictionaryInfoTest.java
----------------------------------------------------------------------
diff --git a/core/src/test/java/org/apache/carbondata/core/cache/dictionary/ColumnDictionaryInfoTest.java b/core/src/test/java/org/apache/carbondata/core/cache/dictionary/ColumnDictionaryInfoTest.java
index d6ffd61..86cd61b 100644
--- a/core/src/test/java/org/apache/carbondata/core/cache/dictionary/ColumnDictionaryInfoTest.java
+++ b/core/src/test/java/org/apache/carbondata/core/cache/dictionary/ColumnDictionaryInfoTest.java
@@ -24,7 +24,7 @@ import java.util.Arrays;
import java.util.List;
import java.util.concurrent.CopyOnWriteArrayList;
-import org.apache.carbondata.core.carbon.metadata.datatype.DataType;
+import org.apache.carbondata.core.metadata.datatype.DataType;
import org.apache.carbondata.core.constants.CarbonCommonConstants;
import org.apache.carbondata.core.util.CarbonUtil;
http://git-wip-us.apache.org/repos/asf/incubator-carbondata/blob/ce09aaaf/core/src/test/java/org/apache/carbondata/core/cache/dictionary/DictionaryCacheLoaderImplTest.java
----------------------------------------------------------------------
diff --git a/core/src/test/java/org/apache/carbondata/core/cache/dictionary/DictionaryCacheLoaderImplTest.java b/core/src/test/java/org/apache/carbondata/core/cache/dictionary/DictionaryCacheLoaderImplTest.java
index 0a63b2a..f9ad746 100644
--- a/core/src/test/java/org/apache/carbondata/core/cache/dictionary/DictionaryCacheLoaderImplTest.java
+++ b/core/src/test/java/org/apache/carbondata/core/cache/dictionary/DictionaryCacheLoaderImplTest.java
@@ -26,9 +26,9 @@ import java.util.Iterator;
import java.util.List;
import java.util.Map;
-import org.apache.carbondata.core.carbon.CarbonTableIdentifier;
-import org.apache.carbondata.core.carbon.ColumnIdentifier;
-import org.apache.carbondata.core.carbon.metadata.datatype.DataType;
+import org.apache.carbondata.core.metadata.CarbonTableIdentifier;
+import org.apache.carbondata.core.metadata.ColumnIdentifier;
+import org.apache.carbondata.core.metadata.datatype.DataType;
import org.apache.carbondata.core.reader.CarbonDictionaryReaderImpl;
import org.apache.carbondata.core.reader.sortindex.CarbonDictionarySortIndexReaderImpl;
import org.apache.carbondata.format.ColumnDictionaryChunk;
http://git-wip-us.apache.org/repos/asf/incubator-carbondata/blob/ce09aaaf/core/src/test/java/org/apache/carbondata/core/cache/dictionary/DictionaryColumnUniqueIdentifierTest.java
----------------------------------------------------------------------
diff --git a/core/src/test/java/org/apache/carbondata/core/cache/dictionary/DictionaryColumnUniqueIdentifierTest.java b/core/src/test/java/org/apache/carbondata/core/cache/dictionary/DictionaryColumnUniqueIdentifierTest.java
index f4210c5..c0d3bf2 100644
--- a/core/src/test/java/org/apache/carbondata/core/cache/dictionary/DictionaryColumnUniqueIdentifierTest.java
+++ b/core/src/test/java/org/apache/carbondata/core/cache/dictionary/DictionaryColumnUniqueIdentifierTest.java
@@ -21,9 +21,9 @@ package org.apache.carbondata.core.cache.dictionary;
import mockit.Mock;
import mockit.MockUp;
-import org.apache.carbondata.core.carbon.CarbonTableIdentifier;
-import org.apache.carbondata.core.carbon.ColumnIdentifier;
-import org.apache.carbondata.core.carbon.metadata.datatype.DataType;
+import org.apache.carbondata.core.metadata.CarbonTableIdentifier;
+import org.apache.carbondata.core.metadata.ColumnIdentifier;
+import org.apache.carbondata.core.metadata.datatype.DataType;
import org.junit.BeforeClass;
import org.junit.Test;
http://git-wip-us.apache.org/repos/asf/incubator-carbondata/blob/ce09aaaf/core/src/test/java/org/apache/carbondata/core/cache/dictionary/ForwardDictionaryCacheTest.java
----------------------------------------------------------------------
diff --git a/core/src/test/java/org/apache/carbondata/core/cache/dictionary/ForwardDictionaryCacheTest.java b/core/src/test/java/org/apache/carbondata/core/cache/dictionary/ForwardDictionaryCacheTest.java
index 953e24f..c6fda5c 100644
--- a/core/src/test/java/org/apache/carbondata/core/cache/dictionary/ForwardDictionaryCacheTest.java
+++ b/core/src/test/java/org/apache/carbondata/core/cache/dictionary/ForwardDictionaryCacheTest.java
@@ -30,8 +30,8 @@ import java.util.UUID;
import org.apache.carbondata.core.cache.Cache;
import org.apache.carbondata.core.cache.CacheProvider;
import org.apache.carbondata.core.cache.CacheType;
-import org.apache.carbondata.core.carbon.CarbonTableIdentifier;
-import org.apache.carbondata.core.carbon.ColumnIdentifier;
+import org.apache.carbondata.core.metadata.CarbonTableIdentifier;
+import org.apache.carbondata.core.metadata.ColumnIdentifier;
import org.apache.carbondata.core.constants.CarbonCommonConstants;
import org.apache.carbondata.core.util.CarbonProperties;
import org.apache.carbondata.core.writer.sortindex.CarbonDictionarySortIndexWriter;
http://git-wip-us.apache.org/repos/asf/incubator-carbondata/blob/ce09aaaf/core/src/test/java/org/apache/carbondata/core/cache/dictionary/ForwardDictionaryTest.java
----------------------------------------------------------------------
diff --git a/core/src/test/java/org/apache/carbondata/core/cache/dictionary/ForwardDictionaryTest.java b/core/src/test/java/org/apache/carbondata/core/cache/dictionary/ForwardDictionaryTest.java
index 4812aa2..c950913 100644
--- a/core/src/test/java/org/apache/carbondata/core/cache/dictionary/ForwardDictionaryTest.java
+++ b/core/src/test/java/org/apache/carbondata/core/cache/dictionary/ForwardDictionaryTest.java
@@ -21,7 +21,7 @@ package org.apache.carbondata.core.cache.dictionary;
import mockit.Mock;
import mockit.MockUp;
-import org.apache.carbondata.core.carbon.metadata.datatype.DataType;
+import org.apache.carbondata.core.metadata.datatype.DataType;
import org.junit.BeforeClass;
import org.junit.Test;
http://git-wip-us.apache.org/repos/asf/incubator-carbondata/blob/ce09aaaf/core/src/test/java/org/apache/carbondata/core/cache/dictionary/ReverseDictionaryCacheTest.java
----------------------------------------------------------------------
diff --git a/core/src/test/java/org/apache/carbondata/core/cache/dictionary/ReverseDictionaryCacheTest.java b/core/src/test/java/org/apache/carbondata/core/cache/dictionary/ReverseDictionaryCacheTest.java
index 49b5a7b..cf4ed97 100644
--- a/core/src/test/java/org/apache/carbondata/core/cache/dictionary/ReverseDictionaryCacheTest.java
+++ b/core/src/test/java/org/apache/carbondata/core/cache/dictionary/ReverseDictionaryCacheTest.java
@@ -34,9 +34,9 @@ import mockit.MockUp;
import org.apache.carbondata.core.cache.Cache;
import org.apache.carbondata.core.cache.CacheProvider;
import org.apache.carbondata.core.cache.CacheType;
-import org.apache.carbondata.core.carbon.CarbonTableIdentifier;
-import org.apache.carbondata.core.carbon.ColumnIdentifier;
-import org.apache.carbondata.core.carbon.metadata.datatype.DataType;
+import org.apache.carbondata.core.metadata.CarbonTableIdentifier;
+import org.apache.carbondata.core.metadata.ColumnIdentifier;
+import org.apache.carbondata.core.metadata.datatype.DataType;
import org.apache.carbondata.core.constants.CarbonCommonConstants;
import org.apache.carbondata.core.reader.CarbonDictionaryColumnMetaChunk;
import org.apache.carbondata.core.util.CarbonProperties;
http://git-wip-us.apache.org/repos/asf/incubator-carbondata/blob/ce09aaaf/core/src/test/java/org/apache/carbondata/core/carbon/AbsoluteTableIdentifierTest.java
----------------------------------------------------------------------
diff --git a/core/src/test/java/org/apache/carbondata/core/carbon/AbsoluteTableIdentifierTest.java b/core/src/test/java/org/apache/carbondata/core/carbon/AbsoluteTableIdentifierTest.java
index 94e2940..e95838e 100644
--- a/core/src/test/java/org/apache/carbondata/core/carbon/AbsoluteTableIdentifierTest.java
+++ b/core/src/test/java/org/apache/carbondata/core/carbon/AbsoluteTableIdentifierTest.java
@@ -19,6 +19,9 @@
package org.apache.carbondata.core.carbon;
+import org.apache.carbondata.core.metadata.AbsoluteTableIdentifier;
+import org.apache.carbondata.core.metadata.CarbonTableIdentifier;
+
import org.junit.BeforeClass;
import org.junit.Test;
http://git-wip-us.apache.org/repos/asf/incubator-carbondata/blob/ce09aaaf/core/src/test/java/org/apache/carbondata/core/carbon/CarbonTableIdentifierTest.java
----------------------------------------------------------------------
diff --git a/core/src/test/java/org/apache/carbondata/core/carbon/CarbonTableIdentifierTest.java b/core/src/test/java/org/apache/carbondata/core/carbon/CarbonTableIdentifierTest.java
index d182272..2ea4055 100644
--- a/core/src/test/java/org/apache/carbondata/core/carbon/CarbonTableIdentifierTest.java
+++ b/core/src/test/java/org/apache/carbondata/core/carbon/CarbonTableIdentifierTest.java
@@ -18,6 +18,8 @@
*/
package org.apache.carbondata.core.carbon;
+import org.apache.carbondata.core.metadata.CarbonTableIdentifier;
+
import org.junit.BeforeClass;
import org.junit.Test;
http://git-wip-us.apache.org/repos/asf/incubator-carbondata/blob/ce09aaaf/core/src/test/java/org/apache/carbondata/core/carbon/ColumnIdentifierTest.java
----------------------------------------------------------------------
diff --git a/core/src/test/java/org/apache/carbondata/core/carbon/ColumnIdentifierTest.java b/core/src/test/java/org/apache/carbondata/core/carbon/ColumnIdentifierTest.java
index 65f6120..a910fe4 100644
--- a/core/src/test/java/org/apache/carbondata/core/carbon/ColumnIdentifierTest.java
+++ b/core/src/test/java/org/apache/carbondata/core/carbon/ColumnIdentifierTest.java
@@ -18,7 +18,8 @@
*/
package org.apache.carbondata.core.carbon;
-import org.apache.carbondata.core.carbon.metadata.datatype.DataType;
+import org.apache.carbondata.core.metadata.ColumnIdentifier;
+import org.apache.carbondata.core.metadata.datatype.DataType;
import org.junit.BeforeClass;
import org.junit.Test;
http://git-wip-us.apache.org/repos/asf/incubator-carbondata/blob/ce09aaaf/core/src/test/java/org/apache/carbondata/core/carbon/datastorage/filesystem/store/impl/CompressedDataMeasureWrapperTest.java
----------------------------------------------------------------------
diff --git a/core/src/test/java/org/apache/carbondata/core/carbon/datastorage/filesystem/store/impl/CompressedDataMeasureWrapperTest.java b/core/src/test/java/org/apache/carbondata/core/carbon/datastorage/filesystem/store/impl/CompressedDataMeasureWrapperTest.java
index 0c3cb84..1ba82f8 100644
--- a/core/src/test/java/org/apache/carbondata/core/carbon/datastorage/filesystem/store/impl/CompressedDataMeasureWrapperTest.java
+++ b/core/src/test/java/org/apache/carbondata/core/carbon/datastorage/filesystem/store/impl/CompressedDataMeasureWrapperTest.java
@@ -19,8 +19,8 @@
package org.apache.carbondata.core.carbon.datastorage.filesystem.store.impl;
-import org.apache.carbondata.core.datastorage.store.dataholder.CarbonReadDataHolder;
-import org.apache.carbondata.core.datastorage.store.impl.CompressedDataMeasureDataWrapper;
+import org.apache.carbondata.core.datastore.dataholder.CarbonReadDataHolder;
+import org.apache.carbondata.core.datastore.impl.CompressedDataMeasureDataWrapper;
import org.junit.BeforeClass;
import org.junit.Test;
http://git-wip-us.apache.org/repos/asf/incubator-carbondata/blob/ce09aaaf/core/src/test/java/org/apache/carbondata/core/carbon/datastorage/filesystem/store/impl/DFSFileHolderImplUnitTest.java
----------------------------------------------------------------------
diff --git a/core/src/test/java/org/apache/carbondata/core/carbon/datastorage/filesystem/store/impl/DFSFileHolderImplUnitTest.java b/core/src/test/java/org/apache/carbondata/core/carbon/datastorage/filesystem/store/impl/DFSFileHolderImplUnitTest.java
index 3b3ab9f..23a47c9 100644
--- a/core/src/test/java/org/apache/carbondata/core/carbon/datastorage/filesystem/store/impl/DFSFileHolderImplUnitTest.java
+++ b/core/src/test/java/org/apache/carbondata/core/carbon/datastorage/filesystem/store/impl/DFSFileHolderImplUnitTest.java
@@ -24,7 +24,7 @@ import java.io.FileOutputStream;
import java.io.IOException;
import java.io.OutputStreamWriter;
-import org.apache.carbondata.core.datastorage.store.impl.DFSFileHolderImpl;
+import org.apache.carbondata.core.datastore.impl.DFSFileHolderImpl;
import mockit.Mock;
import mockit.MockUp;
http://git-wip-us.apache.org/repos/asf/incubator-carbondata/blob/ce09aaaf/core/src/test/java/org/apache/carbondata/core/carbon/datastorage/filesystem/store/impl/FileFactoryImplUnitTest.java
----------------------------------------------------------------------
diff --git a/core/src/test/java/org/apache/carbondata/core/carbon/datastorage/filesystem/store/impl/FileFactoryImplUnitTest.java b/core/src/test/java/org/apache/carbondata/core/carbon/datastorage/filesystem/store/impl/FileFactoryImplUnitTest.java
index 8277f91..6d9465c 100644
--- a/core/src/test/java/org/apache/carbondata/core/carbon/datastorage/filesystem/store/impl/FileFactoryImplUnitTest.java
+++ b/core/src/test/java/org/apache/carbondata/core/carbon/datastorage/filesystem/store/impl/FileFactoryImplUnitTest.java
@@ -22,7 +22,7 @@ package org.apache.carbondata.core.carbon.datastorage.filesystem.store.impl;
import java.io.File;
import java.io.IOException;
-import org.apache.carbondata.core.datastorage.store.impl.FileFactory;
+import org.apache.carbondata.core.datastore.impl.FileFactory;
import mockit.Mock;
import mockit.MockUp;
http://git-wip-us.apache.org/repos/asf/incubator-carbondata/blob/ce09aaaf/core/src/test/java/org/apache/carbondata/core/carbon/datastorage/filesystem/store/impl/FileHolderImplUnitTest.java
----------------------------------------------------------------------
diff --git a/core/src/test/java/org/apache/carbondata/core/carbon/datastorage/filesystem/store/impl/FileHolderImplUnitTest.java b/core/src/test/java/org/apache/carbondata/core/carbon/datastorage/filesystem/store/impl/FileHolderImplUnitTest.java
index c14dff9..82863c6 100644
--- a/core/src/test/java/org/apache/carbondata/core/carbon/datastorage/filesystem/store/impl/FileHolderImplUnitTest.java
+++ b/core/src/test/java/org/apache/carbondata/core/carbon/datastorage/filesystem/store/impl/FileHolderImplUnitTest.java
@@ -24,7 +24,7 @@ import java.io.FileOutputStream;
import java.io.IOException;
import java.io.OutputStreamWriter;
-import org.apache.carbondata.core.datastorage.store.impl.FileHolderImpl;
+import org.apache.carbondata.core.datastore.impl.FileHolderImpl;
import mockit.Mock;
import mockit.MockUp;
http://git-wip-us.apache.org/repos/asf/incubator-carbondata/blob/ce09aaaf/core/src/test/java/org/apache/carbondata/core/carbon/datastore/SegmentTaskIndexStoreTest.java
----------------------------------------------------------------------
diff --git a/core/src/test/java/org/apache/carbondata/core/carbon/datastore/SegmentTaskIndexStoreTest.java b/core/src/test/java/org/apache/carbondata/core/carbon/datastore/SegmentTaskIndexStoreTest.java
deleted file mode 100644
index 17e39f3..0000000
--- a/core/src/test/java/org/apache/carbondata/core/carbon/datastore/SegmentTaskIndexStoreTest.java
+++ /dev/null
@@ -1,143 +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.carbon.datastore;
-
-import java.io.IOException;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
-import org.apache.carbondata.core.cache.CacheProvider;
-import org.apache.carbondata.core.cache.CacheType;
-import org.apache.carbondata.core.carbon.AbsoluteTableIdentifier;
-import org.apache.carbondata.core.carbon.CarbonTableIdentifier;
-import org.apache.carbondata.core.carbon.ColumnarFormatVersion;
-import org.apache.carbondata.core.carbon.datastore.block.AbstractIndex;
-import org.apache.carbondata.core.carbon.datastore.block.SegmentTaskIndex;
-import org.apache.carbondata.core.carbon.datastore.block.SegmentTaskIndexWrapper;
-import org.apache.carbondata.core.carbon.datastore.block.TableBlockInfo;
-import org.apache.carbondata.core.carbon.metadata.blocklet.BlockletInfo;
-import org.apache.carbondata.core.carbon.metadata.blocklet.DataFileFooter;
-import org.apache.carbondata.core.carbon.metadata.blocklet.SegmentInfo;
-import org.apache.carbondata.core.carbon.metadata.schema.table.column.ColumnSchema;
-import org.apache.carbondata.core.carbon.path.CarbonTablePath;
-import org.apache.carbondata.core.util.CarbonUtil;
-
-import mockit.Mock;
-import mockit.MockUp;
-import org.junit.BeforeClass;
-import org.junit.Test;
-
-import static junit.framework.TestCase.assertEquals;
-import static junit.framework.TestCase.assertTrue;
-import static org.junit.Assert.assertNull;
-
-public class SegmentTaskIndexStoreTest {
-
- private static short version = 1;
- private static String locations[] = { "/tmp" };
- private static SegmentTaskIndexStore taskIndexStore;
- private static TableBlockInfo tableBlockInfo;
- private static AbsoluteTableIdentifier absoluteTableIdentifier;
-
- @BeforeClass public static void setUp() {
- CacheProvider cacheProvider = CacheProvider.getInstance();
- taskIndexStore = (SegmentTaskIndexStore) cacheProvider.
- <TableSegmentUniqueIdentifier, SegmentTaskIndexWrapper>
- createCache(CacheType.DRIVER_BTREE, "");
- tableBlockInfo = new TableBlockInfo("file", 0L, "SG100", locations, 10L,
- ColumnarFormatVersion.valueOf(version));
- absoluteTableIdentifier = new AbsoluteTableIdentifier("/tmp",
- new CarbonTableIdentifier("testdatabase", "testtable", "TB100"));
- }
-
- private List<DataFileFooter> getDataFileFooters() {
- SegmentInfo segmentInfo = new SegmentInfo();
- DataFileFooter footer = new DataFileFooter();
- ColumnSchema columnSchema = new ColumnSchema();
- BlockletInfo blockletInfo = new BlockletInfo();
- List<DataFileFooter> footerList = new ArrayList<DataFileFooter>();
- List<ColumnSchema> columnSchemaList = new ArrayList<ColumnSchema>();
-
- columnSchema.setColumnName("employeeName");
- columnSchemaList.add(new ColumnSchema());
-
- footer.setSegmentInfo(segmentInfo);
- footer.setColumnInTable(columnSchemaList);
- footer.setBlockletList(Arrays.asList(blockletInfo));
- footerList.add(footer);
- return footerList;
- }
-
- @Test public void loadAndGetTaskIdToSegmentsMap() throws IOException {
- new MockUp<CarbonTablePath.DataFileUtil>() {
- @Mock String getTaskNo(String carbonDataFileName) {
- return "100";
- }
- };
-
- new MockUp<CarbonUtil>() {
- @Mock List<DataFileFooter> readCarbonIndexFile(String taskId,
- String bucketNumber,
- List<TableBlockInfo> tableBlockInfoList,
- AbsoluteTableIdentifier absoluteTableIdentifier) {
- return getDataFileFooters();
- }
- };
-
- new MockUp<CarbonTablePath>() {
- @Mock public String getCarbonIndexFilePath(final String taskId, final String partitionId,
- final String segmentId, final String bucketNumber) {
- return "/src/test/resources";
- }
- };
-
- new MockUp<SegmentTaskIndex>() {
- @Mock void buildIndex(List<DataFileFooter> footerList) {
- }
- };
- TableSegmentUniqueIdentifier tableSegmentUniqueIdentifier =
- new TableSegmentUniqueIdentifier(absoluteTableIdentifier, "SG100");
-
- HashMap<String, List<TableBlockInfo>> segmentToTableBlocksInfos =
- new HashMap<String, List<TableBlockInfo>>() {{
- put("SG100", Arrays.asList(tableBlockInfo));
- }};
- tableSegmentUniqueIdentifier.setSegmentToTableBlocksInfos(segmentToTableBlocksInfos);
- Map<SegmentTaskIndexStore.TaskBucketHolder, AbstractIndex> result =
- taskIndexStore.get(tableSegmentUniqueIdentifier).getTaskIdToTableSegmentMap();
-
- assertEquals(result.size(), 1);
- assertTrue(result.containsKey(new SegmentTaskIndexStore.TaskBucketHolder("100", "0")));
- }
-
- @Test public void checkExistenceOfSegmentBTree() {
- TableSegmentUniqueIdentifier tableSegmentUniqueIdentifier =
- new TableSegmentUniqueIdentifier(absoluteTableIdentifier, "SG100");
- SegmentTaskIndexWrapper segmentTaskIndexWrapper =
- taskIndexStore.getIfPresent(tableSegmentUniqueIdentifier);
- Map<SegmentTaskIndexStore.TaskBucketHolder, AbstractIndex> result = segmentTaskIndexWrapper != null ?
- segmentTaskIndexWrapper.getTaskIdToTableSegmentMap() :
- null;
- assertNull(result);
- }
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-carbondata/blob/ce09aaaf/core/src/test/java/org/apache/carbondata/core/carbon/datastore/block/BlockIndexTest.java
----------------------------------------------------------------------
diff --git a/core/src/test/java/org/apache/carbondata/core/carbon/datastore/block/BlockIndexTest.java b/core/src/test/java/org/apache/carbondata/core/carbon/datastore/block/BlockIndexTest.java
deleted file mode 100644
index 2be49ab..0000000
--- a/core/src/test/java/org/apache/carbondata/core/carbon/datastore/block/BlockIndexTest.java
+++ /dev/null
@@ -1,79 +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.carbon.datastore.block;
-
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.List;
-
-import org.apache.carbondata.core.carbon.datastore.BTreeBuilderInfo;
-import org.apache.carbondata.core.carbon.datastore.impl.btree.BlockletBTreeBuilder;
-import org.apache.carbondata.core.carbon.metadata.blocklet.BlockletInfo;
-import org.apache.carbondata.core.carbon.metadata.blocklet.DataFileFooter;
-import org.apache.carbondata.core.carbon.metadata.blocklet.SegmentInfo;
-import org.apache.carbondata.core.carbon.metadata.blocklet.index.BlockletIndex;
-import org.apache.carbondata.core.carbon.metadata.schema.table.column.ColumnSchema;
-
-import mockit.Mock;
-import mockit.MockUp;
-import org.junit.BeforeClass;
-import org.junit.Test;
-
-import static junit.framework.TestCase.assertEquals;
-
-public class BlockIndexTest {
-
- private static SegmentInfo segmentInfo;
- private static DataFileFooter footer;
- private static ColumnSchema columnSchema;
- private static BlockletInfo blockletInfo;
- private static BlockletIndex blockletIndex;
- private static List<DataFileFooter> footerList = new ArrayList<DataFileFooter>();
- private static List<ColumnSchema> columnSchemaList = new ArrayList<ColumnSchema>();
-
- @BeforeClass public static void setUp() {
- segmentInfo = new SegmentInfo();
- footer = new DataFileFooter();
- columnSchema = new ColumnSchema();
- blockletInfo = new BlockletInfo();
- blockletIndex = new BlockletIndex();
- }
-
- @Test public void testBuild() {
- segmentInfo = new SegmentInfo();
- new MockUp<BlockletBTreeBuilder>() {
- @Mock public void build(BTreeBuilderInfo segmentBuilderInfos) {
- }
- };
- int expectedValue = 0;
- BlockIndex blockIndex = new BlockIndex();
- columnSchema.setColumnName("employeeName");
- columnSchemaList.add(new ColumnSchema());
-
- footer.setSegmentInfo(segmentInfo);
- footer.setColumnInTable(columnSchemaList);
- footer.setBlockletList(Arrays.asList(blockletInfo));
- footerList.add(footer);
-
- blockIndex.buildIndex(footerList);
- assertEquals(footerList.get(0).getNumberOfRows(), expectedValue);
-
- }
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-carbondata/blob/ce09aaaf/core/src/test/java/org/apache/carbondata/core/carbon/datastore/block/BlockInfoTest.java
----------------------------------------------------------------------
diff --git a/core/src/test/java/org/apache/carbondata/core/carbon/datastore/block/BlockInfoTest.java b/core/src/test/java/org/apache/carbondata/core/carbon/datastore/block/BlockInfoTest.java
deleted file mode 100644
index 5e389ea..0000000
--- a/core/src/test/java/org/apache/carbondata/core/carbon/datastore/block/BlockInfoTest.java
+++ /dev/null
@@ -1,90 +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.carbon.datastore.block;
-
-import org.apache.carbondata.core.carbon.ColumnarFormatVersion;
-import org.junit.BeforeClass;
-import org.junit.Test;
-
-import static junit.framework.TestCase.assertEquals;
-
-public class BlockInfoTest {
-
- static BlockInfo blockInfo;
-
- @BeforeClass public static void setup() {
- blockInfo = new BlockInfo(new TableBlockInfo("/filePath.carbondata", 6, "segmentId", null, 6, ColumnarFormatVersion.V1));
- }
-
- @Test public void hashCodeTest() {
- int res = blockInfo.hashCode();
- int expectedResult = 1694768249;
- assertEquals(expectedResult, res);
- }
-
- @Test public void equalsTestwithSameObject() {
- Boolean res = blockInfo.equals(blockInfo);
- assert (res);
- }
-
- @Test public void equalsTestWithSimilarObject() {
- BlockInfo blockInfoTest =
- new BlockInfo(new TableBlockInfo("/filePath.carbondata", 6, "segmentId", null, 6, ColumnarFormatVersion.V1));
- Boolean res = blockInfo.equals(blockInfoTest);
- assert (res);
- }
-
- @Test public void equalsTestWithNullObject() {
- Boolean res = blockInfo.equals(null);
- assert (!res);
- }
-
- @Test public void equalsTestWithStringObject() {
- Boolean res = blockInfo.equals("dummy");
- assert (!res);
- }
-
- @Test public void equalsTestWithDifferentSegmentId() {
- BlockInfo blockInfoTest =
- new BlockInfo(new TableBlockInfo("/filePath.carbondata", 6, "diffSegmentId", null, 6, ColumnarFormatVersion.V1));
- Boolean res = blockInfo.equals(blockInfoTest);
- assert (!res);
- }
-
- @Test public void equalsTestWithDifferentOffset() {
- BlockInfo blockInfoTest =
- new BlockInfo(new TableBlockInfo("/filePath.carbondata", 62, "segmentId", null, 6, ColumnarFormatVersion.V1));
- Boolean res = blockInfo.equals(blockInfoTest);
- assert (!res);
- }
-
- @Test public void equalsTestWithDifferentBlockLength() {
- BlockInfo blockInfoTest =
- new BlockInfo(new TableBlockInfo("/filePath.carbondata", 6, "segmentId", null, 62, ColumnarFormatVersion.V1));
- Boolean res = blockInfo.equals(blockInfoTest);
- assert (!res);
- }
-
- @Test public void equalsTestWithDiffFilePath() {
- BlockInfo blockInfoTest =
- new BlockInfo(new TableBlockInfo("/diffFilePath.carbondata", 6, "segmentId", null, 62, ColumnarFormatVersion.V1));
- Boolean res = blockInfoTest.equals(blockInfo);
- assert (!res);
- }
-}