public void renameTable(SchemaTableName schemaTableName, SchemaTableName newSchemaTableName) { try { String rawName = schemaEmulation.toRawName(schemaTableName); String newRawName = schemaEmulation.toRawName(newSchemaTableName); AlterTableOptions alterOptions = new AlterTableOptions(); alterOptions.renameTable(newRawName); client.alterTable(rawName, alterOptions); } catch (KuduException e) { throw new PrestoException(GENERIC_INTERNAL_ERROR, e); } }
public void renameTable(SchemaTableName schemaTableName, SchemaTableName newSchemaTableName) { try { String rawName = schemaEmulation.toRawName(schemaTableName); String newRawName = schemaEmulation.toRawName(newSchemaTableName); AlterTableOptions alterOptions = new AlterTableOptions(); alterOptions.renameTable(newRawName); client.alterTable(rawName, alterOptions); } catch (KuduException e) { throw new PrestoException(GENERIC_INTERNAL_ERROR, e); } }
@Override public void renameTable(SchemaTableName schemaTableName, SchemaTableName newSchemaTableName) { try { String rawName = toRawName(schemaTableName); String newRawName = toRawName(newSchemaTableName); AlterTableOptions alterOptions = new AlterTableOptions(); alterOptions.renameTable(newRawName); client.alterTable(rawName, alterOptions); } catch (KuduException e) { throw new PrestoException(GENERIC_INTERNAL_ERROR, e); } }
@Test(timeout = 100000) public void testCreateTableWithConcurrentAlter() throws Exception { // Kick off an asynchronous table creation. Deferred<KuduTable> d = asyncClient.createTable(TABLE_NAME, createManyStringsSchema(), getBasicCreateTableOptions()); // Rename the table that's being created to make sure it doesn't interfere // with the "wait for all tablets to be created" behavior of createTable(). // // We have to retry this in a loop because we might run before the table // actually exists. while (true) { try { client.alterTable(TABLE_NAME, new AlterTableOptions().renameTable("foo")); break; } catch (KuduException e) { if (!e.getStatus().isNotFound()) { throw e; } } } // If createTable() was disrupted by the alterTable(), this will throw. d.join(); }
client.alterTable(tableName, new AlterTableOptions().renameTable(newTableName)); client.alterTable(newTableName, new AlterTableOptions().renameTable(tableName));
try { client.alterTable(tableName, new AlterTableOptions().dropRangePartition(lower, upper) .renameTable("foo")); fail(); } catch (KuduException e) {
upper.addInt("c0", 300); client.alterTable(tableName, new AlterTableOptions().addRangePartition(lower, upper) .renameTable(tableName + "-renamed") .addNullableColumn("c2", Type.INT32)); tableName = tableName + "-renamed";