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 import java.io.IOException;
28
29 public class FlushTableStatement extends TableStatement {
30
31 public FlushTableStatement(final StatementPredicate predicate, final String tableName) {
32 super(predicate, tableName);
33 }
34
35 protected ExecutionResults execute(final HConnectionImpl conn) throws HBqlException {
36
37 try {
38 conn.getHBaseAdmin().flush(this.getTableName());
39 }
40 catch (IOException e) {
41 throw new HBqlException(e);
42 }
43
44 return new ExecutionResults("Table " + this.getTableName() + " flushed.");
45 }
46
47 public static String usage() {
48 return "FLUSH TABLE table_name [IF bool_expr]";
49 }
50 }