use of org.apache.drill.exec.store.StoragePluginRegistry 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);
}
}
use of org.apache.drill.exec.store.StoragePluginRegistry in project drill by apache.
the class ClusterFixture method defineWorkspace.
private void defineWorkspace(Drillbit drillbit, String pluginName, String schemaName, String path, String defaultFormat, FormatPluginConfig format, boolean writable) throws PluginException {
final StoragePluginRegistry pluginRegistry = drillbit.getContext().getStorage();
final FileSystemConfig pluginConfig = (FileSystemConfig) pluginRegistry.getStoredConfig(pluginName);
final WorkspaceConfig newTmpWSConfig = new WorkspaceConfig(path, writable, defaultFormat, false);
Map<String, WorkspaceConfig> newWorkspaces = new HashMap<>();
Optional.ofNullable(pluginConfig.getWorkspaces()).ifPresent(newWorkspaces::putAll);
newWorkspaces.put(schemaName, newTmpWSConfig);
Map<String, FormatPluginConfig> newFormats = new HashMap<>();
Optional.ofNullable(pluginConfig.getFormats()).ifPresent(newFormats::putAll);
Optional.ofNullable(format).ifPresent(f -> newFormats.put(defaultFormat, f));
updatePlugin(pluginRegistry, pluginName, pluginConfig, newWorkspaces, newFormats);
}
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 {
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);
}
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 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