@Test public void shouldProducePlanWhenSelectingAllColumnsOnExistingTable() { schemata = schemataBuilder.addTable("someTable", "column1", "column2", "column3").build(); query = builder.selectStar().from("someTable").query(); initQueryContext(); plan = planner.createPlan(queryContext, query); print(plan); assertThat(problems.hasErrors(), is(false)); assertThat(problems.isEmpty(), is(true)); assertProjectNode(plan, "column1", "column2", "column3"); assertThat(plan.getType(), is(PlanNode.Type.PROJECT)); assertThat(plan.getChildCount(), is(1)); PlanNode source = plan.getFirstChild(); assertSourceNode(source, "someTable", null, "column1", "column2", "column3"); assertThat(source.getChildCount(), is(0)); }
@Override public PlanNode createPlan( QueryContext context, QueryCommand query ) { PlanNode plan = null; if (query instanceof Query) { plan = createCanonicalPlan(context, (Query)query); } else { plan = createCanonicalPlan(context, (SetQuery)query); } return plan; }
CanonicalPlanner implements Planner { @Override public PlanNode createPlan( QueryContext context, QueryCommand query ) { PlanNode plan = null; if (query instanceof Query) { plan = createCanonicalPlan(context, (Query)query); } else { plan = createCanonicalPlan(context, (SetQuery)query); } return plan; } }
CanonicalPlanner implements Planner { @Override public PlanNode createPlan( QueryContext context, QueryCommand query ) { PlanNode plan = null; if (query instanceof Query) { plan = createCanonicalPlan(context, (Query)query); } else { plan = createCanonicalPlan(context, (SetQuery)query); } return plan; }  }
CanonicalPlanner implements Planner { @Override public PlanNode createPlan( QueryContext context, QueryCommand query ) { PlanNode plan = null; if (query instanceof Query) { plan = createCanonicalPlan(context, (Query)query); } else { plan = createCanonicalPlan(context, (SetQuery)query); } return plan; }  @Override PlanNode createPlan( QueryContext context,
                                QueryCommand query ); }
CanonicalPlanner implements Planner { @Override public PlanNode createPlan( QueryContext context, QueryCommand query ) { PlanNode plan = null; if (query instanceof Query) { plan = createCanonicalPlan(context, (Query)query); } else { plan = createCanonicalPlan(context, (SetQuery)query); } return plan; }  @Override PlanNode createPlan( QueryContext context,
                                QueryCommand query );  }