/** * It creates a number of fragments for all partitions. */ public static List<Fragment> getFragmentsFromPartitionedTable(Tablespace tsHandler, ScanNode scan, TableDesc table) throws IOException { Preconditions.checkArgument(tsHandler instanceof FileTablespace, "tsHandler must be FileTablespace"); if (!(scan instanceof PartitionedTableScanNode)) { throw new IllegalArgumentException("scan should be a PartitionedTableScanNode type."); } List<Fragment> fragments = Lists.newArrayList(); PartitionedTableScanNode partitionsScan = (PartitionedTableScanNode) scan; fragments.addAll(((FileTablespace) tsHandler).getSplits( scan.getCanonicalName(), table.getMeta(), table.getSchema(), partitionsScan.getInputPaths())); partitionsScan.setInputPaths(null); return fragments; }
public void init(ScanNode scanNode, Path[] inputPaths) { tableDesc = scanNode.tableDesc; setInSchema(scanNode.getInSchema()); setOutSchema(scanNode.getOutSchema()); this.qual = scanNode.qual; this.targets = scanNode.targets; setInputPaths(inputPaths); if (scanNode.hasAlias()) { alias = scanNode.alias; } }
private static PartitionedTableScanNode convertPartitionScan(OverridableConf context, EvalContext evalContext, PlanProto.LogicalNode protoNode) { PartitionedTableScanNode partitionedScan = new PartitionedTableScanNode(protoNode.getNodeId()); fillScanNode(context, evalContext, protoNode, partitionedScan); PlanProto.PartitionScanSpec partitionScanProto = protoNode.getPartitionScan(); Path [] paths = new Path[partitionScanProto.getPathsCount()]; for (int i = 0; i < partitionScanProto.getPathsCount(); i++) { paths[i] = new Path(partitionScanProto.getPaths(i)); } partitionedScan.setInputPaths(paths); return partitionedScan; }
private static PartitionedTableScanNode convertPartitionScan(OverridableConf context, EvalContext evalContext, PlanProto.LogicalNode protoNode) { PartitionedTableScanNode partitionedScan = new PartitionedTableScanNode(protoNode.getNodeId()); fillScanNode(context, evalContext, protoNode, partitionedScan); PlanProto.PartitionScanSpec partitionScanProto = protoNode.getPartitionScan(); Path [] paths = new Path[partitionScanProto.getPathsCount()]; for (int i = 0; i < partitionScanProto.getPathsCount(); i++) { paths[i] = new Path(partitionScanProto.getPaths(i)); } partitionedScan.setInputPaths(paths); return partitionedScan; }
partitionScan.setInputPaths(partitionScanPaths);
@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; }
PartitionedTableScanNode partitionScan = (PartitionedTableScanNode)scan; partitionScan.setInputPaths(partitionScanPaths); } else { broadcastFragments.addAll(scanFragments);