Search in sources :

Example 6 with IndexRow

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;
}
Also used : IndexRow(org.apache.carbondata.core.indexstore.row.IndexRow) IndexRowImpl(org.apache.carbondata.core.indexstore.row.IndexRowImpl) CarbonRowSchema(org.apache.carbondata.core.indexstore.schema.CarbonRowSchema)

Example 7 with IndexRow

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;
}
Also used : ImplicitColumnFilterExecutor(org.apache.carbondata.core.scan.filter.executer.ImplicitColumnFilterExecutor) FilterExecutor(org.apache.carbondata.core.scan.filter.executer.FilterExecutor) IndexRow(org.apache.carbondata.core.indexstore.row.IndexRow)

Example 8 with IndexRow

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);
}
Also used : IndexRow(org.apache.carbondata.core.indexstore.row.IndexRow) ByteBuffer(java.nio.ByteBuffer)

Example 9 with IndexRow

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);
}
Also used : IndexRow(org.apache.carbondata.core.indexstore.row.IndexRow) IndexRowImpl(org.apache.carbondata.core.indexstore.row.IndexRowImpl) CarbonRowSchema(org.apache.carbondata.core.indexstore.schema.CarbonRowSchema)

Example 10 with IndexRow

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);
}
Also used : IndexRow(org.apache.carbondata.core.indexstore.row.IndexRow)

Aggregations

IndexRow (org.apache.carbondata.core.indexstore.row.IndexRow)15 CarbonRowSchema (org.apache.carbondata.core.indexstore.schema.CarbonRowSchema)6 IndexRowImpl (org.apache.carbondata.core.indexstore.row.IndexRowImpl)5 IOException (java.io.IOException)3 UnsupportedEncodingException (java.io.UnsupportedEncodingException)2 ByteArrayOutputStream (java.io.ByteArrayOutputStream)1 DataOutput (java.io.DataOutput)1 DataOutputStream (java.io.DataOutputStream)1 ByteBuffer (java.nio.ByteBuffer)1 ArrayList (java.util.ArrayList)1 HashMap (java.util.HashMap)1 Blocklet (org.apache.carbondata.core.indexstore.Blocklet)1 ExtendedBlocklet (org.apache.carbondata.core.indexstore.ExtendedBlocklet)1 UnsafeIndexRow (org.apache.carbondata.core.indexstore.row.UnsafeIndexRow)1 BlockletInfo (org.apache.carbondata.core.metadata.blocklet.BlockletInfo)1 BlockletMinMaxIndex (org.apache.carbondata.core.metadata.blocklet.index.BlockletMinMaxIndex)1 FilterExecutor (org.apache.carbondata.core.scan.filter.executer.FilterExecutor)1 ImplicitColumnFilterExecutor (org.apache.carbondata.core.scan.filter.executer.ImplicitColumnFilterExecutor)1