@Override public Object clone() throws CloneNotSupportedException { PartitionedTableScanNode unionScan = (PartitionedTableScanNode) super.clone(); unionScan.tableDesc = (TableDesc) this.tableDesc.clone(); if (hasQual()) { unionScan.qual = (EvalNode) this.qual.clone(); } if (hasTargets()) { unionScan.targets = new ArrayList<>(); for (Target t : targets) { unionScan.targets.add((Target) t.clone()); } } unionScan.inputPaths = inputPaths; return unionScan; }
@Override public LogicalNode visitPartitionedTableScan(Context context, LogicalPlan plan, LogicalPlan.QueryBlock block, PartitionedTableScanNode node, Stack<LogicalNode> stack) throws TajoException { Context newContext = new Context(context); Target [] targets; if (node.hasTargets()) { targets = node.getTargets(); } else { targets = PlannerUtil.schemaToTargets(node.getOutSchema()); } LinkedHashSet<Target> projectedTargets = Sets.newLinkedHashSet(); for (Iterator<Target> it = getFilteredTarget(targets, newContext.requiredSet); it.hasNext();) { Target target = it.next(); newContext.addExpr(target); } for (Iterator<Target> it = context.targetListMgr.getFilteredTargets(newContext.requiredSet); it.hasNext();) { Target target = it.next(); if (LogicalPlanner.checkIfBeEvaluatedAtRelation(block, target.getEvalTree(), node)) { projectedTargets.add(target); newContext.targetListMgr.markAsEvaluated(target); } } node.setTargets(projectedTargets.toArray(new Target[projectedTargets.size()])); LogicalPlanner.verifyProjectedFields(block, node); return node; }
@Override public LogicalNode visitPartitionedTableScan(Context context, LogicalPlan plan, LogicalPlan.QueryBlock block, PartitionedTableScanNode node, Stack<LogicalNode> stack) throws TajoException { Context newContext = new Context(context); List<Target> targets; if (node.hasTargets()) { targets = node.getTargets(); } else { targets = PlannerUtil.schemaToTargets(node.getOutSchema()); } LinkedHashSet<Target> projectedTargets = Sets.newLinkedHashSet(); for (Iterator<Target> it = getFilteredTarget(targets, newContext.requiredSet); it.hasNext();) { Target target = it.next(); newContext.addExpr(target); } for (Iterator<Target> it = context.targetListMgr.getFilteredTargets(newContext.requiredSet); it.hasNext();) { Target target = it.next(); if (LogicalPlanner.checkIfBeEvaluatedAtRelation(block, target.getEvalTree(), node)) { projectedTargets.add(target); newContext.targetListMgr.markAsEvaluated(target); } } node.setTargets(new ArrayList<>(projectedTargets)); LogicalPlanner.verifyProjectedFields(block, node); return node; }
@Override public Object clone() throws CloneNotSupportedException { PartitionedTableScanNode unionScan = (PartitionedTableScanNode) super.clone(); unionScan.tableDesc = (TableDesc) this.tableDesc.clone(); if (hasQual()) { unionScan.qual = (EvalNode) this.qual.clone(); } if (hasTargets()) { unionScan.targets = new Target[targets.length]; for (int i = 0; i < targets.length; i++) { unionScan.targets[i] = (Target) targets[i].clone(); } } unionScan.inputPaths = inputPaths; return unionScan; }
@Override public LogicalNode visitPartitionedTableScan(PlanShapeFixerContext context, LogicalPlan plan, LogicalPlan.QueryBlock block, PartitionedTableScanNode node, Stack<LogicalNode> stack) throws TajoException { super.visitPartitionedTableScan(context, plan, block, node, stack); context.childNumbers.push(1); Path[] inputPaths = node.getInputPaths(); Arrays.sort(inputPaths); node.setInputPaths(inputPaths); if (node.hasTargets()) { node.setTargets(sortTargets(node.getTargets())); } if (node.hasQual()) { node.setQual(sortQual(node.getQual())); } return null; }
@Override public LogicalNode visitPartitionedTableScan(PlanShapeFixerContext context, LogicalPlan plan, LogicalPlan.QueryBlock block, PartitionedTableScanNode node, Stack<LogicalNode> stack) throws TajoException { super.visitPartitionedTableScan(context, plan, block, node, stack); context.childNumbers.push(1); Path[] inputPaths = node.getInputPaths(); Arrays.sort(inputPaths); node.setInputPaths(inputPaths); if (node.hasTargets()) { node.setTargets(sortTargets(node.getTargets())); } if (node.hasQual()) { node.setQual(sortQual(node.getQual())); } return null; }
@Override public PlanString getPlanString() { PlanString planStr = new PlanString(this).appendTitle(" on " + getTableName()); if (hasAlias()) { planStr.appendTitle(" as ").appendTitle(alias); } if (hasQual()) { planStr.addExplan("filter: ").appendExplain(this.qual.toString()); } if (hasTargets()) { planStr.addExplan("target list: ").appendExplain(StringUtils.join(targets, ", ")); } planStr.addDetail("out schema: ").appendDetail(getOutSchema().toString()); planStr.addDetail("in schema: ").appendDetail(getInSchema().toString()); if (inputPaths != null) { planStr.addExplan("num of filtered paths: ").appendExplain(""+ inputPaths.length); int i = 0; for (Path path : inputPaths) { planStr.addDetail((i++) + ": ").appendDetail(path.toString()); } } return planStr; } }
if (hasTargets()) { planStr.addExplan("target list: "); boolean first = true;