Package org.apache.tajo.catalog

Examples of org.apache.tajo.catalog.TableMeta


    schema.addColumn("file", Type.TEXT);
    schema.addColumn("name", Type.TEXT);
    schema.addColumn("age", Type.INT8);
   
    Options options = new Options();
    TableMeta meta = CatalogUtil.newTableMeta(schema, storeType, options);

    Path table1Path = new Path(testDir, storeType + "_1.data");
    Appender appender1 = StorageManagerFactory.getStorageManager(conf).getAppender(meta, table1Path);
    appender1.enableStats();
    appender1.init();
View Full Code Here


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

    TableMeta meta = CatalogUtil.newTableMeta(schema, StoreType.CSV);
   
    Tuple[] tuples = new Tuple[4];
    for(int i=0; i < tuples.length; i++) {
      tuples[i] = new VTuple(3);
      tuples[i].put(new Datum[] {
View Full Code Here

    if (splitable) {
      Schema schema = new Schema();
      schema.addColumn("id", Type.INT4);
      schema.addColumn("age", Type.INT8);

      TableMeta meta = CatalogUtil.newTableMeta(schema, storeType);
      Path tablePath = new Path(testDir, "Splitable.data");
      Appender appender = StorageManagerFactory.getStorageManager(conf).getAppender(meta, tablePath);
      appender.enableStats();
      appender.init();
      int tupleNum = 10000;
View Full Code Here

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

    TableMeta meta = CatalogUtil.newTableMeta(schema, storeType);

    Path tablePath = new Path(testDir, "testProjection.data");
    Appender appender = StorageManagerFactory.getStorageManager(conf).getAppender(meta, tablePath);
    appender.init();
    int tupleNum = 10000;
View Full Code Here

    schema.addColumn("col10", Type.BLOB);
    schema.addColumn("col11", Type.INET4);
    schema.addColumn("col12", Type.NULL);

    Options options = new Options();
    TableMeta meta = CatalogUtil.newTableMeta(schema, storeType, options);

    Path tablePath = new Path(testDir, "testVariousTypes.data");
    Appender appender = StorageManagerFactory.getStorageManager(conf).getAppender(meta, tablePath);
    appender.init();
View Full Code Here

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

    TableMeta meta = CatalogUtil.newTableMeta(schema, CatalogProtos.StoreType.CSV);
    meta.putOption("compression.codec", BZip2Codec.class.getCanonicalName());

    Path tablePath = new Path(testDir, "SplitCompression");
    Appender appender = StorageManagerFactory.getStorageManager(conf).getAppender(meta, tablePath);
    appender.enableStats();
View Full Code Here

  private void storageCompressionTest(CatalogProtos.StoreType storeType, Class<? extends CompressionCodec> codec) throws IOException {
    Schema schema = new Schema();
    schema.addColumn("id", TajoDataTypes.Type.INT4);
    schema.addColumn("age", TajoDataTypes.Type.INT8);

    TableMeta meta = CatalogUtil.newTableMeta(schema, storeType);
    meta.putOption("compression.codec", codec.getCanonicalName());

    String fileName = "Compression_" + codec.getSimpleName();
    Path tablePath = new Path(testDir, fileName);
    Appender appender = StorageManagerFactory.getStorageManager(conf).getAppender(meta, tablePath);
    appender.enableStats();
View Full Code Here

        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

    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

    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

TOP

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

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.