Impala
Impalaistheopensource,nativeanalyticdatabaseforApacheHadoop.
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
hbase-scan-node.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 
16 #ifndef IMPALA_EXEC_HBASE_SCAN_NODE_H_
17 #define IMPALA_EXEC_HBASE_SCAN_NODE_H_
18 
19 #include <boost/scoped_ptr.hpp>
20 #include "runtime/descriptors.h"
22 #include "exec/scan-node.h"
23 
24 namespace impala {
25 
26 class TextConverter;
27 class Tuple;
28 
29 class HBaseScanNode : public ScanNode {
30  public:
31  HBaseScanNode(ObjectPool* pool, const TPlanNode& tnode, const DescriptorTbl& descs);
32 
34 
37  virtual Status Prepare(RuntimeState* state);
38 
40  virtual Status Open(RuntimeState* state);
41 
44  virtual Status GetNext(RuntimeState* state, RowBatch* row_batch, bool* eos);
45 
47  virtual Status Reset(RuntimeState* state);
48 
50  virtual void Close(RuntimeState* state);
51 
52  const int suggested_max_caching() const { return suggested_max_caching_; }
53 
54  protected:
56  virtual void DebugString(int indentation_level, std::stringstream* out) const;
57 
58  private:
59  const static int SKIP_COLUMN = -1;
61  const static int ROW_KEY = 0;
62 
64  static bool CmpColPos(const SlotDescriptor* a, const SlotDescriptor* b);
65 
67  const std::string table_name_;
68 
71 
74 
77 
80 
82  std::vector<THBaseFilter> filters_;
83 
86 
88  boost::scoped_ptr<MemPool> tuple_pool_;
89 
91  boost::scoped_ptr<HBaseTableScanner> hbase_scanner_;
92 
94  std::vector<SlotDescriptor*> sorted_non_key_slots_;
95 
100  std::vector<const HBaseTableDescriptor::HBaseColumnDescriptor* > sorted_cols_;
101 
105 
108 
111 
114 
116  boost::scoped_ptr<TextConverter> text_converter_;
117 
121 
124  void WriteTextSlot(
125  const std::string& family, const std::string& qualifier,
126  void* value, int value_length, SlotDescriptor* slot,
127  RuntimeState* state, bool* error_in_row);
128 };
129 
130 }
131 
132 #endif
virtual Status Prepare(RuntimeState *state)
virtual Status GetNext(RuntimeState *state, RowBatch *row_batch, bool *eos)
A tuple with 0 materialised slots is represented as NULL.
Definition: tuple.h:48
int tuple_idx_
Tuple index in tuple row.
int TupleId
Definition: global-types.h:23
std::vector< THBaseFilter > filters_
HBase Filters to be set in HBaseTableScanner.
int num_errors_
Counts the total number of conversion errors for this table.
virtual Status Open(RuntimeState *state)
Start HBase scan using hbase_scanner_.
std::vector< const HBaseTableDescriptor::HBaseColumnDescriptor * > sorted_cols_
TupleId tuple_id_
Tuple id resolved in Prepare() to set tuple_desc_;.
HBaseScanNode(ObjectPool *pool, const TPlanNode &tnode, const DescriptorTbl &descs)
std::string DebugString() const
Returns a string representation in DFS order of the plan rooted at this.
Definition: exec-node.cc:345
void WriteTextSlot(const std::string &family, const std::string &qualifier, void *value, int value_length, SlotDescriptor *slot, RuntimeState *state, bool *error_in_row)
Tuple * tuple_
Current tuple.
SlotDescriptor * row_key_slot_
int tuple_buffer_size_
Size of tuple buffer determined by size of tuples and capacity of row batches.
boost::scoped_ptr< MemPool > tuple_pool_
Pool for allocating tuple data, including all varying-length slots.
ObjectPool pool
virtual Status Reset(RuntimeState *state)
NYI.
HBaseTableScanner::ScanRangeVector scan_range_vector_
scan ranges of a region server
Abstract base class of all scan nodes; introduces SetScanRange().
Definition: scan-node.h:77
static bool CmpColPos(const SlotDescriptor *a, const SlotDescriptor *b)
Compare two slots based on their column position, to sort them ascending.
std::vector< ScanRange > ScanRangeVector
boost::scoped_ptr< HBaseTableScanner > hbase_scanner_
Jni helper for scanning an HBase table.
bool row_key_binary_encoded_
True, if row key is binary encoded.
static const int ROW_KEY
Column 0 in the Impala metadata refers to the HBasw row key.
std::vector< SlotDescriptor * > sorted_non_key_slots_
List of non-row-key slots sorted by col_pos(). Populated in Prepare().
const std::string table_name_
Name of HBase table (not necessarily the table name mapped to Hive).
const int suggested_max_caching() const
boost::scoped_ptr< TextConverter > text_converter_
Helper class for converting text to other types;.
const TupleDescriptor * tuple_desc_
Descriptor of tuples read from HBase table.
virtual void Close(RuntimeState *state)
Close the hbase_scanner_, and report errors.
static const int SKIP_COLUMN