Example #1
0
      @Override
      public void execute(
          QueryMaster.QueryMasterContext context,
          QueryContext queryContext,
          Query query,
          ExecutionBlockId finalExecBlockId,
          Path finalOutputDir)
          throws Exception {
        CatalogService catalog = context.getWorkerContext().getCatalog();
        SubQuery lastStage = query.getSubQuery(finalExecBlockId);
        TableMeta meta = lastStage.getTableMeta();
        TableStats stats = lastStage.getTableStat();

        CreateTableNode createTableNode = (CreateTableNode) lastStage.getBlock().getPlan();

        TableDesc tableDescTobeCreated =
            new TableDesc(
                createTableNode.getTableName(),
                createTableNode.getTableSchema(),
                meta,
                finalOutputDir);

        if (createTableNode.hasPartition()) {
          tableDescTobeCreated.setPartitionMethod(createTableNode.getPartitionMethod());
        }

        stats.setNumBytes(getTableVolume(query.systemConf, finalOutputDir));
        tableDescTobeCreated.setStats(stats);
        query.setResultDesc(tableDescTobeCreated);

        catalog.addTable(tableDescTobeCreated);
      }
Example #2
0
      @Override
      public void execute(
          QueryMaster.QueryMasterContext context,
          QueryContext queryContext,
          Query query,
          ExecutionBlockId finalExecBlockId,
          Path finalOutputDir)
          throws Exception {
        SubQuery lastStage = query.getSubQuery(finalExecBlockId);
        TableMeta meta = lastStage.getTableMeta();
        TableStats stats = lastStage.getTableStat();

        TableDesc resultTableDesc =
            new TableDesc(query.getId().toString(), lastStage.getSchema(), meta, finalOutputDir);

        stats.setNumBytes(getTableVolume(query.systemConf, finalOutputDir));
        resultTableDesc.setStats(stats);
        query.setResultDesc(resultTableDesc);
      }
Example #3
0
      @Override
      public void execute(
          QueryMaster.QueryMasterContext context,
          QueryContext queryContext,
          Query query,
          ExecutionBlockId finalExecBlockId,
          Path finalOutputDir)
          throws Exception {

        CatalogService catalog = context.getWorkerContext().getCatalog();
        SubQuery lastStage = query.getSubQuery(finalExecBlockId);
        TableMeta meta = lastStage.getTableMeta();
        TableStats stats = lastStage.getTableStat();

        InsertNode insertNode = (InsertNode) lastStage.getBlock().getPlan();

        TableDesc finalTable;
        if (insertNode.hasTargetTable()) {
          String tableName = insertNode.getTableName();
          finalTable = catalog.getTableDesc(tableName);
        } else {
          String tableName = query.getId().toString();
          finalTable = new TableDesc(tableName, lastStage.getSchema(), meta, finalOutputDir);
        }

        long volume = getTableVolume(query.systemConf, finalOutputDir);
        stats.setNumBytes(volume);
        finalTable.setStats(stats);

        if (insertNode.hasTargetTable()) {
          catalog.deleteTable(insertNode.getTableName());
          catalog.addTable(finalTable);
        }

        query.setResultDesc(finalTable);
      }