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;
}
Aggregations