Package org.apache.tajo.catalog

Examples of org.apache.tajo.catalog.CatalogService


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

    res = tpch.execute(
        "insert overwrite into " + tableName + " (col1, col3) select l_orderkey, l_quantity from lineitem");
    res.close();
    TableDesc desc = catalog.getTableDesc(DEFAULT_DATABASE_NAME, tableName);
    if (!cluster.isHCatalogStoreRunning()) {
      assertEquals(5, desc.getStats().getNumRows().intValue());
    }

    res = tpch.execute("select * from " + tableName);
View Full Code Here


  public final void testInsertOverwriteWithAsterisk() throws Exception {
    String tableName = CatalogUtil.normalizeIdentifier("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(DEFAULT_DATABASE_NAME, tableName));

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

        "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(DEFAULT_DATABASE_NAME, tableName));
    TableDesc orderKeys = catalog.getTableDesc(DEFAULT_DATABASE_NAME, tableName);
    if (!cluster.isHCatalogStoreRunning()) {
      assertEquals(5, orderKeys.getStats().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(DEFAULT_DATABASE_NAME, tableName));
    orderKeys = catalog.getTableDesc(DEFAULT_DATABASE_NAME, tableName);
    if (!cluster.isHCatalogStoreRunning()) {
      assertEquals(2, orderKeys.getStats().getNumRows().intValue());
    }
  }
View Full Code Here

  public final void testInsertOverwriteCapitalTableName() throws Exception {
    String tableName = CatalogUtil.normalizeIdentifier("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(DEFAULT_DATABASE_NAME, tableName));

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

  public final void testInsertOverwriteWithCompression() throws Exception {
    String tableName = CatalogUtil.normalizeIdentifier("testInsertOverwriteWithCompression");
    ResultSet res = tpch.execute("create table " + tableName + " (col1 int4, col2 int4, col3 float8) 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(DEFAULT_DATABASE_NAME, 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(DEFAULT_DATABASE_NAME, tableName);
    if (!cluster.isHCatalogStoreRunning()) {
      assertEquals(2, desc.getStats().getNumRows().intValue());
    }

    FileSystem fs = FileSystem.get(tpch.getTestingCluster().getConfiguration());
View Full Code Here

TOP

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

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.