Search in sources :

Example 76 with BitSet

use of java.util.BitSet in project carbondata by apache.

the class ExcludeFilterExecuterImpl method setFilterdIndexToBitSetWithColumnIndex.

private BitSet setFilterdIndexToBitSetWithColumnIndex(FixedLengthDimensionDataChunk dimColumnDataChunk, int numerOfRows) {
    int startKey = 0;
    int last = 0;
    int startIndex = 0;
    BitSet bitSet = new BitSet(numerOfRows);
    bitSet.flip(0, numerOfRows);
    byte[][] filterValues = dimColumnExecuterInfo.getFilterKeys();
    for (int i = 0; i < filterValues.length; i++) {
        startKey = CarbonUtil.getFirstIndexUsingBinarySearch(dimColumnDataChunk, startIndex, numerOfRows - 1, filterValues[i], false);
        if (startKey < 0) {
            continue;
        }
        bitSet.flip(dimColumnDataChunk.getInvertedIndex(startKey));
        last = startKey;
        for (int j = startKey + 1; j < numerOfRows; j++) {
            if (dimColumnDataChunk.compareTo(j, filterValues[i]) == 0) {
                bitSet.flip(dimColumnDataChunk.getInvertedIndex(j));
                last++;
            } else {
                break;
            }
        }
        startIndex = last;
        if (startIndex >= numerOfRows) {
            break;
        }
    }
    return bitSet;
}
Also used : BitSet(java.util.BitSet)

Example 77 with BitSet

use of java.util.BitSet in project carbondata by apache.

the class ExcludeFilterExecuterImpl method isScanRequired.

@Override
public BitSet isScanRequired(byte[][] blockMaxValue, byte[][] blockMinValue) {
    BitSet bitSet = new BitSet(1);
    bitSet.flip(0, 1);
    return bitSet;
}
Also used : BitSet(java.util.BitSet)

Example 78 with BitSet

use of java.util.BitSet in project carbondata by apache.

the class IncludeFilterExecuterImpl method setFilterdIndexToBitSetWithColumnIndex.

private BitSet setFilterdIndexToBitSetWithColumnIndex(FixedLengthDimensionDataChunk dimensionColumnDataChunk, int numerOfRows) {
    BitSet bitSet = new BitSet(numerOfRows);
    int startIndex = 0;
    byte[][] filterValues = dimColumnExecuterInfo.getFilterKeys();
    for (int i = 0; i < filterValues.length; i++) {
        int[] rangeIndex = CarbonUtil.getRangeIndexUsingBinarySearch(dimensionColumnDataChunk, startIndex, numerOfRows - 1, filterValues[i]);
        for (int j = rangeIndex[0]; j <= rangeIndex[1]; j++) {
            bitSet.set(dimensionColumnDataChunk.getInvertedIndex(j));
        }
        if (rangeIndex[1] >= 0) {
            startIndex = rangeIndex[1];
        }
    }
    return bitSet;
}
Also used : BitSet(java.util.BitSet)

Example 79 with BitSet

use of java.util.BitSet in project asterixdb by apache.

the class ExtractCommonOperatorsRule method requiresMaterialization.

private boolean requiresMaterialization(List<Integer> groupClusterIds, int index) {
    Integer clusterId = groupClusterIds.get(index);
    BitSet blockingClusters = new BitSet();
    getAllBlockingClusterIds(clusterId, blockingClusters);
    if (!blockingClusters.isEmpty()) {
        for (int i = 0; i < groupClusterIds.size(); i++) {
            if (i == index) {
                continue;
            }
            if (blockingClusters.get(groupClusterIds.get(i))) {
                return true;
            }
        }
    }
    return false;
}
Also used : BitSet(java.util.BitSet)

Example 80 with BitSet

use of java.util.BitSet in project carbondata by apache.

the class FilterScanner method isScanRequired.

@Override
public boolean isScanRequired(BlocksChunkHolder blocksChunkHolder) throws IOException {
    // adding statistics for number of pages
    QueryStatistic totalPagesScanned = queryStatisticsModel.getStatisticsTypeAndObjMap().get(QueryStatisticsConstants.TOTAL_PAGE_SCANNED);
    totalPagesScanned.addCountStatistic(QueryStatisticsConstants.TOTAL_PAGE_SCANNED, totalPagesScanned.getCount() + blocksChunkHolder.getDataBlock().numberOfPages());
    // apply min max
    if (isMinMaxEnabled) {
        BitSet bitSet = this.filterExecuter.isScanRequired(blocksChunkHolder.getDataBlock().getColumnsMaxValue(), blocksChunkHolder.getDataBlock().getColumnsMinValue());
        if (bitSet.isEmpty()) {
            CarbonUtil.freeMemory(blocksChunkHolder.getDimensionRawDataChunk(), blocksChunkHolder.getMeasureRawDataChunk());
            return false;
        }
    }
    return true;
}
Also used : BitSet(java.util.BitSet) QueryStatistic(org.apache.carbondata.core.stats.QueryStatistic)

Aggregations

BitSet (java.util.BitSet)2037 Test (org.junit.Test)294 ArrayList (java.util.ArrayList)224 List (java.util.List)83 HashMap (java.util.HashMap)76 Map (java.util.Map)70 IOException (java.io.IOException)60 HashSet (java.util.HashSet)52 Test (org.junit.jupiter.api.Test)47 RegisterSpecList (com.android.dx.rop.code.RegisterSpecList)45 Random (java.util.Random)42 Configuration (org.apache.hadoop.conf.Configuration)40 Path (org.apache.hadoop.fs.Path)39 ValidReadTxnList (org.apache.hadoop.hive.common.ValidReadTxnList)33 BlockNode (jadx.core.dex.nodes.BlockNode)29 File (java.io.File)27 LinkedList (java.util.LinkedList)27 RexNode (org.apache.calcite.rex.RexNode)27 ByteBuffer (java.nio.ByteBuffer)25 ValidReaderWriteIdList (org.apache.hadoop.hive.common.ValidReaderWriteIdList)25