use of org.apache.drill.common.config.LogicalPlanPersistence in project drill by apache.
the class StoragePlugins method main.
public static void main(String[] args) throws Exception {
DrillConfig config = DrillConfig.create();
ScanResult scanResult = ClassPathScanner.fromPrescan(config);
LogicalPlanPersistence lpp = new LogicalPlanPersistence(config, scanResult);
String data = Resources.toString(Resources.getResource("storage-engines.json"), Charsets.UTF_8);
StoragePlugins se = lpp.getMapper().readValue(data, StoragePlugins.class);
ByteArrayOutputStream os = new ByteArrayOutputStream();
lpp.getMapper().writeValue(System.out, se);
lpp.getMapper().writeValue(os, se);
se = lpp.getMapper().readValue(new ByteArrayInputStream(os.toByteArray()), StoragePlugins.class);
System.out.println(se);
}
use of org.apache.drill.common.config.LogicalPlanPersistence in project drill by axbaretto.
the class TestHBaseTableProvider method testTableProvider.
@Test
public void testTableProvider() throws StoreException {
LogicalPlanPersistence lp = PhysicalPlanReaderTestFactory.defaultLogicalPlanPersistence(config);
PersistentStore<String> hbaseStore = provider.getOrCreateStore(PersistentStoreConfig.newJacksonBuilder(lp.getMapper(), String.class).name("hbase").build());
hbaseStore.put("", "v0");
hbaseStore.put("k1", "v1");
hbaseStore.put("k2", "v2");
hbaseStore.put("k3", "v3");
hbaseStore.put("k4", "v4");
hbaseStore.put("k5", "v5");
hbaseStore.put(".test", "testValue");
assertEquals("v0", hbaseStore.get(""));
assertEquals("testValue", hbaseStore.get(".test"));
assertTrue(hbaseStore.contains(""));
assertFalse(hbaseStore.contains("unknown_key"));
int rowCount = 0;
for (Entry<String, String> entry : Lists.newArrayList(hbaseStore.getAll())) {
rowCount++;
System.out.println(entry.getKey() + "=" + entry.getValue());
}
assertEquals(7, rowCount);
PersistentStore<String> hbaseTestStore = provider.getOrCreateStore(PersistentStoreConfig.newJacksonBuilder(lp.getMapper(), String.class).name("hbase.test").build());
hbaseTestStore.put("", "v0");
hbaseTestStore.put("k1", "v1");
hbaseTestStore.put("k2", "v2");
hbaseTestStore.put("k3", "v3");
hbaseTestStore.put("k4", "v4");
hbaseTestStore.put(".test", "testValue");
assertEquals("v0", hbaseStore.get(""));
assertEquals("testValue", hbaseStore.get(".test"));
rowCount = 0;
for (Entry<String, String> entry : Lists.newArrayList(hbaseTestStore.getAll())) {
rowCount++;
System.out.println(entry.getKey() + "=" + entry.getValue());
}
assertEquals(6, rowCount);
}
use of org.apache.drill.common.config.LogicalPlanPersistence in project drill by axbaretto.
the class TestOpSerialization method setUp.
@Before
public void setUp() {
config = DrillConfig.create();
reader = PhysicalPlanReaderTestFactory.defaultPhysicalPlanReader(config);
LogicalPlanPersistence logicalPlanPersistence = PhysicalPlanReaderTestFactory.defaultLogicalPlanPersistence(config);
writer = logicalPlanPersistence.getMapper().writer();
}
use of org.apache.drill.common.config.LogicalPlanPersistence in project drill by axbaretto.
the class CodeCompilerTestFactory method getTestCompiler.
public static CodeCompiler getTestCompiler(DrillConfig c) throws Exception {
DrillConfig config = checkNotNull(c);
LogicalPlanPersistence persistence = new LogicalPlanPersistence(config, ClassPathScanner.fromPrescan(config));
LocalPersistentStoreProvider provider = new LocalPersistentStoreProvider(config);
SystemOptionManager systemOptionManager = new SystemOptionManager(persistence, provider, config);
return new CodeCompiler(config, systemOptionManager.init());
}
use of org.apache.drill.common.config.LogicalPlanPersistence in project drill by apache.
the class CodeCompilerTestFactory method getTestCompiler.
public static CodeCompiler getTestCompiler(DrillConfig c) throws Exception {
DrillConfig config = checkNotNull(c);
LogicalPlanPersistence persistence = new LogicalPlanPersistence(config, ClassPathScanner.fromPrescan(config));
LocalPersistentStoreProvider provider = new LocalPersistentStoreProvider(config);
SystemOptionManager systemOptionManager = new SystemOptionManager(persistence, provider, config);
return new CodeCompiler(config, systemOptionManager.init());
}
Aggregations