use of org.apache.carbondata.core.indexstore.row.IndexRow in project carbondata by apache.
the class BlockIndex method addMinMax.
protected IndexRow addMinMax(CarbonRowSchema carbonRowSchema, byte[][] minValues) {
CarbonRowSchema[] minSchemas = ((CarbonRowSchema.StructCarbonRowSchema) carbonRowSchema).getChildSchemas();
IndexRow minRow = new IndexRowImpl(minSchemas);
int minOrdinal = 0;
// min value adding
for (int i = 0; i < minValues.length; i++) {
minRow.setByteArray(minValues[i], minOrdinal++);
}
return minRow;
}
use of org.apache.carbondata.core.indexstore.row.IndexRow in project carbondata by apache.
the class BlockIndex method isScanRequired.
@Override
public boolean isScanRequired(FilterResolverIntf filterExp) {
FilterExecutor filterExecutor = FilterUtil.getFilterExecutorTree(filterExp, getSegmentProperties(), null, getMinMaxCacheColumns(), false);
IndexRow unsafeRow = taskSummaryDMStore.getIndexRow(getTaskSummarySchema(), taskSummaryDMStore.getRowCount() - 1);
boolean isScanRequired = FilterExpressionProcessor.isScanRequired(filterExecutor, getMinMaxValue(unsafeRow, TASK_MAX_VALUES_INDEX), getMinMaxValue(unsafeRow, TASK_MIN_VALUES_INDEX), getMinMaxFlag(unsafeRow, TASK_MIN_MAX_FLAG));
return isScanRequired;
}
use of org.apache.carbondata.core.indexstore.row.IndexRow in project carbondata by apache.
the class BlockIndex method createBlockletFromRelativeBlockletId.
/**
* Method to get the relative blocklet ID. Absolute blocklet ID is the blocklet Id as per
* task level but relative blocklet ID is id as per carbondata file/block level
*
* @param absoluteBlockletId
* @return
*/
private ExtendedBlocklet createBlockletFromRelativeBlockletId(int absoluteBlockletId) {
short relativeBlockletId = -1;
int rowIndex = 0;
// return 0 if absoluteBlockletId is 0
if (absoluteBlockletId == 0) {
relativeBlockletId = (short) absoluteBlockletId;
} else {
int diff = absoluteBlockletId;
ByteBuffer byteBuffer = ByteBuffer.wrap(getBlockletRowCountForEachBlock());
// step6: relativeBlockletId = -4+7, relativeBlockletId = 3 (4th index starting from 0)
while (byteBuffer.hasRemaining()) {
short blockletCount = byteBuffer.getShort();
diff = diff - blockletCount;
if (diff < 0) {
relativeBlockletId = (short) (diff + blockletCount);
break;
} else if (diff == 0) {
relativeBlockletId++;
break;
}
rowIndex++;
}
}
IndexRow row = memoryDMStore.getIndexRow(getFileFooterEntrySchema(), rowIndex);
String filePath = getFilePath();
return createBlocklet(row, getFileNameWithFilePath(row, filePath), relativeBlockletId, false);
}
use of org.apache.carbondata.core.indexstore.row.IndexRow in project carbondata by apache.
the class BlockIndex method addTaskMinMaxValues.
/**
* This method will compute min/max values at task level
*
* @param taskMinMaxRow
* @param carbonRowSchema
* @param taskMinMaxOrdinal
* @param minMaxValue
* @param ordinal
* @param isMinValueComparison
*/
protected void addTaskMinMaxValues(IndexRow taskMinMaxRow, CarbonRowSchema[] carbonRowSchema, int taskMinMaxOrdinal, byte[][] minMaxValue, int ordinal, boolean isMinValueComparison, List<ColumnSchema> columnSchemaList) {
IndexRow row = taskMinMaxRow.getRow(ordinal);
byte[][] updatedMinMaxValues = null;
if (null == row) {
CarbonRowSchema[] minSchemas = ((CarbonRowSchema.StructCarbonRowSchema) carbonRowSchema[taskMinMaxOrdinal]).getChildSchemas();
row = new IndexRowImpl(minSchemas);
updatedMinMaxValues = minMaxValue;
} else {
byte[][] existingMinMaxValues = getMinMaxValue(taskMinMaxRow, ordinal);
updatedMinMaxValues = compareAndUpdateMinMax(minMaxValue, existingMinMaxValues, isMinValueComparison, columnSchemaList);
}
int minMaxOrdinal = 0;
// min/max value adding
for (int i = 0; i < updatedMinMaxValues.length; i++) {
row.setByteArray(updatedMinMaxValues[i], minMaxOrdinal++);
}
taskMinMaxRow.setRow(row, ordinal);
}
use of org.apache.carbondata.core.indexstore.row.IndexRow in project carbondata by apache.
the class BlockletIndex method getDetailedBlocklet.
@Override
public ExtendedBlocklet getDetailedBlocklet(String blockletId) {
int absoluteBlockletId = Integer.parseInt(blockletId);
IndexRow row = memoryDMStore.getIndexRow(getFileFooterEntrySchema(), absoluteBlockletId);
short relativeBlockletId = row.getShort(BLOCKLET_ID_INDEX);
String filePath = getFilePath();
return createBlocklet(row, getFileNameWithFilePath(row, filePath), relativeBlockletId, false);
}
Aggregations