Search in sources :

Example 6 with BlockletDetailInfo

use of org.apache.carbondata.core.indexstore.BlockletDetailInfo in project carbondata by apache.

the class BlockletDataMap method createBlocklet.

private ExtendedBlocklet createBlocklet(DataMapRow row, int blockletId) {
    ExtendedBlocklet blocklet = new ExtendedBlocklet(new String(row.getByteArray(FILE_PATH_INDEX), CarbonCommonConstants.DEFAULT_CHARSET_CLASS), blockletId + "");
    BlockletDetailInfo detailInfo = new BlockletDetailInfo();
    detailInfo.setRowCount(row.getInt(ROW_COUNT_INDEX));
    detailInfo.setPagesCount(row.getShort(PAGE_COUNT_INDEX));
    detailInfo.setVersionNumber(row.getShort(VERSION_INDEX));
    detailInfo.setBlockletId((short) blockletId);
    detailInfo.setDimLens(columnCardinality);
    detailInfo.setSchemaUpdatedTimeStamp(row.getLong(SCHEMA_UPADATED_TIME_INDEX));
    byte[] byteArray = row.getByteArray(BLOCK_INFO_INDEX);
    BlockletInfo blockletInfo = null;
    try {
        if (byteArray.length > 0) {
            blockletInfo = new BlockletInfo();
            ByteArrayInputStream stream = new ByteArrayInputStream(byteArray);
            DataInputStream inputStream = new DataInputStream(stream);
            blockletInfo.readFields(inputStream);
            inputStream.close();
        }
        blocklet.setLocation(new String(row.getByteArray(LOCATIONS), CarbonCommonConstants.DEFAULT_CHARSET).split(","));
    } catch (IOException e) {
        throw new RuntimeException(e);
    }
    detailInfo.setBlockletInfo(blockletInfo);
    blocklet.setDetailInfo(detailInfo);
    detailInfo.setBlockFooterOffset(row.getLong(BLOCK_FOOTER_OFFSET));
    detailInfo.setColumnSchemaBinary(getColumnSchemaBinary());
    detailInfo.setBlockSize(row.getLong(BLOCK_LENGTH));
    return blocklet;
}
Also used : BlockletDetailInfo(org.apache.carbondata.core.indexstore.BlockletDetailInfo) ByteArrayInputStream(java.io.ByteArrayInputStream) BlockletInfo(org.apache.carbondata.core.metadata.blocklet.BlockletInfo) IOException(java.io.IOException) DataInputStream(java.io.DataInputStream) ExtendedBlocklet(org.apache.carbondata.core.indexstore.ExtendedBlocklet)

Aggregations

BlockletDetailInfo (org.apache.carbondata.core.indexstore.BlockletDetailInfo)6 IOException (java.io.IOException)2 TableBlockInfo (org.apache.carbondata.core.datastore.block.TableBlockInfo)2 BlockletInfo (org.apache.carbondata.core.metadata.blocklet.BlockletInfo)2 DataFileFooter (org.apache.carbondata.core.metadata.blocklet.DataFileFooter)2 Gson (com.google.gson.Gson)1 ByteArrayInputStream (java.io.ByteArrayInputStream)1 DataInputStream (java.io.DataInputStream)1 ArrayList (java.util.ArrayList)1 LinkedHashMap (java.util.LinkedHashMap)1 List (java.util.List)1 CacheProvider (org.apache.carbondata.core.cache.CacheProvider)1 BlockIndexStore (org.apache.carbondata.core.datastore.BlockIndexStore)1 AbstractIndex (org.apache.carbondata.core.datastore.block.AbstractIndex)1 TableBlockUniqueIdentifier (org.apache.carbondata.core.datastore.block.TableBlockUniqueIdentifier)1 ExtendedBlocklet (org.apache.carbondata.core.indexstore.ExtendedBlocklet)1 IndexWrapper (org.apache.carbondata.core.indexstore.blockletindex.IndexWrapper)1 ColumnarFormatVersion (org.apache.carbondata.core.metadata.ColumnarFormatVersion)1 SegmentInfo (org.apache.carbondata.core.metadata.blocklet.SegmentInfo)1 DataType (org.apache.carbondata.core.metadata.datatype.DataType)1