Search in sources :

Example 1 with BlockletDataMapModel

use of org.apache.carbondata.core.indexstore.blockletindex.BlockletDataMapModel in project carbondata by apache.

the class BlockletDataMapIndexStore method loadAndGetDataMap.

/**
 * Below method will be used to load the segment of segments
 * One segment may have multiple task , so  table segment will be loaded
 * based on task id and will return the map of taksId to table segment
 * map
 *
 * @return map of taks id to segment mapping
 * @throws IOException
 */
private BlockletDataMap loadAndGetDataMap(TableBlockIndexUniqueIdentifier identifier, SegmentIndexFileStore indexFileStore, Map<String, BlockMetaInfo> blockMetaInfoMap) throws IOException, MemoryException {
    String uniqueTableSegmentIdentifier = identifier.getUniqueTableSegmentIdentifier();
    Object lock = segmentLockMap.get(uniqueTableSegmentIdentifier);
    if (lock == null) {
        lock = addAndGetSegmentLock(uniqueTableSegmentIdentifier);
    }
    BlockletDataMap dataMap;
    synchronized (lock) {
        dataMap = new BlockletDataMap();
        dataMap.init(new BlockletDataMapModel(identifier.getIndexFilePath() + CarbonCommonConstants.FILE_SEPARATOR + identifier.getIndexFileName(), indexFileStore.getFileData(identifier.getIndexFileName()), blockMetaInfoMap, identifier.getSegmentId()));
        lruCache.put(identifier.getUniqueTableSegmentIdentifier(), dataMap, dataMap.getMemorySize());
    }
    return dataMap;
}
Also used : BlockletDataMap(org.apache.carbondata.core.indexstore.blockletindex.BlockletDataMap) BlockletDataMapModel(org.apache.carbondata.core.indexstore.blockletindex.BlockletDataMapModel)

Aggregations

BlockletDataMap (org.apache.carbondata.core.indexstore.blockletindex.BlockletDataMap)1 BlockletDataMapModel (org.apache.carbondata.core.indexstore.blockletindex.BlockletDataMapModel)1