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);
}
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);
}
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);
}
}
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());
}
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;
}
Aggregations