@Test public void testSetQualifier() throws PlanningException { Expr context = sqlAnalyzer.parse(setQualifiers[0]); LogicalNode plan = planner.createPlan(context).getRootBlock().getRoot(); testJsonSerDerObject(plan); assertEquals(NodeType.ROOT, plan.getType()); LogicalRootNode root = (LogicalRootNode) plan; assertEquals(NodeType.PROJECTION, root.getChild().getType()); ProjectionNode projectionNode = root.getChild(); assertEquals(NodeType.SCAN, projectionNode.getChild().getType()); context = sqlAnalyzer.parse(setQualifiers[1]); plan = planner.createPlan(context).getRootBlock().getRoot(); testJsonSerDerObject(plan); assertEquals(NodeType.ROOT, plan.getType()); root = (LogicalRootNode) plan; assertEquals(NodeType.PROJECTION, root.getChild().getType()); projectionNode = root.getChild(); assertEquals(NodeType.GROUP_BY, projectionNode.getChild().getType()); context = sqlAnalyzer.parse(setQualifiers[2]); plan = planner.createPlan(context).getRootBlock().getRoot(); testJsonSerDerObject(plan); root = (LogicalRootNode) plan; assertEquals(NodeType.PROJECTION, root.getChild().getType()); projectionNode = root.getChild(); assertEquals(NodeType.SCAN, projectionNode.getChild().getType()); }
public LogicalPlan createPlan(Expr expr) throws PlanningException { return createPlan(expr, false); }
LogicalPlanner extends BaseAlgebraVisitor<LogicalPlanner.PlanContext, LogicalNode> { public LogicalPlan createPlan(Expr expr) throws PlanningException { return createPlan(expr, false); } }
LogicalPlanner extends BaseAlgebraVisitor<LogicalPlanner.PlanContext, LogicalNode> { public LogicalPlan createPlan(Expr expr) throws PlanningException { return createPlan(expr, false); } LogicalPlanner(CatalogService catalog); }
LogicalPlanner extends BaseAlgebraVisitor<LogicalPlanner.PlanContext, LogicalNode> { public LogicalPlan createPlan(Expr expr) throws PlanningException { return createPlan(expr, false); } LogicalPlanner(CatalogService catalog); LogicalPlan createPlan(Expr expr); @VisibleForTesting LogicalPlan createPlan(Expr expr, boolean debug); ExprAnnotator getExprAnnotator(); void preHook(PlanContext context, Stack<Expr> stack, Expr expr); LogicalNode postHook(PlanContext context, Stack<Expr> stack, Expr expr, LogicalNode current); @Override LogicalNode visitProjection(PlanContext context, Stack<Expr> stack, Projection projection); static void verifyProjectedFields(QueryBlock block, Projectable projectable); @Override LimitNode visitLimit(PlanContext context, Stack<Expr> stack, Limit limit); @Override SortNode visitSort(PlanContext context, Stack<Expr> stack, Sort sort); @Override LogicalNode visitHaving(PlanContext context, Stack<Expr> stack, Having expr); @Override LogicalNode visitGroupBy(PlanContext context, Stack<Expr> stack, Aggregation aggregation); static List<Column[]> generateCuboids(Column[] columns); @Override SelectionNode visitFilter(PlanContext context, Stack<Expr> stack, Selection selection); @Override LogicalNode visitJoin(PlanContext context, Stack<Expr> stack, Join join); @Override LogicalNode visitRelationList(PlanContext context, Stack<Expr> stack, RelationList relations); @Override ScanNode visitRelation(PlanContext context, Stack<Expr> stack, Relation expr); TableSubQueryNode visitTableSubQuery(PlanContext context, Stack<Expr> stack, TablePrimarySubQuery expr); @Override LogicalNode visitUnion(PlanContext context, Stack<Expr> stack, SetOperation setOperation); @Override LogicalNode visitExcept(PlanContext context, Stack<Expr> stack, SetOperation setOperation); @Override LogicalNode visitIntersect(PlanContext context, Stack<Expr> stack, SetOperation setOperation); LogicalNode visitInsert(PlanContext context, Stack<Expr> stack, Insert expr); @Override LogicalNode visitCreateTable(PlanContext context, Stack<Expr> stack, CreateTable expr); @Override LogicalNode visitDropTable(PlanContext context, Stack<Expr> stack, DropTable dropTable); static boolean checkIfBeEvaluatedAtGroupBy(EvalNode evalNode, GroupbyNode node); static boolean checkIfBeEvaluatedAtJoin(QueryBlock block, EvalNode evalNode, JoinNode node,
                                                 boolean isTopMostJoin); static boolean checkIfBeEvaluatedAtRelation(QueryBlock block, EvalNode evalNode, RelationNode node); static boolean checkIfBeEvaluatedAtThis(EvalNode evalNode, LogicalNode node); }
LogicalPlanner extends BaseAlgebraVisitor<LogicalPlanner.PlanContext, LogicalNode> { public LogicalPlan createPlan(Expr expr) throws PlanningException { return createPlan(expr, false); } LogicalPlanner(CatalogService catalog); LogicalPlan createPlan(Expr expr); @VisibleForTesting LogicalPlan createPlan(Expr expr, boolean debug); ExprAnnotator getExprAnnotator(); void preHook(PlanContext context, Stack<Expr> stack, Expr expr); LogicalNode postHook(PlanContext context, Stack<Expr> stack, Expr expr, LogicalNode current); @Override LogicalNode visitProjection(PlanContext context, Stack<Expr> stack, Projection projection); static void verifyProjectedFields(QueryBlock block, Projectable projectable); @Override LimitNode visitLimit(PlanContext context, Stack<Expr> stack, Limit limit); @Override SortNode visitSort(PlanContext context, Stack<Expr> stack, Sort sort); @Override LogicalNode visitHaving(PlanContext context, Stack<Expr> stack, Having expr); @Override LogicalNode visitGroupBy(PlanContext context, Stack<Expr> stack, Aggregation aggregation); static List<Column[]> generateCuboids(Column[] columns); @Override SelectionNode visitFilter(PlanContext context, Stack<Expr> stack, Selection selection); @Override LogicalNode visitJoin(PlanContext context, Stack<Expr> stack, Join join); @Override LogicalNode visitRelationList(PlanContext context, Stack<Expr> stack, RelationList relations); @Override ScanNode visitRelation(PlanContext context, Stack<Expr> stack, Relation expr); TableSubQueryNode visitTableSubQuery(PlanContext context, Stack<Expr> stack, TablePrimarySubQuery expr); @Override LogicalNode visitUnion(PlanContext context, Stack<Expr> stack, SetOperation setOperation); @Override LogicalNode visitExcept(PlanContext context, Stack<Expr> stack, SetOperation setOperation); @Override LogicalNode visitIntersect(PlanContext context, Stack<Expr> stack, SetOperation setOperation); LogicalNode visitInsert(PlanContext context, Stack<Expr> stack, Insert expr); @Override LogicalNode visitCreateTable(PlanContext context, Stack<Expr> stack, CreateTable expr); @Override LogicalNode visitDropTable(PlanContext context, Stack<Expr> stack, DropTable dropTable); static boolean checkIfBeEvaluatedAtGroupBy(EvalNode evalNode, GroupbyNode node); static boolean checkIfBeEvaluatedAtJoin(QueryBlock block, EvalNode evalNode, JoinNode node,
                                                 boolean isTopMostJoin); static boolean checkIfBeEvaluatedAtRelation(QueryBlock block, EvalNode evalNode, RelationNode node); static boolean checkIfBeEvaluatedAtThis(EvalNode evalNode, LogicalNode node); static final Column[] ALL; }