Search in sources :

Example 1 with FileSystemConfig

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);
}
Also used : FileSystemPlugin(org.apache.drill.exec.store.dfs.FileSystemPlugin) WorkspaceConfig(org.apache.drill.exec.store.dfs.WorkspaceConfig) FileSystemConfig(org.apache.drill.exec.store.dfs.FileSystemConfig)

Example 2 with FileSystemConfig

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);
}
Also used : StoragePluginRegistry(org.apache.drill.exec.store.StoragePluginRegistry) FileSystemPlugin(org.apache.drill.exec.store.dfs.FileSystemPlugin) WorkspaceConfig(org.apache.drill.exec.store.dfs.WorkspaceConfig) FileSystemConfig(org.apache.drill.exec.store.dfs.FileSystemConfig)

Example 3 with FileSystemConfig

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);
}
Also used : FileSystemPlugin(org.apache.drill.exec.store.dfs.FileSystemPlugin) WorkspaceConfig(org.apache.drill.exec.store.dfs.WorkspaceConfig) FileSystemConfig(org.apache.drill.exec.store.dfs.FileSystemConfig)

Example 4 with FileSystemConfig

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;
}
Also used : FileSystemConfig(org.apache.drill.exec.store.dfs.FileSystemConfig)

Example 5 with FileSystemConfig

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);
}
Also used : StoragePluginRegistry(org.apache.drill.exec.store.StoragePluginRegistry) FileSystemConfig(org.apache.drill.exec.store.dfs.FileSystemConfig)

Aggregations

FileSystemConfig (org.apache.drill.exec.store.dfs.FileSystemConfig)7 WorkspaceConfig (org.apache.drill.exec.store.dfs.WorkspaceConfig)4 StoragePluginRegistry (org.apache.drill.exec.store.StoragePluginRegistry)3 FileSystemPlugin (org.apache.drill.exec.store.dfs.FileSystemPlugin)3 Map (java.util.Map)1 Properties (java.util.Properties)1 UUID (java.util.UUID)1 RecordBatchLoader (org.apache.drill.exec.record.RecordBatchLoader)1 VectorWrapper (org.apache.drill.exec.record.VectorWrapper)1 QueryDataBatch (org.apache.drill.exec.rpc.user.QueryDataBatch)1 Configuration (org.apache.hadoop.conf.Configuration)1 FsPermission (org.apache.hadoop.fs.permission.FsPermission)1 BeforeClass (org.junit.BeforeClass)1 Test (org.junit.Test)1