@Override public PlanString getPlanString() { PlanString planStr = new PlanString(this); if (distinct) { planStr.appendTitle(" (distinct)"); } StringBuilder sb = new StringBuilder("Targets: "); if (targets != null) { for (int i = 0; i < targets.size(); i++) { sb.append(targets.get(i)); if (i < targets.size() - 1) { sb.append(", "); } } } planStr.addExplan(sb.toString()); if (getOutSchema() != null) { planStr.addExplan("out schema: " + getOutSchema().toString()); } if (getInSchema() != null) { planStr.addExplan("in schema: " + getInSchema().toString()); } return planStr; } }
@Override public PlanString getPlanString() { PlanString planStr = new PlanString(this); if (distinct) { planStr.appendTitle(" (distinct)"); } StringBuilder sb = new StringBuilder("Targets: "); if (targets != null) { for (int i = 0; i < targets.length; i++) { sb.append(targets[i]); if (i < targets.length - 1) { sb.append(", "); } } } planStr.addExplan(sb.toString()); if (getOutSchema() != null) { planStr.addExplan("out schema: " + getOutSchema().toString()); } if (getInSchema() != null) { planStr.addExplan("in schema: " + getInSchema().toString()); } return planStr; } }
private void insertDistinctOperator(LogicalPlan plan, LogicalPlan.QueryBlock block, ProjectionNode projectionNode, LogicalNode child) throws TajoException { if (projectionNode.getChild().getType() != NodeType.GROUP_BY) { Schema outSchema = projectionNode.getOutSchema(); GroupbyNode dupRemoval = plan.createNode(GroupbyNode.class); dupRemoval.setChild(child); dupRemoval.setInSchema(projectionNode.getInSchema()); dupRemoval.setTargets(PlannerUtil.schemaToTargets(outSchema)); dupRemoval.setGroupingColumns(outSchema.toArray()); block.registerNode(dupRemoval); block.setAggregationRequire(); projectionNode.setChild(dupRemoval); projectionNode.setInSchema(dupRemoval.getOutSchema()); } }
private void insertDistinctOperator(LogicalPlan plan, LogicalPlan.QueryBlock block, ProjectionNode projectionNode, LogicalNode child) throws TajoException { if (projectionNode.getChild().getType() != NodeType.GROUP_BY) { Schema outSchema = projectionNode.getOutSchema(); GroupbyNode dupRemoval = plan.createNode(GroupbyNode.class); dupRemoval.setChild(child); dupRemoval.setInSchema(projectionNode.getInSchema()); dupRemoval.setTargets(PlannerUtil.schemaToTargets(outSchema)); dupRemoval.setGroupingColumns(outSchema.toArray()); block.registerNode(dupRemoval); block.setAggregationRequire(); projectionNode.setChild(dupRemoval); projectionNode.setInSchema(dupRemoval.getOutSchema()); } }
projectionNode.setOutSchema(PlannerUtil.targetToSchema(targets)); ctx.getQueryBlock().setSchema(projectionNode.getOutSchema()); return projectionNode;
projectionNode.setOutSchema(PlannerUtil.targetToSchema(targets)); ctx.getQueryBlock().setSchema(projectionNode.getOutSchema()); return projectionNode;
Schema outSchema = projectionNode.getOutSchema(); GroupbyNode dupRemoval = context.plan.createNode(GroupbyNode.class); dupRemoval.setForDistinctBlock();
Schema outSchema = projectionNode.getOutSchema(); GroupbyNode dupRemoval = context.plan.createNode(GroupbyNode.class); dupRemoval.setForDistinctBlock();
@Test public final void testAsterisk() throws CloneNotSupportedException, TajoException { QueryContext qc = createQueryContext(); Expr expr = sqlAnalyzer.parse(QUERIES[13]); LogicalPlan planNode = planner.createPlan(qc, expr); LogicalNode plan = planNode.getRootBlock().getRoot(); assertEquals(NodeType.ROOT, plan.getType()); testCloneLogicalNode(plan); LogicalRootNode root = (LogicalRootNode) plan; assertEquals(NodeType.PROJECTION, root.getChild().getType()); ProjectionNode projNode = root.getChild(); assertEquals(6, projNode.getOutSchema().size()); assertEquals(NodeType.SELECTION, projNode.getChild().getType()); SelectionNode selNode = projNode.getChild(); assertEquals(NodeType.SCAN, selNode.getChild().getType()); ScanNode scanNode = selNode.getChild(); assertEquals(IdentifierUtil.buildFQName(DEFAULT_DATABASE_NAME, "employee"), scanNode.getTableName()); }