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;
}
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;
}
Aggregations