1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21 package org.apache.hadoop.hbase.hbql.statement;
22
23 import org.apache.hadoop.hbase.hbql.client.ExecutionResults;
24 import org.apache.hadoop.hbase.hbql.client.HBqlException;
25 import org.apache.hadoop.hbase.hbql.impl.HConnectionImpl;
26
27 public class DropIndexForTableStatement extends TableStatement implements ConnectionStatement {
28
29 private final String indexName;
30
31 public DropIndexForTableStatement(final StatementPredicate predicate,
32 final String indexName,
33 final String tableName) {
34 super(predicate, tableName);
35 this.indexName = indexName;
36 }
37
38 private String getIndexName() {
39 return this.indexName;
40 }
41
42 protected ExecutionResults execute(final HConnectionImpl conn) throws HBqlException {
43 conn.dropIndexForTable(this.getTableName(), this.getIndexName());
44 return new ExecutionResults("Index " + this.getIndexName() + " dropped for table " + this.getTableName());
45 }
46
47 public static String usage() {
48 return "DROP INDEX index_name ON TABLE table_name [IF bool_expr]";
49 }
50 }