Updated on 2024-11-28 GMT+08:00

Deleting a Table

Function Description

Delete the replica table and distributed table created in the new table.

Statement 1: Use drop table to delete a local table from the cluster.

Statement 2: Use drop table to delete a distributed table from the cluster.

Sample Code

private void dropTable(String databaseName, String tableName, String clusterName) throws Exception {
     String dropLocalTableSql = "drop table if exists " + databaseName + "." + tableName + " on cluster " + clusterName;
     String dropDisTableSql = "drop table if exists " + databaseName + "." + tableName + "_all" + " on cluster " + clusterName;
     ArrayList<String> sqlList = new ArrayList<String>();
     sqlList.add(dropLocalTableSql);
     sqlList.add(dropDisTableSql);
     util.exeSql(sqlList);
 }