18 #include <boost/foreach.hpp>
28 #include "gen-cpp/PlanNodes_types.h"
32 using namespace impala;
37 table_name_(tnode.hbase_scan_node.table_name),
38 tuple_id_(tnode.hbase_scan_node.tuple_id),
41 filters_(tnode.hbase_scan_node.filters),
45 row_key_binary_encoded_(false),
47 suggested_max_caching_(0) {
48 if (tnode.hbase_scan_node.__isset.suggested_max_caching) {
66 return Status(
"Failed to get tuple descriptor.");
76 for (
int i = 0; i < slots.size(); ++i) {
77 if (!slots[i]->is_materialized())
continue;
78 if (slots[i]->col_pos() ==
ROW_KEY) {
101 <<
"Must call SetScanRanges() before calling Prepare()";
103 DCHECK(params.scan_range.__isset.hbase_key_range);
104 const THBaseKeyRange& key_range = params.scan_range.hbase_key_range;
107 if (key_range.__isset.startKey) {
110 if (key_range.__isset.stopKey) {
130 const string& family,
const string& qualifier,
134 reinterpret_cast<char*>(value), value_length,
true,
false,
tuple_pool_.get())) {
135 *error_in_row =
true;
138 ss <<
"Error converting column " << family
139 <<
":" << qualifier <<
": "
140 <<
"'" << string(reinterpret_cast<char*>(value), value_length) <<
"' TO "
168 bool error_in_row =
false;
172 bool has_next =
false;
195 int row_idx = row_batch->
AddRow();
237 error_in_row =
false;
245 ss <<
"row key: " << string(reinterpret_cast<const char*>(key), key_length);
258 char* new_tuple =
reinterpret_cast<char*
>(
tuple_);
273 DCHECK(
false) <<
"NYI";
295 *out << string(indentation_level * 2,
' ');
298 *out <<
" region(" << i <<
"):";
303 for (
int i = 0; i <
children_.size(); ++i) {
304 children_[i]->DebugString(indentation_level + 1, out);
RuntimeProfile::ThreadCounters * scanner_thread_counters() const
virtual Status Prepare(RuntimeState *state)
const TableDescriptor * table_desc() const
virtual Status GetNext(RuntimeState *state, RowBatch *row_batch, bool *eos)
virtual Status Prepare(RuntimeState *state)
void SetNull(const NullIndicatorOffset &offset)
static bool ColPathLessThan(const SlotDescriptor *a, const SlotDescriptor *b)
int64_t num_rows_returned_
MemTracker * mem_tracker()
std::string ErrorLog()
Returns the error log lines as a string joined with ' '.
boost::scoped_ptr< RuntimeProfile > runtime_profile_
const std::string table_name() const
A tuple with 0 materialised slots is represented as NULL.
int suggested_max_caching_
#define RETURN_IF_ERROR(stmt)
some generally useful macros
RuntimeProfile::Counter * read_timer_
TupleRow * GetRow(int row_idx)
bool LogHasSpace()
Returns true if the error log has not reached max_errors_.
void set_stop_key(const std::string &key)
#define ADD_TIMER(profile, name)
void AcquireData(MemPool *src, bool keep_current)
const std::vector< SlotDescriptor * > & slots() const
static const std::string TOTAL_HBASE_READ_TIMER
static Tuple * Create(int size, MemPool *pool)
initialize individual tuple with data residing in mem pool
HBaseTableFactory * htable_factory()
int tuple_idx_
Tuple index in tuple row.
#define COUNTER_ADD(c, v)
Status ExecDebugAction(TExecNodePhase::type phase, RuntimeState *state)
TupleDescriptor * GetTupleDescriptor(TupleId id) const
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.
void WriteTextSlot(const std::string &family, const std::string &qualifier, void *value, int value_length, SlotDescriptor *slot, RuntimeState *state, bool *error_in_row)
bool LogError(const ErrorMsg &msg)
Tuple * tuple_
Current tuple.
RuntimeProfile::Counter * rows_read_counter_
rows/tuples read from the scanner (including those discarded by EvalConjucts())
const ColumnType & type() const
void ReportFileErrors(const std::string &file_name, int num_errors)
Report that num_errors occurred while parsing file_name.
SlotDescriptor * row_key_slot_
int tuple_buffer_size_
Size of tuple buffer determined by size of tuples and capacity of row batches.
#define RETURN_IF_CANCELLED(state)
boost::scoped_ptr< MemPool > tuple_pool_
Pool for allocating tuple data, including all varying-length slots.
virtual Status Reset(RuntimeState *state)
NYI.
void set_start_key(const std::string &key)
static void StopRateCounter(RuntimeProfile::Counter *counter)
Stops updating the value of 'counter'.
HBaseTableScanner::ScanRangeVector scan_range_vector_
scan ranges of a region server
virtual Status QueryMaintenance(RuntimeState *state)
const DescriptorTbl & desc_tbl() const
Abstract base class of all scan nodes; introduces SetScanRange().
std::vector< ExecNode * > children_
#define COUNTER_SET(c, v)
MemPool * tuple_data_pool()
RuntimeProfile::Counter * rows_returned_counter_
void SetTuple(int tuple_idx, Tuple *tuple)
boost::scoped_ptr< HBaseTableScanner > hbase_scanner_
Jni helper for scanning an HBase table.
RuntimeProfile::Counter * total_throughput_counter() const
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.
#define SCOPED_THREAD_COUNTER_MEASUREMENT(c)
int MaxTupleBufferSize()
Computes the maximum size needed to store tuple data for this row batch.
static bool EvalConjuncts(ExprContext *const *ctxs, int num_ctxs, TupleRow *row)
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).
RuntimeProfile::TimeSeriesCounter * bytes_read_timeseries_counter_
Time series of the bytes_read_counter_.
bool abort_on_error() const
virtual Status Open(RuntimeState *state)
const std::vector< TScanRangeParams > * scan_range_params_
The scan ranges this scan node is responsible for. Not owned.
std::vector< ExprContext * > conjunct_ctxs_
virtual void Close(RuntimeState *state)
boost::scoped_ptr< TextConverter > text_converter_
Helper class for converting text to other types;.
HBase scan range; "" means unbounded.
const TupleDescriptor * tuple_desc_
Descriptor of tuples read from HBase table.
void DebugString(int indentation_level, std::stringstream *out)
Write debug string of this ScanRange into out.
virtual void Close(RuntimeState *state)
Close the hbase_scanner_, and report errors.
JNIEnv * getJNIEnv(void)
C linkage for helper functions in hdfsJniHelper.h.
static void StopTimeSeriesCounter(RuntimeProfile::TimeSeriesCounter *counter)
Stops 'counter' from receiving any more samples.
RuntimeProfile * runtime_profile()
RuntimeProfile::Counter * materialize_tuple_timer() const