Examples of TableMeta


Examples of org.apache.tajo.catalog.TableMeta

        outputTableName = queryContext.getOutputTable();
      } else { // SELECT STATEMENT
        outputTableName = query.getId().toString();
      }

      TableMeta meta = subQuery.getTableMeta();
      try {
        FileSystem fs = finalOutputDir.getFileSystem(query.systemConf);
        ContentSummary directorySummary = fs.getContentSummary(finalOutputDir);
        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

Examples of org.apache.tajo.catalog.TableMeta

    private static QueryUnit [] createLeafTasks(SubQuery subQuery) throws IOException {
      ExecutionBlock execBlock = subQuery.getBlock();
      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();
View Full Code Here

Examples of org.apache.tajo.catalog.TableMeta

    Schema schema = new Schema();
    schema.addColumn("id", Type.INT4);
    schema.addColumn("age", Type.INT8);
    schema.addColumn("description", Type.TEXT);

    TableMeta meta = CatalogUtil.newTableMeta(schema, StoreType.ROWFILE);

    AbstractStorageManager sm = StorageManagerFactory.getStorageManager(conf, new Path(conf.getVar(ConfVars.ROOT_DIR)));

    Path tablePath = new Path("/test");
    Path metaPath = new Path(tablePath, ".meta");
    Path dataPath = new Path(tablePath, "test.tbl");
    FileSystem fs = sm.getFileSystem();
    fs.mkdirs(tablePath);

    FileUtil.writeProto(fs, metaPath, meta.getProto());

    Appender appender = StorageManagerFactory.getStorageManager(conf).getAppender(meta, dataPath);
    appender.enableStats();
    appender.init();
View Full Code Here

Examples of org.apache.tajo.catalog.TableMeta

  }

  public void init() throws IOException {
    super.init();

    TableMeta meta;
    if (plan.hasOptions()) {
      meta = CatalogUtil.newTableMeta(outSchema, plan.getStorageType(), plan.getOptions());
    } else {
      meta = CatalogUtil.newTableMeta(outSchema, plan.getStorageType());
    }
View Full Code Here

Examples of org.apache.tajo.catalog.TableMeta

    return appender;
  }


  public TableMeta getTableMeta(Path tablePath) throws IOException {
    TableMeta meta;

    FileSystem fs = tablePath.getFileSystem(conf);
    Path tableMetaPath = new Path(tablePath, ".meta");
    if (!fs.exists(tableMetaPath)) {
      throw new FileNotFoundException(".meta file not found in " + tablePath.toString());
View Full Code Here

Examples of org.apache.tajo.catalog.TableMeta

    return split(tableName, tablePath, fragmentSize);
  }

  public Fragment[] splitBroadcastTable(Path tablePath) throws IOException {
    FileSystem fs = tablePath.getFileSystem(conf);
    TableMeta meta = getTableMeta(tablePath);
    List<Fragment> listTablets = new ArrayList<Fragment>();
    Fragment tablet;

    FileStatus[] fileLists = fs.listStatus(tablePath);
    for (FileStatus file : fileLists) {
View Full Code Here

Examples of org.apache.tajo.catalog.TableMeta

  private Fragment[] split(String tableName, Path tablePath, long size)
      throws IOException {
    FileSystem fs = tablePath.getFileSystem(conf);

    TableMeta meta = getTableMeta(tablePath);
    long defaultBlockSize = size;
    List<Fragment> listTablets = new ArrayList<Fragment>();
    Fragment tablet;

    FileStatus[] fileLists = fs.listStatus(tablePath);
View Full Code Here

Examples of org.apache.tajo.catalog.TableMeta

    catalog = util.getMiniCatalogCluster().getCatalog();
    TPCH tpch = new TPCH();
    tpch.loadSchemas();
    tpch.loadOutSchema();
    for (String table : tpch.getTableNames()) {
      TableMeta m = CatalogUtil.newTableMeta(tpch.getSchema(table), CatalogProtos.StoreType.CSV);
      m.setStat(new TableStat());
      TableDesc d = CatalogUtil.newTableDesc(table, m, CommonTestingUtil.getTestDir());
      catalog.addTable(d);
    }

    analyzer = new SQLAnalyzer();
View Full Code Here

Examples of org.apache.tajo.catalog.TableMeta

    loadTable(PARTSUPP) ;
    loadTable(SUPPLIER);
  }

  private void loadTable(String tableName) throws ServiceException {
    TableMeta meta = CatalogUtil.newTableMeta(getSchema(tableName), StoreType.CSV);
    meta.putOption(CSVFile.DELIMITER, "|");
    try {
      tajo.createExternalTable(tableName, new Path(dataDir, tableName), meta);
    } catch (SQLException s) {
      throw new ServiceException(s);
    }
View Full Code Here

Examples of org.apache.tajo.catalog.TableMeta

    return this.plan;
  }

  private void sortAndStoreChunk(int chunkId, List<Tuple> tupleSlots)
      throws IOException {
    TableMeta meta = CatalogUtil.newTableMeta(inSchema, StoreType.RAW);
    Collections.sort(tupleSlots, getComparator());
    // TODO - RawFile requires the local file path.
    // So, I add the scheme 'file:/' to path. But, it should be improved.
    Path localPath = new Path(sortTmpDir + "/0_" + chunkId);
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.