Search in sources :

Example 76 with Drillbit

use of org.apache.drill.exec.server.Drillbit in project drill by apache.

the class ClusterMockStorageFixture method insertMockStorage.

/**
 * This should be called after bits are started
 * @param name the mock storage name we are going to create
 */
public void insertMockStorage(String name, boolean breakRegisterSchema) {
    for (Drillbit bit : drillbits()) {
        // Bit name and registration.
        final StoragePluginRegistry pluginRegistry = bit.getContext().getStorage();
        MockBreakageStorage plugin;
        try {
            MockBreakageStorageEngineConfig config = MockBreakageStorageEngineConfig.INSTANCE;
            config.setEnabled(true);
            pluginRegistry.put(name, config);
            plugin = (MockBreakageStorage) pluginRegistry.getPlugin(name);
        } catch (PluginException e) {
            throw new IllegalStateException(e);
        }
        plugin.setBreakRegister(breakRegisterSchema);
    }
}
Also used : StoragePluginRegistry(org.apache.drill.exec.store.StoragePluginRegistry) MockBreakageStorage(org.apache.drill.exec.store.mock.MockBreakageStorage) Drillbit(org.apache.drill.exec.server.Drillbit) PluginException(org.apache.drill.exec.store.StoragePluginRegistry.PluginException) MockBreakageStorageEngineConfig(org.apache.drill.exec.store.mock.MockBreakageStorage.MockBreakageStorageEngineConfig)

Example 77 with Drillbit

use of org.apache.drill.exec.server.Drillbit in project drill by apache.

the class TestSpoolingBuffer method testMultipleExchangesSingleThread.

@Test
public void testMultipleExchangesSingleThread() throws Exception {
    RemoteServiceSet serviceSet = RemoteServiceSet.getLocalServiceSet();
    DrillConfig conf = DrillConfig.create("drill-spool-test-module.conf");
    try (Drillbit bit1 = new Drillbit(conf, serviceSet);
        DrillClient client = new DrillClient(conf, serviceSet.getCoordinator())) {
        bit1.run();
        client.connect();
        List<QueryDataBatch> results = client.runQuery(org.apache.drill.exec.proto.UserBitShared.QueryType.PHYSICAL, Files.asCharSource(DrillFileUtils.getResourceAsFile("/work/batch/multiple_exchange.json"), Charsets.UTF_8).read());
        int count = 0;
        for (QueryDataBatch b : results) {
            if (b.getHeader().getRowCount() != 0) {
                count += b.getHeader().getRowCount();
            }
            b.release();
        }
        assertEquals(500024, count);
    }
}
Also used : QueryDataBatch(org.apache.drill.exec.rpc.user.QueryDataBatch) DrillConfig(org.apache.drill.common.config.DrillConfig) Drillbit(org.apache.drill.exec.server.Drillbit) RemoteServiceSet(org.apache.drill.exec.server.RemoteServiceSet) DrillClient(org.apache.drill.exec.client.DrillClient) Test(org.junit.Test)

Example 78 with Drillbit

use of org.apache.drill.exec.server.Drillbit in project drill by apache.

the class BaseTestQuery method closeClient.

@AfterClass
public static void closeClient() throws Exception {
    if (client != null) {
        client.close();
        client = null;
    }
    if (bits != null) {
        for (Drillbit bit : bits) {
            if (bit != null) {
                bit.close();
            }
        }
        bits = null;
    }
    if (serviceSet != null) {
        serviceSet.close();
        serviceSet = null;
    }
    if (allocator != null) {
        allocator.close();
        allocator = null;
    }
}
Also used : Drillbit(org.apache.drill.exec.server.Drillbit) AfterClass(org.junit.AfterClass)

Example 79 with Drillbit

use of org.apache.drill.exec.server.Drillbit in project drill by apache.

the class BaseTestQuery method openClient.

private static void openClient(Properties properties) throws Exception {
    if (properties == null) {
        properties = new Properties();
    }
    allocator = RootAllocatorFactory.newRoot(config);
    serviceSet = RemoteServiceSet.getLocalServiceSet();
    dirTestWatcher.newDfsTestTmpDir();
    bits = new Drillbit[drillbitCount];
    for (int i = 0; i < drillbitCount; i++) {
        bits[i] = new Drillbit(config, serviceSet, classpathScan);
        bits[i].run();
        StoragePluginRegistry pluginRegistry = bits[i].getContext().getStorage();
        StoragePluginTestUtils.configureFormatPlugins(pluginRegistry);
        StoragePluginTestUtils.updateSchemaLocation(StoragePluginTestUtils.DFS_PLUGIN_NAME, pluginRegistry, dirTestWatcher.getDfsTestTmpDir(), TMP_SCHEMA);
        StoragePluginTestUtils.updateSchemaLocation(StoragePluginTestUtils.DFS_PLUGIN_NAME, pluginRegistry, dirTestWatcher.getRootDir(), ROOT_SCHEMA);
        StoragePluginTestUtils.updateSchemaLocation(StoragePluginTestUtils.DFS_PLUGIN_NAME, pluginRegistry, dirTestWatcher.getRootDir(), SchemaFactory.DEFAULT_WS_NAME);
    }
    if (!properties.containsKey(DrillProperties.DRILLBIT_CONNECTION)) {
        properties.setProperty(DrillProperties.DRILLBIT_CONNECTION, String.format("localhost:%s", bits[0].getUserPort()));
    }
    DrillConfig clientConfig = DrillConfig.forClient();
    client = QueryTestUtil.createClient(clientConfig, serviceSet, MAX_WIDTH_PER_NODE, properties);
}
Also used : StoragePluginRegistry(org.apache.drill.exec.store.StoragePluginRegistry) DrillConfig(org.apache.drill.common.config.DrillConfig) Drillbit(org.apache.drill.exec.server.Drillbit) DrillProperties(org.apache.drill.common.config.DrillProperties) Properties(java.util.Properties)

Example 80 with Drillbit

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

Aggregations

Drillbit (org.apache.drill.exec.server.Drillbit)158 RemoteServiceSet (org.apache.drill.exec.server.RemoteServiceSet)132 Test (org.junit.Test)129 DrillClient (org.apache.drill.exec.client.DrillClient)119 QueryDataBatch (org.apache.drill.exec.rpc.user.QueryDataBatch)119 RecordBatchLoader (org.apache.drill.exec.record.RecordBatchLoader)79 SlowTest (org.apache.drill.categories.SlowTest)74 ValueVector (org.apache.drill.exec.vector.ValueVector)66 OperatorTest (org.apache.drill.categories.OperatorTest)47 VectorWrapper (org.apache.drill.exec.record.VectorWrapper)28 DrillbitEndpoint (org.apache.drill.exec.proto.CoordinationProtos.DrillbitEndpoint)24 DrillConfig (org.apache.drill.common.config.DrillConfig)20 ExecTest (org.apache.drill.exec.ExecTest)13 VectorTest (org.apache.drill.categories.VectorTest)12 DrillbitContext (org.apache.drill.exec.server.DrillbitContext)11 QueryData (org.apache.drill.exec.proto.UserBitShared.QueryData)10 StoragePluginRegistry (org.apache.drill.exec.store.StoragePluginRegistry)8 VarBinaryVector (org.apache.drill.exec.vector.VarBinaryVector)7 IOException (java.io.IOException)6 ZookeeperHelper (org.apache.drill.exec.ZookeeperHelper)6