Examples of CatalogService


Examples of org.apache.tajo.catalog.CatalogService

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

Examples of org.apache.tajo.catalog.CatalogService

    String tableName = CatalogUtil.normalizeIdentifier("testColumnPartitionedTableByThreeColumns");
    ResultSet res = testBase.execute(
        "create table " + tableName + " (col4 text) partition by column(col1 int4, col2 int4, col3 float8) ");
    res.close();
    TajoTestingCluster cluster = testBase.getTestingCluster();
    CatalogService catalog = cluster.getMaster().getCatalog();
    assertTrue(catalog.existsTable(DEFAULT_DATABASE_NAME, tableName));

    res = executeString("insert overwrite into " + tableName
        + " select l_returnflag, l_orderkey, l_partkey, l_quantity from lineitem");
    res.close();

    TableDesc desc = catalog.getTableDesc(DEFAULT_DATABASE_NAME, tableName);
    Path path = desc.getPath();

    FileSystem fs = FileSystem.get(conf);
    assertTrue(fs.isDirectory(path));
    assertTrue(fs.isDirectory(new Path(path.toUri() + "/col1=1")));
View Full Code Here

Examples of org.apache.tajo.catalog.CatalogService

  public final void testCtasWithoutTableDefinition() throws Exception {
    ResultSet res = executeQuery();
    res.close();

    String tableName = CatalogUtil.normalizeIdentifier("testCtasWithoutTableDefinition");
    CatalogService catalog = testBase.getTestingCluster().getMaster().getCatalog();
    String qualifiedTableName = buildFQName(DEFAULT_DATABASE_NAME, tableName);
    TableDesc desc = catalog.getTableDesc(qualifiedTableName);
    assertTrue(catalog.existsTable(qualifiedTableName));

    assertTrue(desc.getSchema().contains("default.testctaswithouttabledefinition.col1"));
    PartitionMethodDesc partitionDesc = desc.getPartitionMethod();
    assertEquals(partitionDesc.getPartitionType(), CatalogProtos.PartitionType.COLUMN);
    assertEquals("key", partitionDesc.getExpressionSchema().getColumns().get(0).getSimpleName());
View Full Code Here

Examples of org.apache.tajo.catalog.CatalogService

    res.close();

    String tableName = CatalogUtil.normalizeIdentifier("testCtasWithColumnedPartition");

    TajoTestingCluster cluster = testBase.getTestingCluster();
    CatalogService catalog = cluster.getMaster().getCatalog();
    TableDesc desc = catalog.getTableDesc(DEFAULT_DATABASE_NAME, tableName);
    assertTrue(catalog.existsTable(DEFAULT_DATABASE_NAME, tableName));
    PartitionMethodDesc partitionDesc = desc.getPartitionMethod();
    assertEquals(partitionDesc.getPartitionType(), CatalogProtos.PartitionType.COLUMN);
    assertEquals("key", partitionDesc.getExpressionSchema().getColumns().get(0).getSimpleName());

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

Examples of org.apache.tajo.catalog.CatalogService

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

    res = tpch.execute("insert overwrite into " + tableName
        + " select l_orderkey, l_partkey, l_quantity from lineitem");
    res.close();

    TableDesc desc = catalog.getTableDesc(DEFAULT_DATABASE_NAME, tableName);
    if (!cluster.isHCatalogStoreRunning()) {
      assertEquals(5, desc.getStats().getNumRows().intValue());
    }
  }
View Full Code Here

Examples of org.apache.tajo.catalog.CatalogService

  public final void testInsertOverwriteSmallerColumns() throws Exception {
    String tableName = CatalogUtil.normalizeIdentifier("insertoverwritesmallercolumns");
    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 + " select l_orderkey from lineitem");
    res.close();
    TableDesc desc = catalog.getTableDesc(DEFAULT_DATABASE_NAME, tableName);
    if (!cluster.isHCatalogStoreRunning()) {
      assertEquals(5, desc.getStats().getNumRows().intValue());
    }
    assertEquals(originalDesc.getSchema(), desc.getSchema());
  }
View Full Code Here

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

Examples of org.apache.tajo.catalog.CatalogService

  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

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(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

Examples of org.apache.tajo.catalog.CatalogService

  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
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.