private AlterTableDesc createMockAlterTableSetProperty(String newTimeZone) { AlterTableDesc alterTableDesc = new AlterTableDesc(); alterTableDesc.setTableName("default.mynewcooltable"); alterTableDesc.setProperty("timezone", newTimeZone); alterTableDesc.setAlterTableType(AlterTableType.SET_PROPERTY); return alterTableDesc; }
private AlterTableDesc createMockAlterTableUnsetProperty(Set<String> keys) { AlterTableDesc alterTableDesc = new AlterTableDesc(); alterTableDesc.setTableName("default.mynewcooltable"); alterTableDesc.setUnsetPropertyKey(keys); alterTableDesc.setAlterTableType(AlterTableType.UNSET_PROPERTY); return alterTableDesc; }
private AlterTableDesc createMockAlterTableAddColumn() { AlterTableDesc alterTableDesc = new AlterTableDesc(); alterTableDesc.setTableName("default.mynewcooltable"); alterTableDesc.setAddColumn(new Column("mynewcol", Type.TEXT)); alterTableDesc.setAlterTableType(AlterTableType.ADD_COLUMN); return alterTableDesc; }
private AlterTableDesc createMockAlterTableName() { AlterTableDesc alterTableDesc = new AlterTableDesc(); alterTableDesc.setTableName("default.mycooltable"); alterTableDesc.setNewTableName("mynewcooltable"); alterTableDesc.setAlterTableType(AlterTableType.RENAME_TABLE); return alterTableDesc; }
private AlterTableDesc createMockAlterTableRenameColumn() { AlterTableDesc alterTableDesc = new AlterTableDesc(); alterTableDesc.setTableName("default.mynewcooltable"); alterTableDesc.setColumnName(FieldName1); alterTableDesc.setNewColumnName("ren" + FieldName1); alterTableDesc.setAlterTableType(AlterTableType.RENAME_COLUMN); return alterTableDesc; }
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); }
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); }