Beispiel #1
0
  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);
  }
Beispiel #2
0
  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);
  }