Search in sources :

Example 6 with LogicalPlanPersistence

use of org.apache.drill.common.config.LogicalPlanPersistence in project drill by apache.

the class BasicOptimizerTest method parseSimplePlan.

@Test
public void parseSimplePlan() throws Exception {
    DrillConfig c = DrillConfig.create();
    LogicalPlanPersistence lpp = PhysicalPlanReaderTestFactory.defaultLogicalPlanPersistence(c);
    LogicalPlan plan = LogicalPlan.parse(lpp, FileUtils.getResourceAsString("/scan_screen_logical.json"));
    String unparse = plan.unparse(lpp);
//        System.out.println(unparse);
//System.out.println( new BasicOptimizer(DrillConfig.create()).convert(plan).unparse(c.getMapper().writer()));
}
Also used : DrillConfig(org.apache.drill.common.config.DrillConfig) LogicalPlan(org.apache.drill.common.logical.LogicalPlan) LogicalPlanPersistence(org.apache.drill.common.config.LogicalPlanPersistence) Test(org.junit.Test) ExecTest(org.apache.drill.exec.ExecTest)

Example 7 with LogicalPlanPersistence

use of org.apache.drill.common.config.LogicalPlanPersistence in project drill by apache.

the class TestParsePhysicalPlan method parseSimplePlan.

@Test
public void parseSimplePlan() throws Exception {
    DrillConfig c = DrillConfig.create();
    ScanResult scanResult = ClassPathScanner.fromPrescan(c);
    LogicalPlanPersistence lpp = new LogicalPlanPersistence(c, scanResult);
    PhysicalPlanReader reader = new PhysicalPlanReader(c, scanResult, lpp, CoordinationProtos.DrillbitEndpoint.getDefaultInstance(), null);
    ObjectReader r = lpp.getMapper().reader(PhysicalPlan.class);
    ObjectWriter writer = lpp.getMapper().writer();
    PhysicalPlan plan = reader.readPhysicalPlan(Files.toString(FileUtils.getResourceAsFile("/physical_test1.json"), Charsets.UTF_8));
    String unparse = plan.unparse(writer);
//    System.out.println(unparse);
}
Also used : ScanResult(org.apache.drill.common.scanner.persistence.ScanResult) PhysicalPlan(org.apache.drill.exec.physical.PhysicalPlan) DrillConfig(org.apache.drill.common.config.DrillConfig) PhysicalPlanReader(org.apache.drill.exec.planner.PhysicalPlanReader) ObjectWriter(com.fasterxml.jackson.databind.ObjectWriter) ObjectReader(com.fasterxml.jackson.databind.ObjectReader) LogicalPlanPersistence(org.apache.drill.common.config.LogicalPlanPersistence) Test(org.junit.Test) ExecTest(org.apache.drill.exec.ExecTest)

Example 8 with LogicalPlanPersistence

use of org.apache.drill.common.config.LogicalPlanPersistence in project drill by apache.

the class CheckStorageConfig method checkPlanParsing.

@Test
public void checkPlanParsing() throws Exception {
    DrillConfig config = DrillConfig.create();
    ScanResult scan = ClassPathScanner.fromPrescan(config);
    LogicalPlan plan = LogicalPlan.parse(new LogicalPlanPersistence(config, scan), FileUtils.getResourceAsString("/storage_engine_plan.json"));
}
Also used : ScanResult(org.apache.drill.common.scanner.persistence.ScanResult) DrillConfig(org.apache.drill.common.config.DrillConfig) LogicalPlan(org.apache.drill.common.logical.LogicalPlan) LogicalPlanPersistence(org.apache.drill.common.config.LogicalPlanPersistence) Test(org.junit.Test) DrillTest(org.apache.drill.test.DrillTest)

Aggregations

LogicalPlanPersistence (org.apache.drill.common.config.LogicalPlanPersistence)8 DrillConfig (org.apache.drill.common.config.DrillConfig)6 Test (org.junit.Test)5 ScanResult (org.apache.drill.common.scanner.persistence.ScanResult)4 PhysicalPlan (org.apache.drill.exec.physical.PhysicalPlan)3 LogicalPlan (org.apache.drill.common.logical.LogicalPlan)2 ExecTest (org.apache.drill.exec.ExecTest)2 PhysicalPlanReader (org.apache.drill.exec.planner.PhysicalPlanReader)2 SystemOptionManager (org.apache.drill.exec.server.options.SystemOptionManager)2 LocalPersistentStoreProvider (org.apache.drill.exec.store.sys.store.provider.LocalPersistentStoreProvider)2 MetricRegistry (com.codahale.metrics.MetricRegistry)1 ObjectReader (com.fasterxml.jackson.databind.ObjectReader)1 ObjectWriter (com.fasterxml.jackson.databind.ObjectWriter)1 ByteArrayInputStream (java.io.ByteArrayInputStream)1 ByteArrayOutputStream (java.io.ByteArrayOutputStream)1 NonStrictExpectations (mockit.NonStrictExpectations)1 SchemaPlus (org.apache.calcite.schema.SchemaPlus)1 ValueExpressions (org.apache.drill.common.expression.ValueExpressions)1 FunctionImplementationRegistry (org.apache.drill.exec.expr.fn.FunctionImplementationRegistry)1 PhysicalOperator (org.apache.drill.exec.physical.base.PhysicalOperator)1