Search in sources :

Example 1 with BlockIndex

use of org.apache.carbondata.core.datastore.block.BlockIndex in project carbondata by apache.

the class BlockIndexStore method loadBlock.

private AbstractIndex loadBlock(TableBlockUniqueIdentifier tableBlockUniqueIdentifier) throws IOException {
    AbstractIndex tableBlock = new BlockIndex();
    BlockInfo blockInfo = new BlockInfo(tableBlockUniqueIdentifier.getTableBlockInfo());
    String lruCacheKey = getLruCacheKey(tableBlockUniqueIdentifier.getAbsoluteTableIdentifier(), blockInfo);
    checkAndLoadTableBlocks(tableBlock, tableBlockUniqueIdentifier, lruCacheKey);
    // finally remove the lock object from block info lock as once block is loaded
    // it will not come inside this if condition
    blockInfoLock.remove(blockInfo);
    return tableBlock;
}
Also used : BlockInfo(org.apache.carbondata.core.datastore.block.BlockInfo) TableBlockInfo(org.apache.carbondata.core.datastore.block.TableBlockInfo) AbstractIndex(org.apache.carbondata.core.datastore.block.AbstractIndex) BlockIndex(org.apache.carbondata.core.datastore.block.BlockIndex)

Example 2 with BlockIndex

use of org.apache.carbondata.core.datastore.block.BlockIndex in project carbondata by apache.

the class BlockIndexStore method getIfPresent.

/**
   * method returns the B-Tree meta
   *
   * @param tableBlockUniqueIdentifier Unique table block info
   * @return
   */
@Override
public AbstractIndex getIfPresent(TableBlockUniqueIdentifier tableBlockUniqueIdentifier) {
    BlockInfo blockInfo = new BlockInfo(tableBlockUniqueIdentifier.getTableBlockInfo());
    BlockIndex cacheable = (BlockIndex) lruCache.get(getLruCacheKey(tableBlockUniqueIdentifier.getAbsoluteTableIdentifier(), blockInfo));
    if (null != cacheable) {
        cacheable.incrementAccessCount();
    }
    return cacheable;
}
Also used : BlockInfo(org.apache.carbondata.core.datastore.block.BlockInfo) TableBlockInfo(org.apache.carbondata.core.datastore.block.TableBlockInfo) BlockIndex(org.apache.carbondata.core.datastore.block.BlockIndex)

Aggregations

BlockIndex (org.apache.carbondata.core.datastore.block.BlockIndex)2 BlockInfo (org.apache.carbondata.core.datastore.block.BlockInfo)2 TableBlockInfo (org.apache.carbondata.core.datastore.block.TableBlockInfo)2 AbstractIndex (org.apache.carbondata.core.datastore.block.AbstractIndex)1