Search in sources :

Example 11 with StoragePluginRegistry

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

Example 12 with StoragePluginRegistry

use of org.apache.drill.exec.store.StoragePluginRegistry in project drill by apache.

the class TemporaryTablesAutomaticDropTest method testAutomaticDropOfSeveralSessionTemporaryLocations.

@Test
public void testAutomaticDropOfSeveralSessionTemporaryLocations() throws Exception {
    File firstSessionTemporaryLocation = createAndCheckSessionTemporaryLocation("first_location", getDfsTestTmpSchemaLocation());
    StoragePluginRegistry pluginRegistry = getDrillbitContext().getStorage();
    String tempDir = TestUtilities.createTempDir();
    try {
        TestUtilities.updateDfsTestTmpSchemaLocation(pluginRegistry, tempDir);
        File secondSessionTemporaryLocation = createAndCheckSessionTemporaryLocation("second_location", tempDir);
        updateClient("new_client");
        assertFalse("First session temporary location should be absent", firstSessionTemporaryLocation.exists());
        assertFalse("Second session temporary location should be absent", secondSessionTemporaryLocation.exists());
    } finally {
        TestUtilities.updateDfsTestTmpSchemaLocation(pluginRegistry, getDfsTestTmpSchemaLocation());
    }
}
Also used : StoragePluginRegistry(org.apache.drill.exec.store.StoragePluginRegistry) File(java.io.File) Test(org.junit.Test)

Aggregations

StoragePluginRegistry (org.apache.drill.exec.store.StoragePluginRegistry)12 StoragePluginRegistryImpl (org.apache.drill.exec.store.StoragePluginRegistryImpl)4 FunctionImplementationRegistry (org.apache.drill.exec.expr.fn.FunctionImplementationRegistry)3 PhysicalPlan (org.apache.drill.exec.physical.PhysicalPlan)3 FileSystemConfig (org.apache.drill.exec.store.dfs.FileSystemConfig)3 Test (org.junit.Test)3 FragmentContext (org.apache.drill.exec.ops.FragmentContext)2 PhysicalPlanReader (org.apache.drill.exec.planner.PhysicalPlanReader)2 Drillbit (org.apache.drill.exec.server.Drillbit)2 WorkspaceConfig (org.apache.drill.exec.store.dfs.WorkspaceConfig)2 BeforeClass (org.junit.BeforeClass)2 MetricRegistry (com.codahale.metrics.MetricRegistry)1 DrillBuf (io.netty.buffer.DrillBuf)1 File (java.io.File)1 Properties (java.util.Properties)1 UUID (java.util.UUID)1 NonStrictExpectations (mockit.NonStrictExpectations)1 SchemaPlus (org.apache.calcite.schema.SchemaPlus)1 DrillConfig (org.apache.drill.common.config.DrillConfig)1 LogicalPlanPersistence (org.apache.drill.common.config.LogicalPlanPersistence)1