use of org.apache.carbondata.core.metadata.schema.table.column.CarbonDimension in project carbondata by apache.
the class RowLevelRangeLessThanEqualFilterExecuterImpl method ifDefaultValueMatchesFilter.
/**
* This method will check whether default value is present in the given filter values
*/
private void ifDefaultValueMatchesFilter() {
if (!this.isDimensionPresentInCurrentBlock[0]) {
CarbonDimension dimension = this.dimColEvaluatorInfoList.get(0).getDimension();
byte[] defaultValue = dimension.getDefaultValue();
if (null != defaultValue) {
for (int k = 0; k < filterRangeValues.length; k++) {
int maxCompare = ByteUtil.UnsafeComparer.INSTANCE.compareTo(filterRangeValues[k], defaultValue);
if (maxCompare >= 0) {
isDefaultValuePresentInFilter = true;
break;
}
}
}
}
}
use of org.apache.carbondata.core.metadata.schema.table.column.CarbonDimension in project carbondata by apache.
the class RowLevelRangeLessThanEqualFilterExecuterImpl method getFilteredIndexes.
private BitSet getFilteredIndexes(DimensionColumnDataChunk dimensionColumnDataChunk, int numerOfRows) {
byte[] defaultValue = null;
if (dimColEvaluatorInfoList.get(0).getDimension().hasEncoding(Encoding.DIRECT_DICTIONARY)) {
DirectDictionaryGenerator directDictionaryGenerator = DirectDictionaryKeyGeneratorFactory.getDirectDictionaryGenerator(dimColEvaluatorInfoList.get(0).getDimension().getDataType());
int key = directDictionaryGenerator.generateDirectSurrogateKey(null) + 1;
CarbonDimension currentBlockDimension = segmentProperties.getDimensions().get(dimensionBlocksIndex[0]);
defaultValue = FilterUtil.getMaskKey(key, currentBlockDimension, this.segmentProperties.getSortColumnsGenerator());
}
if (dimensionColumnDataChunk.isExplicitSorted()) {
return setFilterdIndexToBitSetWithColumnIndex(dimensionColumnDataChunk, numerOfRows, defaultValue);
}
return setFilterdIndexToBitSet(dimensionColumnDataChunk, numerOfRows, defaultValue);
}
use of org.apache.carbondata.core.metadata.schema.table.column.CarbonDimension in project carbondata by apache.
the class RowLevelRangeLessThanFiterExecuterImpl method ifDefaultValueMatchesFilter.
/**
* This method will check whether default value is present in the given filter values
*/
private void ifDefaultValueMatchesFilter() {
if (!this.isDimensionPresentInCurrentBlock[0]) {
CarbonDimension dimension = this.dimColEvaluatorInfoList.get(0).getDimension();
byte[] defaultValue = dimension.getDefaultValue();
if (null != defaultValue) {
for (int k = 0; k < filterRangeValues.length; k++) {
int maxCompare = ByteUtil.UnsafeComparer.INSTANCE.compareTo(filterRangeValues[k], defaultValue);
if (maxCompare > 0) {
isDefaultValuePresentInFilter = true;
break;
}
}
}
}
}
use of org.apache.carbondata.core.metadata.schema.table.column.CarbonDimension in project carbondata by apache.
the class RowLevelRangeLessThanFiterExecuterImpl method getFilteredIndexes.
private BitSet getFilteredIndexes(DimensionColumnDataChunk dimensionColumnDataChunk, int numerOfRows) {
byte[] defaultValue = null;
if (dimColEvaluatorInfoList.get(0).getDimension().hasEncoding(Encoding.DIRECT_DICTIONARY)) {
DirectDictionaryGenerator directDictionaryGenerator = DirectDictionaryKeyGeneratorFactory.getDirectDictionaryGenerator(dimColEvaluatorInfoList.get(0).getDimension().getDataType());
int key = directDictionaryGenerator.generateDirectSurrogateKey(null) + 1;
CarbonDimension currentBlockDimension = segmentProperties.getDimensions().get(dimensionBlocksIndex[0]);
defaultValue = FilterUtil.getMaskKey(key, currentBlockDimension, this.segmentProperties.getSortColumnsGenerator());
}
if (dimensionColumnDataChunk.isExplicitSorted()) {
return setFilterdIndexToBitSetWithColumnIndex(dimensionColumnDataChunk, numerOfRows, defaultValue);
}
return setFilterdIndexToBitSet(dimensionColumnDataChunk, numerOfRows, defaultValue);
}
use of org.apache.carbondata.core.metadata.schema.table.column.CarbonDimension in project carbondata by apache.
the class ManageDictionaryAndBTree method clearBTreeAndDictionaryLRUCache.
/**
* This mwthod will invalidate both BTree and dictionary instances from LRU cache
*
* @param carbonTable
*/
public static void clearBTreeAndDictionaryLRUCache(CarbonTable carbonTable) {
// clear Btree cache from LRU cache
LoadMetadataDetails[] loadMetadataDetails = SegmentStatusManager.readLoadMetadata(carbonTable.getMetaDataFilepath());
if (null != loadMetadataDetails) {
String[] segments = new String[loadMetadataDetails.length];
int i = 0;
for (LoadMetadataDetails loadMetadataDetail : loadMetadataDetails) {
segments[i++] = loadMetadataDetail.getLoadName();
}
invalidateBTreeCache(carbonTable.getAbsoluteTableIdentifier(), segments);
}
// clear dictionary cache from LRU cache
List<CarbonDimension> dimensions = carbonTable.getDimensionByTableName(carbonTable.getFactTableName());
for (CarbonDimension dimension : dimensions) {
removeDictionaryColumnFromCache(carbonTable.getCarbonTableIdentifier(), carbonTable.getStorePath(), dimension.getColumnId());
}
}
Aggregations