Examples of CatalogService


Examples of org.apache.tajo.catalog.CatalogService

  public final void testInsertOverwriteSmallerColumns() throws Exception {
    String tableName = "insertoverwritesmallercolumns";
    ResultSet res = tpch.execute("create table " + tableName + " (col1 int8, col2 int4, col3 float4)");
    res.close();
    TajoTestingCluster cluster = tpch.getTestingCluster();
    CatalogService catalog = cluster.getMaster().getCatalog();
    assertTrue(catalog.existsTable(tableName));
    TableDesc originalDesc = catalog.getTableDesc(tableName);

    res = tpch.execute("insert overwrite into " + tableName + " select l_orderkey from lineitem");
    res.close();
    TableDesc desc = catalog.getTableDesc(tableName);
    assertEquals(5, desc.getMeta().getStat().getNumRows().intValue());
    assertEquals(originalDesc.getMeta().getSchema(), desc.getMeta().getSchema());
  }
View Full Code Here

Examples of org.apache.tajo.catalog.CatalogService

  public final void testInsertOverwriteWithTargetColumns() throws Exception {
    String tableName = "InsertOverwriteWithTargetColumns";
    ResultSet res = tpch.execute("create table " + tableName + " (col1 int8, col2 int4, col3 float4)");
    res.close();
    TajoTestingCluster cluster = tpch.getTestingCluster();
    CatalogService catalog = cluster.getMaster().getCatalog();
    assertTrue(catalog.existsTable(tableName));
    TableDesc originalDesc = catalog.getTableDesc(tableName);

    res = tpch.execute("insert overwrite into " + tableName
        + " (col1, col3) select l_orderkey, l_quantity from lineitem");
    res.close();
    TableDesc desc = catalog.getTableDesc(tableName);
    assertEquals(5, desc.getMeta().getStat().getNumRows().intValue());

    res = tpch.execute("select * from " + tableName);
    assertTrue(res.next());
    assertEquals(1, res.getLong(1));
View Full Code Here

Examples of org.apache.tajo.catalog.CatalogService

  public final void testInsertOverwriteWithAsterisk() throws Exception {
    String tableName = "testinsertoverwritewithasterisk";
    ResultSet res = tpch.execute("create table " + tableName + " as select * from lineitem");
    res.close();
    TajoTestingCluster cluster = tpch.getTestingCluster();
    CatalogService catalog = cluster.getMaster().getCatalog();
    assertTrue(catalog.existsTable(tableName));

    res = tpch.execute("insert overwrite into " + tableName + " select * from lineitem where l_orderkey = 3");
    res.close();
    TableDesc desc = catalog.getTableDesc(tableName);
    assertEquals(2, desc.getMeta().getStat().getNumRows().intValue());
  }
View Full Code Here

Examples of org.apache.tajo.catalog.CatalogService

        "create table " + tableName + " as select l_orderkey from lineitem");
    assertFalse(res.next());
    res.close();

    TajoTestingCluster cluster = tpch.getTestingCluster();
    CatalogService catalog = cluster.getMaster().getCatalog();
    assertTrue(catalog.existsTable(tableName));
    TableDesc orderKeys = catalog.getTableDesc(tableName);
    assertEquals(5, orderKeys.getMeta().getStat().getNumRows().intValue());

    // this query will result in the two rows.
    res = tpch.execute(
        "insert overwrite into " + tableName + " select l_orderkey from lineitem where l_orderkey = 3");
    assertFalse(res.next());
    res.close();

    assertTrue(catalog.existsTable(tableName));
    orderKeys = catalog.getTableDesc(tableName);
    assertEquals(2, orderKeys.getMeta().getStat().getNumRows().intValue());
  }
View Full Code Here

Examples of org.apache.tajo.catalog.CatalogService

  public final void testInsertOverwriteCapitalTableName() throws Exception {
    String tableName = "testInsertOverwriteCapitalTableName";
    ResultSet res = tpch.execute("create table " + tableName + " as select * from lineitem");
    res.close();
    TajoTestingCluster cluster = tpch.getTestingCluster();
    CatalogService catalog = cluster.getMaster().getCatalog();
    assertTrue(catalog.existsTable(tableName));

    res = tpch.execute("insert overwrite into " + tableName + " select * from lineitem where l_orderkey = 3");
    res.close();
    TableDesc desc = catalog.getTableDesc(tableName);
    assertEquals(2, desc.getMeta().getStat().getNumRows().intValue());
  }
View Full Code Here

Examples of org.apache.tajo.catalog.CatalogService

  public final void testInsertOverwriteWithCompression() throws Exception {
    String tableName = "testInsertOverwriteWithCompression";
    ResultSet res = tpch.execute("create table " + tableName + " (col1 int8, col2 int4, col3 float4) USING csv WITH ('csvfile.delimiter'='|','compression.codec'='org.apache.hadoop.io.compress.DeflateCodec')");
    res.close();
    TajoTestingCluster cluster = tpch.getTestingCluster();
    CatalogService catalog = cluster.getMaster().getCatalog();
    assertTrue(catalog.existsTable(tableName));

    res = tpch.execute("insert overwrite into " + tableName + " select  l_orderkey, l_partkey, l_quantity from lineitem where l_orderkey = 3");
    res.close();
    TableDesc desc = catalog.getTableDesc(tableName);
    assertEquals(2, desc.getMeta().getStat().getNumRows().intValue());

    FileSystem fs = FileSystem.get(tpch.getTestingCluster().getConfiguration());
    assertTrue(fs.exists(desc.getPath()));
    CompressionCodecFactory factory = new CompressionCodecFactory(tpch.getTestingCluster().getConfiguration());
View Full Code Here

Examples of org.apache.tajo.catalog.CatalogService

  public final void testCreateAfterSelect() throws Exception {
    ResultSet res = tpch.execute(
        "create table orderkeys as select l_orderkey from lineitem");
    res.close();
    TajoTestingCluster cluster = tpch.getTestingCluster();
    CatalogService catalog = cluster.getMaster().getCatalog();
    assertTrue(catalog.existsTable("orderkeys"));
    TableDesc orderKeys = catalog.getTableDesc("orderkeys");
    assertEquals(5, orderKeys.getMeta().getStat().getNumRows().intValue());
  }
View Full Code Here

Examples of org.apache.tajo.catalog.CatalogService

      }

      @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);
        TableStats stats = lastStage.getResultStats();

        CreateTableNode createTableNode = (CreateTableNode) lastStage.getBlock().getPlan();
        TableMeta meta = new TableMeta(createTableNode.getStorageType(), createTableNode.getOptions());

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

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

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

        catalog.createTable(tableDescTobeCreated);
      }
View Full Code Here

Examples of org.apache.tajo.catalog.CatalogService

      @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.getResultStats();

        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.dropTable(insertNode.getTableName());
          catalog.createTable(finalTable);
        }

        query.setResultDesc(finalTable);
      }
View Full Code Here

Examples of org.apache.tajo.catalog.CatalogService

    try {
      if (query != null) {
        LOG.warn("Query already started");
        return;
      }
      CatalogService catalog = getQueryTaskContext().getQueryMasterContext().getWorkerContext().getCatalog();
      LogicalPlanner planner = new LogicalPlanner(catalog);
      LogicalOptimizer optimizer = new LogicalOptimizer(systemConf);
      Expr expr;
      if (queryContext.isHiveQueryMode()) {
        HiveQLAnalyzer HiveQLAnalyzer = new HiveQLAnalyzer();
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.