コード例 #1
0
ファイル: TestCatalog.java プロジェクト: dongjinleekr/tajo
  private void testDropPartition(String tableName, String partitionName) throws Exception {
    AlterTableDesc alterTableDesc = new AlterTableDesc();
    alterTableDesc.setTableName(tableName);
    alterTableDesc.setAlterTableType(AlterTableType.DROP_PARTITION);

    PartitionDesc partitionDesc = new PartitionDesc();
    partitionDesc.setPartitionName(partitionName);

    alterTableDesc.setPartitionDesc(partitionDesc);

    catalog.alterTable(alterTableDesc);
  }
コード例 #2
0
ファイル: TestCatalog.java プロジェクト: dongjinleekr/tajo
  private void testAddPartition(String tableName, String partitionName) throws Exception {
    AlterTableDesc alterTableDesc = new AlterTableDesc();
    alterTableDesc.setTableName(tableName);
    alterTableDesc.setAlterTableType(AlterTableType.ADD_PARTITION);

    alterTableDesc.setPartitionDesc(CatalogTestingUtil.buildPartitionDesc(partitionName));

    catalog.alterTable(alterTableDesc);

    String[] split = IdentifierUtil.splitFQTableName(tableName);

    CatalogProtos.PartitionDescProto resultDesc =
        catalog.getPartition(split[0], split[1], partitionName);

    assertNotNull(resultDesc);
    assertEquals(resultDesc.getPartitionName(), partitionName);
    assertEquals(resultDesc.getPath(), "hdfs://xxx.com/warehouse/" + partitionName);

    assertEquals(resultDesc.getPartitionKeysCount(), 2);
  }