Search in sources :

Example 1 with StoragePluginRegistry

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

the class MongoTestBase method initMongoStoragePlugin.

public static void initMongoStoragePlugin() throws Exception {
    final StoragePluginRegistry pluginRegistry = getDrillbitContext().getStorage();
    storagePlugin = (MongoStoragePlugin) pluginRegistry.getPlugin(MongoStoragePluginConfig.NAME);
    storagePluginConfig = storagePlugin.getConfig();
    storagePluginConfig.setEnabled(true);
    pluginRegistry.createOrUpdate(MongoStoragePluginConfig.NAME, storagePluginConfig, true);
    if (System.getProperty("drill.mongo.tests.bson.reader", "true").equalsIgnoreCase("false")) {
        testNoResult(String.format("alter session set `%s` = false", ExecConstants.MONGO_BSON_RECORD_READER));
    } else {
        testNoResult(String.format("alter session set `%s` = true", ExecConstants.MONGO_BSON_RECORD_READER));
    }
}
Also used : StoragePluginRegistry(org.apache.drill.exec.store.StoragePluginRegistry)

Example 2 with StoragePluginRegistry

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

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

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 4 with StoragePluginRegistry

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

the class KafkaTestBase method initKafkaStoragePlugin.

public static void initKafkaStoragePlugin(EmbeddedKafkaCluster embeddedKafkaCluster) throws Exception {
    final StoragePluginRegistry pluginRegistry = getDrillbitContext().getStorage();
    Map<String, String> kafkaConsumerProps = Maps.newHashMap();
    kafkaConsumerProps.put(ConsumerConfig.BOOTSTRAP_SERVERS_CONFIG, embeddedKafkaCluster.getKafkaBrokerList());
    kafkaConsumerProps.put(ConsumerConfig.GROUP_ID_CONFIG, "drill-test-consumer");
    storagePluginConfig = new KafkaStoragePluginConfig(kafkaConsumerProps);
    storagePluginConfig.setEnabled(true);
    pluginRegistry.createOrUpdate(KafkaStoragePluginConfig.NAME, storagePluginConfig, true);
    testNoResult(String.format("alter session set `%s` = '%s'", ExecConstants.KAFKA_RECORD_READER, "org.apache.drill.exec.store.kafka.decoders.JsonMessageReader"));
    testNoResult(String.format("alter session set `%s` = %d", ExecConstants.KAFKA_POLL_TIMEOUT, 200));
}
Also used : StoragePluginRegistry(org.apache.drill.exec.store.StoragePluginRegistry)

Example 5 with StoragePluginRegistry

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

the class MongoTestBase method initMongoStoragePlugin.

public static void initMongoStoragePlugin() throws Exception {
    final StoragePluginRegistry pluginRegistry = getDrillbitContext().getStorage();
    storagePlugin = (MongoStoragePlugin) pluginRegistry.getPlugin(MongoStoragePluginConfig.NAME);
    storagePluginConfig = storagePlugin.getConfig();
    storagePluginConfig.setEnabled(true);
    pluginRegistry.createOrUpdate(MongoStoragePluginConfig.NAME, storagePluginConfig, true);
    if (System.getProperty("drill.mongo.tests.bson.reader", "true").equalsIgnoreCase("false")) {
        testNoResult(String.format("alter session set `%s` = false", ExecConstants.MONGO_BSON_RECORD_READER));
    } else {
        testNoResult(String.format("alter session set `%s` = true", ExecConstants.MONGO_BSON_RECORD_READER));
    }
}
Also used : StoragePluginRegistry(org.apache.drill.exec.store.StoragePluginRegistry)

Aggregations

StoragePluginRegistry (org.apache.drill.exec.store.StoragePluginRegistry)42 FileSystemConfig (org.apache.drill.exec.store.dfs.FileSystemConfig)10 Drillbit (org.apache.drill.exec.server.Drillbit)8 StoragePluginRegistryImpl (org.apache.drill.exec.store.StoragePluginRegistryImpl)8 BeforeClass (org.junit.BeforeClass)8 Test (org.junit.Test)8 FunctionImplementationRegistry (org.apache.drill.exec.expr.fn.FunctionImplementationRegistry)6 PhysicalPlan (org.apache.drill.exec.physical.PhysicalPlan)6 File (java.io.File)5 Properties (java.util.Properties)5 DrillConfig (org.apache.drill.common.config.DrillConfig)5 WorkspaceConfig (org.apache.drill.exec.store.dfs.WorkspaceConfig)5 HashMap (java.util.HashMap)4 DrillProperties (org.apache.drill.common.config.DrillProperties)4 PhysicalPlanReader (org.apache.drill.exec.planner.PhysicalPlanReader)4 DrillbitContext (org.apache.drill.exec.server.DrillbitContext)4 CoreMatchers.containsString (org.hamcrest.CoreMatchers.containsString)4 DrillBuf (io.netty.buffer.DrillBuf)3 MockBreakageStorage (org.apache.drill.exec.store.mock.MockBreakageStorage)3 MetricRegistry (com.codahale.metrics.MetricRegistry)2