Impala
Impalaistheopensource,nativeanalyticdatabaseforApacheHadoop.
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
impala::HBaseTableSink Class Reference

#include <hbase-table-sink.h>

Inheritance diagram for impala::HBaseTableSink:
Collaboration diagram for impala::HBaseTableSink:

Public Member Functions

 HBaseTableSink (const RowDescriptor &row_desc, const std::vector< TExpr > &select_list_texprs, const TDataSink &tsink)
 
virtual Status Prepare (RuntimeState *state)
 
virtual Status Open (RuntimeState *state)
 Call before Send() or Close(). More...
 
virtual Status Send (RuntimeState *state, RowBatch *batch, bool eos)
 
virtual void Close (RuntimeState *state)
 
virtual RuntimeProfileprofile ()
 Returns the runtime profile for the sink. More...
 

Static Public Member Functions

static Status CreateDataSink (ObjectPool *pool, const TDataSink &thrift_sink, const std::vector< TExpr > &output_exprs, const TPlanFragmentExecParams &params, const RowDescriptor &row_desc, boost::scoped_ptr< DataSink > *sink)
 
static void MergeInsertStats (const TInsertStats &src_stats, TInsertStats *dst_stats)
 
static std::string OutputInsertStats (const PartitionStatusMap &stats, const std::string &prefix="")
 Outputs the insert stats contained in the map of insert partition updates to a string. More...
 

Protected Attributes

bool closed_
 
boost::scoped_ptr< MemTrackerexpr_mem_tracker_
 

Private Member Functions

Status PrepareExprs (RuntimeState *state)
 Turn thrift TExpr into Expr and prepare them to run. More...
 

Private Attributes

TableId table_id_
 Used to get the HBaseTableDescriptor from the RuntimeState. More...
 
HBaseTableDescriptortable_desc_
 The description of the table. Used for table name and column mapping. More...
 
boost::scoped_ptr
< HBaseTableWriter
hbase_table_writer_
 
const RowDescriptorrow_desc_
 Owned by the RuntimeState. More...
 
const std::vector< TExpr > & select_list_texprs_
 Owned by the RuntimeState. More...
 
std::vector< ExprContext * > output_expr_ctxs_
 
RuntimeProfileruntime_profile_
 Allocated from runtime state's pool. More...
 

Detailed Description

Class to take row batches and send them to the HBaseTableWriter to eventually be written into an HBase table.

Definition at line 33 of file hbase-table-sink.h.

Constructor & Destructor Documentation

impala::HBaseTableSink::HBaseTableSink ( const RowDescriptor row_desc,
const std::vector< TExpr > &  select_list_texprs,
const TDataSink &  tsink 
)

Member Function Documentation

void impala::HBaseTableSink::Close ( RuntimeState state)
virtual

Releases all resources that were allocated in Prepare()/Send(). Further Send() calls are illegal after calling Close(). It must be okay to call this multiple times. Subsequent calls should be ignored.

Implements impala::DataSink.

Definition at line 95 of file hbase-table-sink.cc.

References SCOPED_TIMER.

Status impala::DataSink::CreateDataSink ( ObjectPool pool,
const TDataSink &  thrift_sink,
const std::vector< TExpr > &  output_exprs,
const TPlanFragmentExecParams &  params,
const RowDescriptor row_desc,
boost::scoped_ptr< DataSink > *  sink 
)
staticinherited

Creates a new data sink from thrift_sink. A pointer to the new sink is written to *sink, and is owned by the caller.

Definition at line 34 of file data-sink.cc.

References impala::Status::OK.

Referenced by impala::PlanFragmentExecutor::Prepare().

void impala::DataSink::MergeInsertStats ( const TInsertStats &  src_stats,
TInsertStats *  dst_stats 
)
staticinherited

Merges one update to the insert stats for a partition. dst_stats will have the combined stats of src_stats and dst_stats after this method returns.

Definition at line 90 of file data-sink.cc.

Referenced by impala::HdfsTableSink::FinalizePartitionFile().

Status impala::HBaseTableSink::Open ( RuntimeState state)
virtual

Call before Send() or Close().

Implements impala::DataSink.

Definition at line 80 of file hbase-table-sink.cc.

string impala::DataSink::OutputInsertStats ( const PartitionStatusMap stats,
const std::string &  prefix = "" 
)
staticinherited

Outputs the insert stats contained in the map of insert partition updates to a string.

Definition at line 103 of file data-sink.cc.

References impala::PrettyPrinter::Print().

Status impala::HBaseTableSink::PrepareExprs ( RuntimeState state)
private

Turn thrift TExpr into Expr and prepare them to run.

Definition at line 41 of file hbase-table-sink.cc.

References impala::RuntimeState::obj_pool(), impala::OK, RETURN_IF_ERROR, and impala::row_desc_.

virtual RuntimeProfile* impala::HBaseTableSink::profile ( )
inlinevirtual

Returns the runtime profile for the sink.

Implements impala::DataSink.

Definition at line 42 of file hbase-table-sink.h.

References runtime_profile_.

Status impala::HBaseTableSink::Send ( RuntimeState state,
RowBatch batch,
bool  eos 
)
virtual

Send a row batch into this sink. eos should be true when the last batch is passed to Send()

Implements impala::DataSink.

Definition at line 84 of file hbase-table-sink.cc.

References impala::RuntimeState::CheckQueryState(), impala::RowBatch::num_rows(), impala::OK, impala::RuntimeState::per_partition_status(), RETURN_IF_ERROR, impala::ROOT_PARTITION_KEY, and SCOPED_TIMER.

Member Data Documentation

bool impala::DataSink::closed_
protectedinherited

Set to true after Close() has been called. Subclasses should check and set this in Close().

Definition at line 83 of file data-sink.h.

Referenced by impala::HdfsTableSink::Close().

boost::scoped_ptr<MemTracker> impala::DataSink::expr_mem_tracker_
protectedinherited

Definition at line 85 of file data-sink.h.

Referenced by impala::DataSink::Prepare(), and impala::HdfsTableSink::PrepareExprs().

boost::scoped_ptr<HBaseTableWriter> impala::HBaseTableSink::hbase_table_writer_
private

The object that this sink uses to write to hbase. hbase_table_writer is owned by this sink and should be closed when this is Close'd.

Definition at line 57 of file hbase-table-sink.h.

std::vector<ExprContext*> impala::HBaseTableSink::output_expr_ctxs_
private

Definition at line 64 of file hbase-table-sink.h.

const RowDescriptor& impala::HBaseTableSink::row_desc_
private

Owned by the RuntimeState.

Definition at line 60 of file hbase-table-sink.h.

RuntimeProfile* impala::HBaseTableSink::runtime_profile_
private

Allocated from runtime state's pool.

Definition at line 67 of file hbase-table-sink.h.

Referenced by profile().

const std::vector<TExpr>& impala::HBaseTableSink::select_list_texprs_
private

Owned by the RuntimeState.

Definition at line 63 of file hbase-table-sink.h.

HBaseTableDescriptor* impala::HBaseTableSink::table_desc_
private

The description of the table. Used for table name and column mapping.

Definition at line 52 of file hbase-table-sink.h.

TableId impala::HBaseTableSink::table_id_
private

Used to get the HBaseTableDescriptor from the RuntimeState.

Definition at line 49 of file hbase-table-sink.h.


The documentation for this class was generated from the following files: