Search in sources :

Example 1 with DataMapDistributable

use of org.apache.carbondata.core.datamap.DataMapDistributable in project carbondata by apache.

the class DataMapExprWrapperImpl method toDistributable.

@Override
public List<DataMapDistributableWrapper> toDistributable(List<Segment> segments) throws IOException {
    List<DataMapDistributable> dataMapDistributables = dataMap.toDistributable(segments);
    List<DataMapDistributableWrapper> wrappers = new ArrayList<>();
    for (DataMapDistributable distributable : dataMapDistributables) {
        wrappers.add(new DataMapDistributableWrapper(uniqueId, distributable));
    }
    return wrappers;
}
Also used : DataMapDistributable(org.apache.carbondata.core.datamap.DataMapDistributable) ArrayList(java.util.ArrayList)

Example 2 with DataMapDistributable

use of org.apache.carbondata.core.datamap.DataMapDistributable in project carbondata by apache.

the class BlockletDataMapFactory method toDistributable.

@Override
public List<DataMapDistributable> toDistributable(Segment segment) {
    List<DataMapDistributable> distributables = new ArrayList<>();
    try {
        CarbonFile[] carbonIndexFiles;
        if (segment.getSegmentFileName() == null) {
            carbonIndexFiles = SegmentIndexFileStore.getCarbonIndexFiles(CarbonTablePath.getSegmentPath(identifier.getTablePath(), segment.getSegmentNo()));
        } else {
            SegmentFileStore fileStore = new SegmentFileStore(identifier.getTablePath(), segment.getSegmentFileName());
            Map<String, String> indexFiles = fileStore.getIndexFiles();
            carbonIndexFiles = new CarbonFile[indexFiles.size()];
            int i = 0;
            for (String indexFile : indexFiles.keySet()) {
                carbonIndexFiles[i++] = FileFactory.getCarbonFile(indexFile);
            }
        }
        for (int i = 0; i < carbonIndexFiles.length; i++) {
            Path path = new Path(carbonIndexFiles[i].getPath());
            FileSystem fs = path.getFileSystem(FileFactory.getConfiguration());
            RemoteIterator<LocatedFileStatus> iter = fs.listLocatedStatus(path);
            LocatedFileStatus fileStatus = iter.next();
            String[] location = fileStatus.getBlockLocations()[0].getHosts();
            BlockletDataMapDistributable distributable = new BlockletDataMapDistributable(path.toString());
            distributable.setLocations(location);
            distributables.add(distributable);
        }
    } catch (IOException e) {
        throw new RuntimeException(e);
    }
    return distributables;
}
Also used : Path(org.apache.hadoop.fs.Path) CarbonTablePath(org.apache.carbondata.core.util.path.CarbonTablePath) CarbonFile(org.apache.carbondata.core.datastore.filesystem.CarbonFile) DataMapDistributable(org.apache.carbondata.core.datamap.DataMapDistributable) ArrayList(java.util.ArrayList) LocatedFileStatus(org.apache.hadoop.fs.LocatedFileStatus) SegmentFileStore(org.apache.carbondata.core.metadata.SegmentFileStore) IOException(java.io.IOException) FileSystem(org.apache.hadoop.fs.FileSystem)

Example 3 with DataMapDistributable

use of org.apache.carbondata.core.datamap.DataMapDistributable in project carbondata by apache.

the class LuceneDataMapFactoryBase method toDistributable.

/**
 * Get all distributable objects of a segmentid
 */
@Override
public List<DataMapDistributable> toDistributable(Segment segment) {
    List<DataMapDistributable> lstDataMapDistribute = new ArrayList<DataMapDistributable>();
    DataMapDistributable luceneDataMapDistributable = new LuceneDataMapDistributable(CarbonTablePath.getSegmentPath(tableIdentifier.getTablePath(), segment.getSegmentNo()));
    lstDataMapDistribute.add(luceneDataMapDistributable);
    return lstDataMapDistribute;
}
Also used : DataMapDistributable(org.apache.carbondata.core.datamap.DataMapDistributable) ArrayList(java.util.ArrayList)

Aggregations

ArrayList (java.util.ArrayList)3 DataMapDistributable (org.apache.carbondata.core.datamap.DataMapDistributable)3 IOException (java.io.IOException)1 CarbonFile (org.apache.carbondata.core.datastore.filesystem.CarbonFile)1 SegmentFileStore (org.apache.carbondata.core.metadata.SegmentFileStore)1 CarbonTablePath (org.apache.carbondata.core.util.path.CarbonTablePath)1 FileSystem (org.apache.hadoop.fs.FileSystem)1 LocatedFileStatus (org.apache.hadoop.fs.LocatedFileStatus)1 Path (org.apache.hadoop.fs.Path)1