Search in sources :

Example 6 with StoragePluginRegistry

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

the class BaseHBaseTest method setupDefaultTestCluster.

@BeforeClass
public static void setupDefaultTestCluster() throws Exception {
    /*
     * Change the following to HBaseTestsSuite.configure(false, true)
     * if you want to test against an externally running HBase cluster.
     */
    HBaseTestsSuite.configure(true, /*manageHBaseCluster*/
    true);
    HBaseTestsSuite.initCluster();
    BaseTestQuery.setupDefaultTestCluster();
    final StoragePluginRegistry pluginRegistry = getDrillbitContext().getStorage();
    storagePlugin = (HBaseStoragePlugin) pluginRegistry.getPlugin(HBASE_STORAGE_PLUGIN_NAME);
    storagePluginConfig = storagePlugin.getConfig();
    storagePluginConfig.setEnabled(true);
    storagePluginConfig.setZookeeperPort(HBaseTestsSuite.getZookeeperPort());
    pluginRegistry.createOrUpdate(HBASE_STORAGE_PLUGIN_NAME, storagePluginConfig, true);
}
Also used : StoragePluginRegistry(org.apache.drill.exec.store.StoragePluginRegistry) BeforeClass(org.junit.BeforeClass)

Example 7 with StoragePluginRegistry

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

the class BaseTestQuery method openClient.

private static void openClient(Properties properties) throws Exception {
    allocator = RootAllocatorFactory.newRoot(config);
    serviceSet = RemoteServiceSet.getLocalServiceSet();
    dfsTestTmpSchemaLocation = TestUtilities.createTempDir();
    bits = new Drillbit[drillbitCount];
    for (int i = 0; i < drillbitCount; i++) {
        bits[i] = new Drillbit(config, serviceSet, classpathScan);
        bits[i].run();
        final StoragePluginRegistry pluginRegistry = bits[i].getContext().getStorage();
        TestUtilities.updateDfsTestTmpSchemaLocation(pluginRegistry, dfsTestTmpSchemaLocation);
        TestUtilities.makeDfsTmpSchemaImmutable(pluginRegistry);
    }
    client = QueryTestUtil.createClient(config, serviceSet, MAX_WIDTH_PER_NODE, properties);
}
Also used : StoragePluginRegistry(org.apache.drill.exec.store.StoragePluginRegistry) Drillbit(org.apache.drill.exec.server.Drillbit)

Example 8 with StoragePluginRegistry

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

the class PlanningBase method testSqlPlan.

protected void testSqlPlan(String sqlCommands) throws Exception {
    final String[] sqlStrings = sqlCommands.split(";");
    final LocalPersistentStoreProvider provider = new LocalPersistentStoreProvider(config);
    provider.start();
    final ScanResult scanResult = ClassPathScanner.fromPrescan(config);
    final LogicalPlanPersistence logicalPlanPersistence = new LogicalPlanPersistence(config, scanResult);
    final SystemOptionManager systemOptions = new SystemOptionManager(logicalPlanPersistence, provider);
    systemOptions.init();
    @SuppressWarnings("resource") final UserSession userSession = UserSession.Builder.newBuilder().withOptionManager(systemOptions).build();
    final SessionOptionManager sessionOptions = (SessionOptionManager) userSession.getOptions();
    final QueryOptionManager queryOptions = new QueryOptionManager(sessionOptions);
    final ExecutionControls executionControls = new ExecutionControls(queryOptions, DrillbitEndpoint.getDefaultInstance());
    new NonStrictExpectations() {

        {
            dbContext.getMetrics();
            result = new MetricRegistry();
            dbContext.getAllocator();
            result = allocator;
            dbContext.getConfig();
            result = config;
            dbContext.getOptionManager();
            result = systemOptions;
            dbContext.getStoreProvider();
            result = provider;
            dbContext.getClasspathScan();
            result = scanResult;
            dbContext.getLpPersistence();
            result = logicalPlanPersistence;
        }
    };
    final StoragePluginRegistry registry = new StoragePluginRegistryImpl(dbContext);
    registry.init();
    final FunctionImplementationRegistry functionRegistry = new FunctionImplementationRegistry(config);
    final DrillOperatorTable table = new DrillOperatorTable(functionRegistry, systemOptions);
    final SchemaPlus root = SimpleCalciteSchema.createRootSchema(false);
    registry.getSchemaFactory().registerSchemas(SchemaConfig.newBuilder("foo", context).build(), root);
    new NonStrictExpectations() {

        {
            context.getNewDefaultSchema();
            result = root;
            context.getLpPersistence();
            result = new LogicalPlanPersistence(config, ClassPathScanner.fromPrescan(config));
            context.getStorage();
            result = registry;
            context.getFunctionRegistry();
            result = functionRegistry;
            context.getSession();
            result = UserSession.Builder.newBuilder().setSupportComplexTypes(true).build();
            context.getCurrentEndpoint();
            result = DrillbitEndpoint.getDefaultInstance();
            context.getActiveEndpoints();
            result = ImmutableList.of(DrillbitEndpoint.getDefaultInstance());
            context.getPlannerSettings();
            result = new PlannerSettings(queryOptions, functionRegistry);
            context.getOptions();
            result = queryOptions;
            context.getConfig();
            result = config;
            context.getDrillOperatorTable();
            result = table;
            context.getAllocator();
            result = allocator;
            context.getExecutionControls();
            result = executionControls;
            dbContext.getLpPersistence();
            result = logicalPlanPersistence;
        }
    };
    for (final String sql : sqlStrings) {
        if (sql.trim().isEmpty()) {
            continue;
        }
        @SuppressWarnings("unused") final PhysicalPlan p = DrillSqlWorker.getPlan(context, sql);
    }
}
Also used : SessionOptionManager(org.apache.drill.exec.server.options.SessionOptionManager) StoragePluginRegistry(org.apache.drill.exec.store.StoragePluginRegistry) ScanResult(org.apache.drill.common.scanner.persistence.ScanResult) PhysicalPlan(org.apache.drill.exec.physical.PhysicalPlan) PlannerSettings(org.apache.drill.exec.planner.physical.PlannerSettings) LocalPersistentStoreProvider(org.apache.drill.exec.store.sys.store.provider.LocalPersistentStoreProvider) SystemOptionManager(org.apache.drill.exec.server.options.SystemOptionManager) QueryOptionManager(org.apache.drill.exec.server.options.QueryOptionManager) MetricRegistry(com.codahale.metrics.MetricRegistry) SchemaPlus(org.apache.calcite.schema.SchemaPlus) LogicalPlanPersistence(org.apache.drill.common.config.LogicalPlanPersistence) ExecutionControls(org.apache.drill.exec.testing.ExecutionControls) UserSession(org.apache.drill.exec.rpc.user.UserSession) StoragePluginRegistryImpl(org.apache.drill.exec.store.StoragePluginRegistryImpl) NonStrictExpectations(mockit.NonStrictExpectations) FunctionImplementationRegistry(org.apache.drill.exec.expr.fn.FunctionImplementationRegistry) DrillOperatorTable(org.apache.drill.exec.planner.sql.DrillOperatorTable)

Example 9 with StoragePluginRegistry

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

the class TestCTTAS method init.

@BeforeClass
public static void init() throws Exception {
    MockUp<UUID> uuidMockUp = mockRandomUUID(session_id);
    Properties testConfigurations = cloneDefaultTestConfigProperties();
    testConfigurations.put(ExecConstants.DEFAULT_TEMPORARY_WORKSPACE, TEMP_SCHEMA);
    updateTestCluster(1, DrillConfig.create(testConfigurations));
    uuidMockUp.tearDown();
    StoragePluginRegistry pluginRegistry = getDrillbitContext().getStorage();
    FileSystemConfig pluginConfig = (FileSystemConfig) pluginRegistry.getPlugin(test_schema).getConfig();
    pluginConfig.workspaces.put(temp2_wk, new WorkspaceConfig(TestUtilities.createTempDir(), true, null));
    pluginRegistry.createOrUpdate(test_schema, pluginConfig, true);
    fs = FileSystem.get(new Configuration());
    expectedFolderPermission = new FsPermission(StorageStrategy.TEMPORARY.getFolderPermission());
    expectedFilePermission = new FsPermission(StorageStrategy.TEMPORARY.getFilePermission());
}
Also used : StoragePluginRegistry(org.apache.drill.exec.store.StoragePluginRegistry) Configuration(org.apache.hadoop.conf.Configuration) WorkspaceConfig(org.apache.drill.exec.store.dfs.WorkspaceConfig) FileSystemConfig(org.apache.drill.exec.store.dfs.FileSystemConfig) FsPermission(org.apache.hadoop.fs.permission.FsPermission) UUID(java.util.UUID) Properties(java.util.Properties) BeforeClass(org.junit.BeforeClass)

Example 10 with StoragePluginRegistry

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

the class TestOptiqPlans method doPhysicalTest.

private SimpleRootExec doPhysicalTest(final DrillbitContext bitContext, UserClientConnection connection, String file) throws Exception {
    mockDrillbitContext(bitContext);
    final StoragePluginRegistry reg = new StoragePluginRegistryImpl(bitContext);
    final PhysicalPlanReader reader = PhysicalPlanReaderTestFactory.defaultPhysicalPlanReader(config, reg);
    final PhysicalPlan plan = reader.readPhysicalPlan(Files.toString(FileUtils.getResourceAsFile(file), Charsets.UTF_8));
    final FunctionImplementationRegistry registry = new FunctionImplementationRegistry(config);
    final FragmentContext context = new FragmentContext(bitContext, PlanFragment.getDefaultInstance(), connection, registry);
    final SimpleRootExec exec = new SimpleRootExec(ImplCreator.getExec(context, (FragmentRoot) plan.getSortedOperators(false).iterator().next()));
    return exec;
}
Also used : StoragePluginRegistry(org.apache.drill.exec.store.StoragePluginRegistry) PhysicalPlan(org.apache.drill.exec.physical.PhysicalPlan) FragmentContext(org.apache.drill.exec.ops.FragmentContext) PhysicalPlanReader(org.apache.drill.exec.planner.PhysicalPlanReader) StoragePluginRegistryImpl(org.apache.drill.exec.store.StoragePluginRegistryImpl) FragmentRoot(org.apache.drill.exec.physical.base.FragmentRoot) FunctionImplementationRegistry(org.apache.drill.exec.expr.fn.FunctionImplementationRegistry)

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