Search in sources :

Example 1 with MapRDBFormatMatcher

use of org.apache.drill.exec.store.mapr.db.MapRDBFormatMatcher in project drill by apache.

the class MapRDBIndexDiscover method getNativeDrillTable.

@Override
public DrillTable getNativeDrillTable(IndexDescriptor idxDescriptor) {
    try {
        final AbstractDbGroupScan origScan = getOriginalScan();
        if (!(origScan instanceof MapRDBGroupScan)) {
            return null;
        }
        MapRDBFormatPlugin maprFormatPlugin = ((MapRDBGroupScan) origScan).getFormatPlugin();
        FileSystemPlugin fsPlugin = (FileSystemPlugin) (origScan.getStoragePlugin());
        DrillFileSystem fs = ImpersonationUtil.createFileSystem(origScan.getUserName(), fsPlugin.getFsConf());
        MapRDBFormatMatcher matcher = (MapRDBFormatMatcher) (maprFormatPlugin.getMatcher());
        FileSelection fsSelection = deriveFSSelection(fs, idxDescriptor);
        return matcher.isReadableIndex(fs, fsSelection, fsPlugin, fsPlugin.getName(), origScan.getUserName(), idxDescriptor);
    } catch (Exception e) {
        logger.error("Failed to get native DrillTable.", e);
    }
    return null;
}
Also used : MapRDBFormatPlugin(org.apache.drill.exec.store.mapr.db.MapRDBFormatPlugin) FileSelection(org.apache.drill.exec.store.dfs.FileSelection) FileSystemPlugin(org.apache.drill.exec.store.dfs.FileSystemPlugin) DrillFileSystem(org.apache.drill.exec.store.dfs.DrillFileSystem) MapRDBGroupScan(org.apache.drill.exec.store.mapr.db.MapRDBGroupScan) AbstractDbGroupScan(org.apache.drill.exec.physical.base.AbstractDbGroupScan) MapRDBFormatMatcher(org.apache.drill.exec.store.mapr.db.MapRDBFormatMatcher) DrillRuntimeException(org.apache.drill.common.exceptions.DrillRuntimeException) IOException(java.io.IOException) DBException(com.mapr.db.exceptions.DBException)

Aggregations

DBException (com.mapr.db.exceptions.DBException)1 IOException (java.io.IOException)1 DrillRuntimeException (org.apache.drill.common.exceptions.DrillRuntimeException)1 AbstractDbGroupScan (org.apache.drill.exec.physical.base.AbstractDbGroupScan)1 DrillFileSystem (org.apache.drill.exec.store.dfs.DrillFileSystem)1 FileSelection (org.apache.drill.exec.store.dfs.FileSelection)1 FileSystemPlugin (org.apache.drill.exec.store.dfs.FileSystemPlugin)1 MapRDBFormatMatcher (org.apache.drill.exec.store.mapr.db.MapRDBFormatMatcher)1 MapRDBFormatPlugin (org.apache.drill.exec.store.mapr.db.MapRDBFormatPlugin)1 MapRDBGroupScan (org.apache.drill.exec.store.mapr.db.MapRDBGroupScan)1