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;
}
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;
}
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;
}
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;
}
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;
}
Aggregations