本文整理汇总了Java中org.apache.drill.exec.physical.PhysicalPlan.unparse方法的典型用法代码示例。如果您正苦于以下问题:Java PhysicalPlan.unparse方法的具体用法?Java PhysicalPlan.unparse怎么用?Java PhysicalPlan.unparse使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.apache.drill.exec.physical.PhysicalPlan
的用法示例。
在下文中一共展示了PhysicalPlan.unparse方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: parseSimplePlan
import org.apache.drill.exec.physical.PhysicalPlan; //导入方法依赖的package包/类
@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(DrillFileUtils.getResourceAsFile("/physical_test1.json"), Charsets.UTF_8));
String unparse = plan.unparse(writer);
// System.out.println(unparse);
}
示例2: log
import org.apache.drill.exec.physical.PhysicalPlan; //导入方法依赖的package包/类
protected void log(final String name, final PhysicalPlan plan, final Logger logger) throws JsonProcessingException {
if (logger.isDebugEnabled()) {
String planText = plan.unparse(context.getConfig().getMapper().writer());
logger.debug(name + " : \n" + planText);
}
}
示例3: PhysicalExplain
import org.apache.drill.exec.physical.PhysicalPlan; //导入方法依赖的package包/类
public PhysicalExplain(RelNode node, PhysicalPlan plan, SqlExplainLevel level, QueryContext context) {
this.text = PrelSequencer.printWithIds((Prel) node, level);
this.json = plan.unparse(context.getConfig().getMapper().writer());
}
示例4: returnPhysical
import org.apache.drill.exec.physical.PhysicalPlan; //导入方法依赖的package包/类
private void returnPhysical(final PhysicalPlan plan) throws ExecutionSetupException {
final String jsonPlan = plan.unparse(queryContext.getConfig().getMapper().writer());
runPhysicalPlan(DirectPlan.createDirectPlan(queryContext, new PhysicalFromLogicalExplain(jsonPlan)));
}
示例5: testSerializedDeserialize
import org.apache.drill.exec.physical.PhysicalPlan; //导入方法依赖的package包/类
@Test
public void testSerializedDeserialize() throws Throwable {
DrillConfig c = DrillConfig.create();
PhysicalPlanReader reader = new PhysicalPlanReader(c, c.getMapper(), CoordinationProtos.DrillbitEndpoint.getDefaultInstance());
MockSubScanPOP s = new MockSubScanPOP("abc", null);
s.setOperatorId(3);
Filter f = new Filter(s, new ValueExpressions.BooleanExpression("true", ExpressionPosition.UNKNOWN), 0.1f);
f.setOperatorId(2);
UnionExchange e = new UnionExchange(f);
e.setOperatorId(1);
Screen screen = new Screen(e, CoordinationProtos.DrillbitEndpoint.getDefaultInstance());
screen.setOperatorId(0);
boolean reversed = false;
while (true) {
List<PhysicalOperator> pops = Lists.newArrayList();
pops.add(s);
pops.add(e);
pops.add(f);
pops.add(screen);
if (reversed) {
pops = Lists.reverse(pops);
}
PhysicalPlan plan1 = new PhysicalPlan(PlanProperties.builder().build(), pops);
String json = plan1.unparse(c.getMapper().writer());
System.out.println(json);
PhysicalPlan plan2 = reader.readPhysicalPlan(json);
System.out.println("++++++++");
System.out.println(plan2.unparse(c.getMapper().writer()));
PhysicalOperator root = plan2.getSortedOperators(false).iterator().next();
assertEquals(0, root.getOperatorId());
PhysicalOperator o1 = root.iterator().next();
assertEquals(1, o1.getOperatorId());
PhysicalOperator o2 = o1.iterator().next();
assertEquals(2, o2.getOperatorId());
if(reversed) {
break;
}
reversed = !reversed;
}
}
示例6: log
import org.apache.drill.exec.physical.PhysicalPlan; //导入方法依赖的package包/类
protected void log(final String name, final PhysicalPlan plan, final Logger logger) throws JsonProcessingException {
if (logger.isDebugEnabled()) {
String planText = plan.unparse(context.getLpPersistence().getMapper().writer());
logger.debug(name + " : \n" + planText);
}
}
示例7: PhysicalExplain
import org.apache.drill.exec.physical.PhysicalPlan; //导入方法依赖的package包/类
public PhysicalExplain(RelNode node, PhysicalPlan plan, SqlExplainLevel level, QueryContext context) {
this.text = PrelSequencer.printWithIds((Prel) node, level);
this.json = plan.unparse(context.getLpPersistence().getMapper().writer());
}
示例8: returnPhysical
import org.apache.drill.exec.physical.PhysicalPlan; //导入方法依赖的package包/类
private void returnPhysical(final PhysicalPlan plan) throws ExecutionSetupException {
final String jsonPlan = plan.unparse(queryContext.getLpPersistence().getMapper().writer());
runPhysicalPlan(DirectPlan.createDirectPlan(queryContext, new PhysicalFromLogicalExplain(jsonPlan)));
}
示例9: testSerializedDeserialize
import org.apache.drill.exec.physical.PhysicalPlan; //导入方法依赖的package包/类
@Test
public void testSerializedDeserialize() throws Throwable {
MockSubScanPOP s = new MockSubScanPOP("abc", false, null);
s.setOperatorId(3);
Filter f = new Filter(s, new ValueExpressions.BooleanExpression("true", ExpressionPosition.UNKNOWN), 0.1f);
f.setOperatorId(2);
UnionExchange e = new UnionExchange(f);
e.setOperatorId(1);
Screen screen = new Screen(e, CoordinationProtos.DrillbitEndpoint.getDefaultInstance());
screen.setOperatorId(0);
boolean reversed = false;
while (true) {
List<PhysicalOperator> pops = Lists.newArrayList();
pops.add(s);
pops.add(e);
pops.add(f);
pops.add(screen);
if (reversed) {
pops = Lists.reverse(pops);
}
PhysicalPlan plan1 = new PhysicalPlan(PlanProperties.builder().build(), pops);
String json = plan1.unparse(writer);
PhysicalPlan plan2 = reader.readPhysicalPlan(json);
PhysicalOperator root = plan2.getSortedOperators(false).iterator().next();
assertEquals(0, root.getOperatorId());
PhysicalOperator o1 = root.iterator().next();
assertEquals(1, o1.getOperatorId());
PhysicalOperator o2 = o1.iterator().next();
assertEquals(2, o2.getOperatorId());
if(reversed) {
break;
}
reversed = !reversed;
}
}