Search in sources :

Example 6 with IndexInputSplit

use of org.apache.carbondata.core.index.IndexInputSplit in project carbondata by apache.

the class BlockletIndexFactory method getAllUncached.

@Override
public List<IndexInputSplit> getAllUncached(List<Segment> validSegments, IndexExprWrapper indexExprWrapper) throws IOException {
    List<IndexInputSplit> distributableToBeLoaded = new ArrayList<>();
    for (Segment segment : validSegments) {
        IndexInputSplitWrapper indexInputSplitWrappers = indexExprWrapper.toDistributableSegment(segment);
        Set<TableBlockIndexUniqueIdentifier> tableBlockIndexUniqueIdentifiers = getTableSegmentUniqueIdentifiers(segment);
        for (TableBlockIndexUniqueIdentifier identifier : tableBlockIndexUniqueIdentifiers) {
            BlockletIndexWrapper blockletIndexWrapper = cache.getIfPresent(new TableBlockIndexUniqueIdentifierWrapper(identifier, this.getCarbonTable()));
            if (identifier.getIndexFilePath() == null || blockletIndexWrapper == null) {
                ((BlockletIndexInputSplit) indexInputSplitWrappers.getDistributable()).setTableBlockIndexUniqueIdentifier(identifier);
                distributableToBeLoaded.add(indexInputSplitWrappers.getDistributable());
            }
        }
    }
    return distributableToBeLoaded;
}
Also used : TableBlockIndexUniqueIdentifierWrapper(org.apache.carbondata.core.indexstore.TableBlockIndexUniqueIdentifierWrapper) IndexInputSplitWrapper(org.apache.carbondata.core.index.dev.expr.IndexInputSplitWrapper) IndexInputSplit(org.apache.carbondata.core.index.IndexInputSplit) ArrayList(java.util.ArrayList) TableBlockIndexUniqueIdentifier(org.apache.carbondata.core.indexstore.TableBlockIndexUniqueIdentifier) Segment(org.apache.carbondata.core.index.Segment) BlockletIndexWrapper(org.apache.carbondata.core.indexstore.BlockletIndexWrapper)

Example 7 with IndexInputSplit

use of org.apache.carbondata.core.index.IndexInputSplit in project carbondata by apache.

the class LuceneIndexFactoryBase method toDistributable.

/**
 * Get all distributable objects of a segmentId
 */
@Override
public List<IndexInputSplit> toDistributable(Segment segment) {
    List<IndexInputSplit> splits = new ArrayList<>();
    CarbonFile[] indexDirs = getAllIndexDirs(tableIdentifier.getTablePath(), segment.getSegmentNo());
    if (segment.getFilteredIndexShardNames().size() == 0) {
        for (CarbonFile indexDir : indexDirs) {
            IndexInputSplit luceneIndexInputSplit = new LuceneIndexInputSplit(tableIdentifier.getTablePath(), indexDir.getAbsolutePath());
            luceneIndexInputSplit.setSegment(segment);
            luceneIndexInputSplit.setIndexSchema(getIndexSchema());
            splits.add(luceneIndexInputSplit);
        }
        return splits;
    }
    for (CarbonFile indexDir : indexDirs) {
        // Filter out the tasks which are filtered through CG index.
        if (getIndexLevel() != IndexLevel.FG && !segment.getFilteredIndexShardNames().contains(indexDir.getName())) {
            continue;
        }
        IndexInputSplit luceneIndexInputSplit = new LuceneIndexInputSplit(CarbonTablePath.getSegmentPath(tableIdentifier.getTablePath(), segment.getSegmentNo()), indexDir.getAbsolutePath());
        luceneIndexInputSplit.setSegment(segment);
        luceneIndexInputSplit.setIndexSchema(getIndexSchema());
        splits.add(luceneIndexInputSplit);
    }
    return splits;
}
Also used : CarbonFile(org.apache.carbondata.core.datastore.filesystem.CarbonFile) IndexInputSplit(org.apache.carbondata.core.index.IndexInputSplit) ArrayList(java.util.ArrayList)

Aggregations

ArrayList (java.util.ArrayList)7 IndexInputSplit (org.apache.carbondata.core.index.IndexInputSplit)7 Segment (org.apache.carbondata.core.index.Segment)3 TableBlockIndexUniqueIdentifier (org.apache.carbondata.core.indexstore.TableBlockIndexUniqueIdentifier)3 CarbonFile (org.apache.carbondata.core.datastore.filesystem.CarbonFile)2 TableBlockIndexUniqueIdentifierWrapper (org.apache.carbondata.core.indexstore.TableBlockIndexUniqueIdentifierWrapper)2 File (java.io.File)1 HashSet (java.util.HashSet)1 MockUp (mockit.MockUp)1 CacheableIndex (org.apache.carbondata.core.index.dev.CacheableIndex)1 IndexFactory (org.apache.carbondata.core.index.dev.IndexFactory)1 IndexInputSplitWrapper (org.apache.carbondata.core.index.dev.expr.IndexInputSplitWrapper)1 BlockletIndexWrapper (org.apache.carbondata.core.indexstore.BlockletIndexWrapper)1 BlockletIndexInputSplit (org.apache.carbondata.core.indexstore.blockletindex.BlockletIndexInputSplit)1 TableStatusReadCommittedScope (org.apache.carbondata.core.readcommitter.TableStatusReadCommittedScope)1 Configuration (org.apache.hadoop.conf.Configuration)1 InputSplit (org.apache.hadoop.mapreduce.InputSplit)1 Test (org.junit.Test)1