Search in sources :

Example 1 with MapRDBGroupScan

use of org.apache.drill.exec.store.mapr.db.MapRDBGroupScan 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)

Example 2 with MapRDBGroupScan

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

the class MapRDBIndexDiscover method admin.

@SuppressWarnings("deprecation")
private Admin admin() {
    assert getOriginalScan() instanceof MapRDBGroupScan;
    final MapRDBGroupScan dbGroupScan = (MapRDBGroupScan) getOriginalScan();
    final UserGroupInformation currentUser = ImpersonationUtil.createProxyUgi(dbGroupScan.getUserName());
    final Configuration conf = dbGroupScan.getFormatPlugin().getFsConf();
    final Admin admin;
    try {
        admin = currentUser.doAs((PrivilegedExceptionAction<Admin>) () -> MapRDB.getAdmin(conf));
    } catch (Exception e) {
        throw new DrillRuntimeException("Failed to get Admin instance for user: " + currentUser.getUserName(), e);
    }
    return admin;
}
Also used : Configuration(org.apache.hadoop.conf.Configuration) MapRDBGroupScan(org.apache.drill.exec.store.mapr.db.MapRDBGroupScan) PrivilegedExceptionAction(java.security.PrivilegedExceptionAction) Admin(com.mapr.db.Admin) DrillRuntimeException(org.apache.drill.common.exceptions.DrillRuntimeException) DrillRuntimeException(org.apache.drill.common.exceptions.DrillRuntimeException) IOException(java.io.IOException) DBException(com.mapr.db.exceptions.DBException) UserGroupInformation(org.apache.hadoop.security.UserGroupInformation)

Aggregations

DBException (com.mapr.db.exceptions.DBException)2 IOException (java.io.IOException)2 DrillRuntimeException (org.apache.drill.common.exceptions.DrillRuntimeException)2 MapRDBGroupScan (org.apache.drill.exec.store.mapr.db.MapRDBGroupScan)2 Admin (com.mapr.db.Admin)1 PrivilegedExceptionAction (java.security.PrivilegedExceptionAction)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 Configuration (org.apache.hadoop.conf.Configuration)1 UserGroupInformation (org.apache.hadoop.security.UserGroupInformation)1