Package org.apache.tajo.catalog

Examples of org.apache.tajo.catalog.TableDesc


              + ", response time: " + (((float)(status.getFinishTime() - status.getSubmitTime()) / 1000.0)
              + " sec"));
          if (status.hasResult()) {
            ClientProtos.GetQueryResultResponse response = client.getResultResponse(queryId);
            ResultSet res = TajoClient.createResultSet(client, queryId, response);
            TableDesc desc = new TableDesc(response.getTableDesc());
            long totalRowNum = desc.getStats().getNumRows();
            long totalBytes = desc.getStats().getNumBytes();
            printResult(res, totalRowNum, totalBytes);
          } else {
            sout.println("OK");
          }
        }
View Full Code Here


  }

  @Override
  public void invoke(String[] cmd) throws Exception {
    if (cmd.length == 2) {
      TableDesc desc = client.getTableDesc(cmd[1]);
      if (desc == null) {
        context.getOutput().println("Did not find any relation named \"" + cmd[1] + "\"");
      } else {
        context.getOutput().println(toFormattedString(desc));
      }
View Full Code Here

      throws ServiceException, IOException {
      if (queryId.equals(QueryIdFactory.NULL_QUERY_ID)) {
        return createNullResultSet(queryId);
      }

    TableDesc tableDesc = getResultDesc(queryId);
    return new ResultSetImpl(this, queryId, conf, tableDesc);
  }
View Full Code Here

                sout.println("OK");
                return;
              }

              ResultSetMetaData rsmd = res.getMetaData();
              TableDesc desc = client.getResultDesc(queryId);
              TableStat stat = desc.getMeta().getStat();
              String volume = FileUtil.humanReadableByteCount(stat.getNumBytes(), false);
              long resultRows = stat.getNumRows();
              sout.println("result: " + desc.getPath() + ", " + resultRows + " rows (" + volume + ")");

              int numOfColumns = rsmd.getColumnCount();
              for (int i = 1; i <= numOfColumns; i++) {
                if (i > 1) sout.print(",  ");
                String columnName = rsmd.getColumnName(i);
View Full Code Here

    assertFalse(client.existTable(tableName1));

    client.createExternalTable("table3", tablePath, BackendTestingUtil.mockupMeta);
    assertTrue(client.existTable(tableName1));

    TableDesc desc = client.getTableDesc(tableName1);
    assertNotNull(desc);
    assertEquals(tableName1, desc.getName());
    assertTrue(desc.getMeta().getStat().getNumBytes() > 0);
  }
View Full Code Here

    }

    @Override
    public void invoke(String[] cmd) throws Exception {
      if (cmd.length == 2) {
        TableDesc desc = client.getTableDesc(cmd[1]);
        if (desc == null) {
          sout.println("Did not find any relation named \"" + cmd[1] + "\"");
        } else {
          sout.println(toFormattedString(desc));
        }
View Full Code Here

          if (status.getState() == TajoProtos.QueryState.QUERY_SUCCEEDED) {
            if (status.hasResult()) {
              ResultSet res = tajoClient.getQueryResult(tajoQueryId);
              try {
                ResultSetMetaData rsmd = res.getMetaData();
                TableDesc desc = tajoClient.getResultDesc(tajoQueryId);
                LOG.info("Tajo Query Result: " + desc.getPath() + "\n");

                int numOfColumns = rsmd.getColumnCount();
                for(int i = 0; i < numOfColumns; i++) {
                  columnNames.add(rsmd.getColumnName(i + 1));
                }
View Full Code Here

        } else { // Finish a query
          if (query.checkQueryForCompleted() == QueryState.QUERY_SUCCEEDED) {
            DataChannel finalChannel = masterPlan.getChannel(castEvent.getExecutionBlockId(), nextBlock.getId());
            Path finalOutputDir = commitOutputData(query);
            TableDesc finalTableDesc = buildOrUpdateResultTableDesc(query, castEvent.getExecutionBlockId(), finalOutputDir);

            QueryContext queryContext = query.context.getQueryContext();
            CatalogService catalog = query.context.getQueryMasterContext().getWorkerContext().getCatalog();

            if (queryContext.hasOutputTable()) { // TRUE only if a query command is 'CREATE TABLE' OR 'INSERT INTO'
View Full Code Here

        if(meta.getStat() == null) meta.setStat(new TableStat());
        meta.getStat().setNumBytes(directorySummary.getLength());
      } catch (IOException e) {
        LOG.error(e.getMessage(), e);
      }
      TableDesc outputTableDesc = new TableDescImpl(outputTableName, meta, finalOutputDir);
      TableDesc finalTableDesc = outputTableDesc;

      // If a query has a target table, a TableDesc is updated.
      if (queryContext.hasOutputTable()) { // CREATE TABLE or INSERT STATEMENT
        if (queryContext.isOutputOverwrite()) {
          CatalogService catalog = query.context.getQueryMasterContext().getWorkerContext().getCatalog();
          Preconditions.checkNotNull(catalog, "CatalogService is NULL");
          TableDesc updatingTable = catalog.getTableDesc(outputTableDesc.getName());
          updatingTable.getMeta().setStat(meta.getStat());
          finalTableDesc = updatingTable;
        }
      }
      return finalTableDesc;
    }
View Full Code Here

      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;
View Full Code Here

TOP

Related Classes of org.apache.tajo.catalog.TableDesc

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.