Search in sources :

Example 1 with LogicalPlanPersistence

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);
}
Also used : ScanResult(org.apache.drill.common.scanner.persistence.ScanResult) DrillConfig(org.apache.drill.common.config.DrillConfig) ByteArrayInputStream(java.io.ByteArrayInputStream) ByteArrayOutputStream(java.io.ByteArrayOutputStream) LogicalPlanPersistence(org.apache.drill.common.config.LogicalPlanPersistence)

Example 2 with LogicalPlanPersistence

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);
}
Also used : LogicalPlanPersistence(org.apache.drill.common.config.LogicalPlanPersistence) HbaseStorageTest(org.apache.drill.categories.HbaseStorageTest) Test(org.junit.Test) SlowTest(org.apache.drill.categories.SlowTest)

Example 3 with LogicalPlanPersistence

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();
}
Also used : LogicalPlanPersistence(org.apache.drill.common.config.LogicalPlanPersistence) Before(org.junit.Before)

Example 4 with LogicalPlanPersistence

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());
}
Also used : DrillConfig(org.apache.drill.common.config.DrillConfig) LocalPersistentStoreProvider(org.apache.drill.exec.store.sys.store.provider.LocalPersistentStoreProvider) SystemOptionManager(org.apache.drill.exec.server.options.SystemOptionManager) LogicalPlanPersistence(org.apache.drill.common.config.LogicalPlanPersistence)

Example 5 with LogicalPlanPersistence

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());
}
Also used : DrillConfig(org.apache.drill.common.config.DrillConfig) LocalPersistentStoreProvider(org.apache.drill.exec.store.sys.store.provider.LocalPersistentStoreProvider) SystemOptionManager(org.apache.drill.exec.server.options.SystemOptionManager) LogicalPlanPersistence(org.apache.drill.common.config.LogicalPlanPersistence)

Aggregations

LogicalPlanPersistence (org.apache.drill.common.config.LogicalPlanPersistence)16 DrillConfig (org.apache.drill.common.config.DrillConfig)10 ScanResult (org.apache.drill.common.scanner.persistence.ScanResult)8 Test (org.junit.Test)8 LogicalPlan (org.apache.drill.common.logical.LogicalPlan)4 ExecTest (org.apache.drill.exec.ExecTest)4 PhysicalPlan (org.apache.drill.exec.physical.PhysicalPlan)4 SystemOptionManager (org.apache.drill.exec.server.options.SystemOptionManager)4 LocalPersistentStoreProvider (org.apache.drill.exec.store.sys.store.provider.LocalPersistentStoreProvider)4 MetricRegistry (com.codahale.metrics.MetricRegistry)2 ObjectReader (com.fasterxml.jackson.databind.ObjectReader)2 ObjectWriter (com.fasterxml.jackson.databind.ObjectWriter)2 ByteArrayInputStream (java.io.ByteArrayInputStream)2 ByteArrayOutputStream (java.io.ByteArrayOutputStream)2 SchemaPlus (org.apache.calcite.schema.SchemaPlus)2 HbaseStorageTest (org.apache.drill.categories.HbaseStorageTest)2 PlannerTest (org.apache.drill.categories.PlannerTest)2 SlowTest (org.apache.drill.categories.SlowTest)2 FunctionImplementationRegistry (org.apache.drill.exec.expr.fn.FunctionImplementationRegistry)2 QueryContext (org.apache.drill.exec.ops.QueryContext)2