Package org.apache.tajo.engine.planner.logical

Examples of org.apache.tajo.engine.planner.logical.ScanNode


      for (LogicalPlan.QueryBlock block : plan.getQueryBlocks()) {
        LogicalNode[] scanNodes = PlannerUtil.findAllNodes(block.getRoot(), NodeType.SCAN);
        if(scanNodes != null) {
          for(LogicalNode eachScanNode: scanNodes) {
            ScanNode scanNode = (ScanNode)eachScanNode;
            tableDescMap.put(scanNode.getCanonicalName(), scanNode.getTableDesc());
          }
        }
      }

      MasterPlan masterPlan = new MasterPlan(queryId, queryContext, plan);
View Full Code Here


    return relations;
  }

  public static double getCost(LogicalNode node) {
    if (node instanceof ScanNode) {
      ScanNode scanNode = (ScanNode) node;
      if (scanNode.getTableDesc().getMeta().getStat() != null) {
        return ((ScanNode)node).getTableDesc().getMeta().getStat().getNumBytes();
      } else {
        return Long.MAX_VALUE;
      }
    } else {
View Full Code Here

    }

    public static long getInputVolume(MasterPlan masterPlan, QueryMasterTask.QueryMasterTaskContext context, ExecutionBlock execBlock) {
      Map<String, TableDesc> tableMap = context.getTableDescMap();
      if (masterPlan.isLeaf(execBlock)) {
        ScanNode outerScan = execBlock.getScanNodes()[0];
        TableStat stat = tableMap.get(outerScan.getCanonicalName()).getMeta().getStat();
        return stat.getNumBytes();
      } else {
        long aggregatedVolume = 0;
        for (ExecutionBlock childBlock : masterPlan.getChilds(execBlock)) {
          SubQuery subquery = context.getSubQuery(childBlock.getId());
View Full Code Here

      ScanNode[] scans = execBlock.getScanNodes();
      Preconditions.checkArgument(scans.length == 1, "Must be Scan Query");
      TableMeta meta;
      Path inputPath;

      ScanNode scan = scans[0];
      TableDesc desc = subQuery.context.getTableDescMap().get(scan.getCanonicalName());
      inputPath = desc.getPath();
      meta = desc.getMeta();

      // TODO - should be change the inner directory
      List<Fragment> fragments = subQuery.getStorageManager().getSplits(scan.getCanonicalName(), meta, inputPath);

      QueryUnit queryUnit;
      List<QueryUnit> queryUnits = new ArrayList<QueryUnit>();

      int i = 0;
View Full Code Here

    private static void scheduleFragmentsForLeafQuery(SubQuery subQuery) throws IOException {
      ExecutionBlock execBlock = subQuery.getBlock();
      ScanNode[] scans = execBlock.getScanNodes();
      Preconditions.checkArgument(scans.length == 1, "Must be Scan Query");
      ScanNode scan = scans[0];
      TableDesc table = subQuery.context.getTableDescMap().get(scan.getCanonicalName());

      Collection<FileFragment> fragments;
      TableMeta meta = table.getMeta();

      // Depending on scanner node's type, it creates fragments. If scan is for
      // a partitioned table, It will creates lots fragments for all partitions.
      // Otherwise, it creates at least one fragments for a table, which may
      // span a number of blocks or possibly consists of a number of files.
      if (scan.getType() == NodeType.PARTITIONS_SCAN) {
        fragments = Repartitioner.getFragmentsFromPartitionedTable(subQuery.getStorageManager(), scan, table);
      } else {
        Path inputPath = table.getPath();
        fragments = subQuery.getStorageManager().getSplits(scan.getCanonicalName(), meta, table.getSchema(), inputPath);
      }

      SubQuery.scheduleFragments(subQuery, fragments);
      if (subQuery.getTaskScheduler() instanceof DefaultTaskScheduler) {
        //Leaf task of DefaultTaskScheduler should be fragment size
View Full Code Here

      for (LogicalPlan.QueryBlock block : plan.getQueryBlocks()) {
        LogicalNode[] scanNodes = PlannerUtil.findAllNodes(block.getRoot(), NodeType.SCAN);
        if (scanNodes != null) {
          for (LogicalNode eachScanNode : scanNodes) {
            ScanNode scanNode = (ScanNode) eachScanNode;
            tableDescMap.put(scanNode.getCanonicalName(), scanNode.getTableDesc());
          }
        }

        scanNodes = PlannerUtil.findAllNodes(block.getRoot(), NodeType.PARTITIONS_SCAN);
        if (scanNodes != null) {
          for (LogicalNode eachScanNode : scanNodes) {
            ScanNode scanNode = (ScanNode) eachScanNode;
            tableDescMap.put(scanNode.getCanonicalName(), scanNode.getTableDesc());
          }
        }
      }
      MasterPlan masterPlan = new MasterPlan(queryId, queryContext, plan);
      queryMasterContext.getGlobalPlanner().build(masterPlan);
View Full Code Here

    this.reporter.startCommunicationThread();

    plan = CoreGsonHelper.fromJson(request.getSerializedData(), LogicalNode.class);
    LogicalNode [] scanNode = PlannerUtil.findAllNodes(plan, NodeType.SCAN);
    for (LogicalNode node : scanNode) {
      ScanNode scan = (ScanNode)node;
      descs.put(scan.getCanonicalName(), scan.getTableDesc());
    }

    interQuery = request.getProto().getInterQuery();
    if (interQuery) {
      context.setInterQuery();
View Full Code Here

    schema.addColumn("id", Type.INT4);
    schema.addColumn("name", Type.TEXT);
    schema.addColumn("age", Type.INT2);
    GroupbyNode groupbyNode = new GroupbyNode(0);
    groupbyNode.setGroupingColumns(new Column[]{schema.getColumn(1), schema.getColumn(2)});
    ScanNode scanNode = new ScanNode(0);
    scanNode.init(CatalogUtil.newTableDesc("in", schema, CatalogUtil.newTableMeta(StoreType.CSV), new Path("in")));

    GroupbyNode groupbyNode2 = new GroupbyNode(0);
    groupbyNode2.setGroupingColumns(new Column[]{schema.getColumn(1), schema.getColumn(2)});
    JoinNode joinNode = new JoinNode(0);
    ScanNode scanNode2 = new ScanNode(0);
    scanNode2.init(CatalogUtil.newTableDesc("in2", schema, CatalogUtil.newTableMeta(StoreType.CSV), new Path("in2")));

    groupbyNode.setChild(scanNode);
    groupbyNode2.setChild(joinNode);
    joinNode.setLeftChild(scanNode);
    joinNode.setRightChild(scanNode2);

    assertTrue(groupbyNode.equals(groupbyNode2));
    assertFalse(groupbyNode.deepEquals(groupbyNode2));

    ScanNode scanNode3 = new ScanNode(0);
    scanNode3.init(CatalogUtil.newTableDesc("in", schema, CatalogUtil.newTableMeta(StoreType.CSV), new Path("in")));
    groupbyNode2.setChild(scanNode3);

    assertTrue(groupbyNode.equals(groupbyNode2));
    assertTrue(groupbyNode.deepEquals(groupbyNode2));
  }
View Full Code Here

TOP

Related Classes of org.apache.tajo.engine.planner.logical.ScanNode

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.