Search in sources :

Example 1 with IndexRow

use of org.apache.carbondata.core.indexstore.row.IndexRow in project carbondata by apache.

the class BlockIndex method getFileDetails.

private String[] getFileDetails() {
    try {
        String[] fileDetails = new String[3];
        IndexRow unsafeRow = taskSummaryDMStore.getIndexRow(getTaskSummarySchema(), 0);
        fileDetails[0] = new String(unsafeRow.getByteArray(SUMMARY_INDEX_PATH), CarbonCommonConstants.DEFAULT_CHARSET);
        fileDetails[1] = new String(unsafeRow.getByteArray(SUMMARY_INDEX_FILE_NAME), CarbonCommonConstants.DEFAULT_CHARSET);
        fileDetails[2] = new String(unsafeRow.getByteArray(SUMMARY_SEGMENT_ID), CarbonCommonConstants.DEFAULT_CHARSET);
        return fileDetails;
    } catch (Exception e) {
        throw new RuntimeException(e);
    }
}
Also used : IndexRow(org.apache.carbondata.core.indexstore.row.IndexRow) UnsupportedEncodingException(java.io.UnsupportedEncodingException) IOException(java.io.IOException)

Example 2 with IndexRow

use of org.apache.carbondata.core.indexstore.row.IndexRow in project carbondata by apache.

the class BlockIndex method addMinMaxFlagValues.

protected void addMinMaxFlagValues(IndexRow row, CarbonRowSchema carbonRowSchema, boolean[] minMaxFlag, int ordinal) {
    CarbonRowSchema[] minMaxFlagSchema = ((CarbonRowSchema.StructCarbonRowSchema) carbonRowSchema).getChildSchemas();
    IndexRow minMaxFlagRow = new IndexRowImpl(minMaxFlagSchema);
    int flagOrdinal = 0;
    // min value adding
    for (int i = 0; i < minMaxFlag.length; i++) {
        minMaxFlagRow.setBoolean(minMaxFlag[i], flagOrdinal++);
    }
    row.setRow(minMaxFlagRow, 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 3 with IndexRow

use of org.apache.carbondata.core.indexstore.row.IndexRow in project carbondata by apache.

the class BlockIndex method getRowCountForEachBlock.

public Map<String, Long> getRowCountForEachBlock(Segment segment, List<PartitionSpec> partitions, Map<String, Long> blockletToRowCountMap) {
    if (memoryDMStore.getRowCount() == 0) {
        return new HashMap<>();
    }
    CarbonRowSchema[] schema = getFileFooterEntrySchema();
    int numEntries = memoryDMStore.getRowCount();
    for (int i = 0; i < numEntries; i++) {
        IndexRow indexRow = memoryDMStore.getIndexRow(schema, i);
        String fileName = new String(indexRow.getByteArray(FILE_PATH_INDEX), CarbonCommonConstants.DEFAULT_CHARSET_CLASS) + CarbonTablePath.getCarbonDataExtension();
        int rowCount = indexRow.getInt(ROW_COUNT_INDEX);
        // prepend segment number with the blocklet file path
        String blockletMapKey = segment.getSegmentNo() + "," + fileName;
        Long existingCount = blockletToRowCountMap.get(blockletMapKey);
        if (null != existingCount) {
            blockletToRowCountMap.put(blockletMapKey, (long) rowCount + existingCount);
        } else {
            blockletToRowCountMap.put(blockletMapKey, (long) rowCount);
        }
    }
    return blockletToRowCountMap;
}
Also used : HashMap(java.util.HashMap) IndexRow(org.apache.carbondata.core.indexstore.row.IndexRow) CarbonRowSchema(org.apache.carbondata.core.indexstore.schema.CarbonRowSchema)

Example 4 with IndexRow

use of org.apache.carbondata.core.indexstore.row.IndexRow in project carbondata by apache.

the class BlockIndex method getMinMaxFlag.

private boolean[] getMinMaxFlag(IndexRow row, int index) {
    IndexRow minMaxFlagRow = row.getRow(index);
    boolean[] minMaxFlag = new boolean[minMaxFlagRow.getColumnCount()];
    for (int i = 0; i < minMaxFlag.length; i++) {
        minMaxFlag[i] = minMaxFlagRow.getBoolean(i);
    }
    return minMaxFlag;
}
Also used : IndexRow(org.apache.carbondata.core.indexstore.row.IndexRow)

Example 5 with IndexRow

use of org.apache.carbondata.core.indexstore.row.IndexRow in project carbondata by apache.

the class SafeMemoryDMStore method convertToUnsafeDMStore.

@Override
public UnsafeMemoryDMStore convertToUnsafeDMStore(CarbonRowSchema[] schema) {
    setSchemaDataType(schema);
    UnsafeMemoryDMStore unsafeMemoryDMStore = new UnsafeMemoryDMStore();
    for (IndexRow indexRow : indexRows) {
        indexRow.setSchemas(schema);
        unsafeMemoryDMStore.addIndexRow(schema, indexRow);
    }
    unsafeMemoryDMStore.finishWriting();
    return unsafeMemoryDMStore;
}
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