CatalogProtos.PartitionDescProto partitionDescProto = null; if (alterTable.getAlterTableOpType() == AlterTableOpType.RENAME_TABLE || alterTable.getAlterTableOpType() == AlterTableOpType.ADD_PARTITION || alterTable.getAlterTableOpType() == AlterTableOpType.DROP_PARTITION) { desc = catalog.getTableDesc(databaseName, simpleTableName); switch (alterTable.getAlterTableOpType()) { case RENAME_TABLE: if (!catalog.existsTable(databaseName, simpleTableName)) {
CatalogProtos.PartitionDescProto partitionDescProto = null; if (alterTable.getAlterTableOpType() == AlterTableOpType.RENAME_TABLE || alterTable.getAlterTableOpType() == AlterTableOpType.ADD_PARTITION || alterTable.getAlterTableOpType() == AlterTableOpType.DROP_PARTITION) { desc = catalog.getTableDesc(databaseName, simpleTableName); switch (alterTable.getAlterTableOpType()) { case RENAME_TABLE: if (!catalog.existsTable(databaseName, simpleTableName)) {
@Test public final void testAlterTableRepairPartiton() throws TajoException { QueryContext qc = createQueryContext(); String sql = "ALTER TABLE table1 REPAIR PARTITION"; Expr expr = sqlAnalyzer.parse(sql); LogicalPlan rootNode = planner.createPlan(qc, expr); LogicalNode plan = rootNode.getRootBlock().getRoot(); assertEquals(NodeType.ROOT, plan.getType()); LogicalRootNode root = (LogicalRootNode) plan; assertEquals(NodeType.ALTER_TABLE, root.getChild().getType()); AlterTableNode msckNode = root.getChild(); assertEquals(msckNode.getAlterTableOpType(), AlterTableOpType.REPAIR_PARTITION); assertEquals(msckNode.getTableName(), "table1"); }
PlanProto.AlterTableNode.AlterPartition.Builder partitionBuilder = null; switch (node.getAlterTableOpType()) { case RENAME_TABLE: alterTableBuilder.setSetType(PlanProto.AlterTableNode.Type.RENAME_TABLE); default: throw new TajoRuntimeException( new NotImplementedException("Unknown SET type in ALTER TABLE: " + node.getAlterTableOpType().name()));
PlanProto.AlterTableNode.AlterPartition.Builder partitionBuilder = null; switch (node.getAlterTableOpType()) { case RENAME_TABLE: alterTableBuilder.setSetType(PlanProto.AlterTableNode.Type.RENAME_TABLE); default: throw new TajoRuntimeException( new NotImplementedException("Unknown SET type in ALTER TABLE: " + node.getAlterTableOpType().name()));
assertEquals(alterTableNode.getAlterTableOpType(), AlterTableOpType.ADD_PARTITION); assertEquals(alterTableNode.getAlterTableOpType(), AlterTableOpType.DROP_PARTITION);