use of org.apache.drill.exec.store.dfs.FileSystemConfig in project drill by apache.
the class TestUtilities method updateDfsTestTmpSchemaLocation.
/**
* Update the location of dfs_test.tmp location. Get the "dfs_test.tmp" workspace and update the location with an
* exclusive temp directory just for use in the current test jvm.
*
* @param pluginRegistry
* @return JVM exclusive temporary directory location.
*/
public static void updateDfsTestTmpSchemaLocation(final StoragePluginRegistry pluginRegistry, final String tmpDirPath) throws ExecutionSetupException {
@SuppressWarnings("resource") final FileSystemPlugin plugin = (FileSystemPlugin) pluginRegistry.getPlugin(dfsTestPluginName);
final FileSystemConfig pluginConfig = (FileSystemConfig) plugin.getConfig();
final WorkspaceConfig tmpWSConfig = pluginConfig.workspaces.get(dfsTestTmpSchema);
final WorkspaceConfig newTmpWSConfig = new WorkspaceConfig(tmpDirPath, true, tmpWSConfig.getDefaultInputFormat());
pluginConfig.workspaces.remove(dfsTestTmpSchema);
pluginConfig.workspaces.put(dfsTestTmpSchema, newTmpWSConfig);
pluginRegistry.createOrUpdate(dfsTestPluginName, pluginConfig, true);
}
use of org.apache.drill.exec.store.dfs.FileSystemConfig in project drill by apache.
the class ClusterFixture method defineWorkspace.
public static void defineWorkspace(Drillbit drillbit, String pluginName, String schemaName, String path, String defaultFormat, FormatPluginConfig format) throws ExecutionSetupException {
@SuppressWarnings("resource") final StoragePluginRegistry pluginRegistry = drillbit.getContext().getStorage();
@SuppressWarnings("resource") final FileSystemPlugin plugin = (FileSystemPlugin) pluginRegistry.getPlugin(pluginName);
final FileSystemConfig pluginConfig = (FileSystemConfig) plugin.getConfig();
final WorkspaceConfig newTmpWSConfig = new WorkspaceConfig(path, true, defaultFormat);
pluginConfig.workspaces.remove(schemaName);
pluginConfig.workspaces.put(schemaName, newTmpWSConfig);
if (format != null) {
pluginConfig.formats.put(defaultFormat, format);
}
pluginRegistry.createOrUpdate(pluginName, pluginConfig, true);
}
use of org.apache.drill.exec.store.dfs.FileSystemConfig in project drill by apache.
the class TestUtilities method makeDfsTmpSchemaImmutable.
/**
* Make the dfs.tmp schema immutable, so that tests writers don't use the dfs.tmp to create views.
* Schema "dfs.tmp" added as part of the default bootstrap plugins file that comes with drill-java-exec jar
*/
public static void makeDfsTmpSchemaImmutable(final StoragePluginRegistry pluginRegistry) throws ExecutionSetupException {
@SuppressWarnings("resource") final FileSystemPlugin dfsPlugin = (FileSystemPlugin) pluginRegistry.getPlugin(dfsPluginName);
final FileSystemConfig dfsPluginConfig = (FileSystemConfig) dfsPlugin.getConfig();
final WorkspaceConfig tmpWSConfig = dfsPluginConfig.workspaces.get(dfsTmpSchema);
final WorkspaceConfig newTmpWSConfig = new WorkspaceConfig(tmpWSConfig.getLocation(), false, tmpWSConfig.getDefaultInputFormat());
dfsPluginConfig.workspaces.remove(dfsTmpSchema);
dfsPluginConfig.workspaces.put(dfsTmpSchema, newTmpWSConfig);
pluginRegistry.createOrUpdate(dfsPluginName, dfsPluginConfig, true);
}
use of org.apache.drill.exec.store.dfs.FileSystemConfig in project drill by apache.
the class MaprDBTestsSuite method createPluginAndGetConf.
public static Configuration createPluginAndGetConf(DrillbitContext ctx) throws Exception {
if (!pluginCreated) {
synchronized (MaprDBTestsSuite.class) {
if (!pluginCreated) {
String pluginConfStr = "{" + " \"type\": \"file\"," + " \"enabled\": true," + " \"connection\": \"maprfs:///\"," + " \"workspaces\": {" + " \"default\": {" + " \"location\": \"/tmp\"," + " \"writable\": false," + " \"defaultInputFormat\": \"maprdb\"" + " }," + " \"root\": {" + " \"location\": \"/\"," + " \"writable\": false," + " \"defaultInputFormat\": \"maprdb\"" + " }" + " }," + " \"formats\": {" + " \"maprdb\": {" + " \"type\": \"maprdb\"," + " \"allTextMode\": false," + " \"readAllNumbersAsDouble\": false," + " \"enablePushdown\": true" + " }," + " \"streams\": {" + " \"type\": \"streams\"" + " }" + " }" + "}";
FileSystemConfig pluginConfig = ctx.getLpPersistence().getMapper().readValue(pluginConfStr, FileSystemConfig.class);
// create the plugin with "hbase" name so that we can run HBase unit tests against them
ctx.getStorage().createOrUpdate("hbase", pluginConfig, true);
}
}
}
return conf;
}
use of org.apache.drill.exec.store.dfs.FileSystemConfig in project drill by apache.
the class BaseTestImpersonation method addMiniDfsBasedStorage.
protected static void addMiniDfsBasedStorage(final Map<String, WorkspaceConfig> workspaces) throws Exception {
// Create a HDFS based storage plugin based on local storage plugin and add it to plugin registry (connection string
// for mini dfs is varies for each run).
final StoragePluginRegistry pluginRegistry = getDrillbitContext().getStorage();
final FileSystemConfig lfsPluginConfig = (FileSystemConfig) pluginRegistry.getPlugin("dfs_test").getConfig();
final FileSystemConfig miniDfsPluginConfig = new FileSystemConfig();
miniDfsPluginConfig.connection = dfsConf.get(FileSystem.FS_DEFAULT_NAME_KEY);
createAndAddWorkspace("tmp", "/tmp", (short) 0777, processUser, processUser, workspaces);
miniDfsPluginConfig.workspaces = workspaces;
miniDfsPluginConfig.formats = ImmutableMap.copyOf(lfsPluginConfig.formats);
miniDfsPluginConfig.setEnabled(true);
pluginRegistry.createOrUpdate(MINIDFS_STORAGE_PLUGIN_NAME, miniDfsPluginConfig, true);
}
Aggregations