Impala
Impalaistheopensource,nativeanalyticdatabaseforApacheHadoop.
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
hbase-table-sink.h
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 #ifndef IMPALA_EXEC_HBASE_TABLE_SINK_H
16 #define IMPALA_EXEC_HBASE_TABLE_SINK_H
17 
18 #include <vector>
19 
20 #include "common/status.h"
21 #include "runtime/runtime-state.h"
22 #include "runtime/row-batch.h"
23 #include "runtime/descriptors.h"
24 #include "exec/data-sink.h"
26 #include "gen-cpp/Data_types.h"
27 #include "gen-cpp/Exprs_types.h"
28 
29 namespace impala {
30 
33 class HBaseTableSink : public DataSink {
34  public:
36  const std::vector<TExpr>& select_list_texprs,
37  const TDataSink& tsink);
38  virtual Status Prepare(RuntimeState* state);
39  virtual Status Open(RuntimeState* state);
40  virtual Status Send(RuntimeState* state, RowBatch* batch, bool eos);
41  virtual void Close(RuntimeState* state);
42  virtual RuntimeProfile* profile() { return runtime_profile_; }
43 
44  private:
47 
50 
53 
57  boost::scoped_ptr<HBaseTableWriter> hbase_table_writer_;
58 
61 
63  const std::vector<TExpr>& select_list_texprs_;
64  std::vector<ExprContext*> output_expr_ctxs_;
65 
68 };
69 
70 } // namespace impala
71 
72 #endif // IMPALA_EXEC_HBASE_TABLE_SINK_H
int TableId
Definition: global-types.h:25
boost::scoped_ptr< HBaseTableWriter > hbase_table_writer_
HBaseTableSink(const RowDescriptor &row_desc, const std::vector< TExpr > &select_list_texprs, const TDataSink &tsink)
TableId table_id_
Used to get the HBaseTableDescriptor from the RuntimeState.
Superclass of all data sinks.
Definition: data-sink.h:39
const RowDescriptor & row_desc_
Owned by the RuntimeState.
virtual Status Prepare(RuntimeState *state)
virtual Status Open(RuntimeState *state)
Call before Send() or Close().
virtual RuntimeProfile * profile()
Returns the runtime profile for the sink.
const RowDescriptor & row_desc() const
const std::vector< TExpr > & select_list_texprs_
Owned by the RuntimeState.
HBaseTableDescriptor * table_desc_
The description of the table. Used for table name and column mapping.
std::vector< ExprContext * > output_expr_ctxs_
Status PrepareExprs(RuntimeState *state)
Turn thrift TExpr into Expr and prepare them to run.
RuntimeProfile * runtime_profile_
Allocated from runtime state's pool.
virtual void Close(RuntimeState *state)
virtual Status Send(RuntimeState *state, RowBatch *batch, bool eos)