Impala
Impalaistheopensource,nativeanalyticdatabaseforApacheHadoop.
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
HBaseTableSink.java
Go to the documentation of this file.
1 // Copyright 2012 Cloudera Inc.
2 //
3 // Licensed under the Apache License, Version 2.0 (the "License");
4 // you may not use this file except in compliance with the License.
5 // You may obtain a copy of the License at
6 //
7 // http://www.apache.org/licenses/LICENSE-2.0
8 //
9 // Unless required by applicable law or agreed to in writing, software
10 // distributed under the License is distributed on an "AS IS" BASIS,
11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 // See the License for the specific language governing permissions and
13 // limitations under the License.
14 
15 
16 package com.cloudera.impala.planner;
17 
20 import com.cloudera.impala.thrift.TDataSink;
21 import com.cloudera.impala.thrift.TDataSinkType;
22 import com.cloudera.impala.thrift.TExplainLevel;
23 import com.cloudera.impala.thrift.TTableSink;
24 import com.cloudera.impala.thrift.TTableSinkType;
25 
30 public class HBaseTableSink extends TableSink {
31  public HBaseTableSink(Table targetTable) {
32  super(targetTable);
33  }
34 
35  @Override
36  public String getExplainString(String prefix, String detailPrefix,
37  TExplainLevel explainLevel) {
38  StringBuilder output = new StringBuilder();
39  output.append(prefix + "WRITE TO HBASE table=" + targetTable_.getFullName() + "\n");
40  if (explainLevel.ordinal() >= TExplainLevel.EXTENDED.ordinal()) {
41  output.append(PrintUtils.printHosts(detailPrefix, fragment_.getNumNodes()));
42  output.append(PrintUtils.printMemCost(" ", perHostMemCost_));
43  output.append("\n");
44  }
45  return output.toString();
46  }
47 
48  @Override
49  protected TDataSink toThrift() {
50  TDataSink result = new TDataSink(TDataSinkType.TABLE_SINK);
51  TTableSink tTableSink =
52  new TTableSink(targetTable_.getId().asInt(), TTableSinkType.HBASE);
53  result.table_sink = tTableSink;
54  return result;
55  }
56 }
String getExplainString(String prefix, String detailPrefix, TExplainLevel explainLevel)