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

Query execution against running impalad process. More...

#include <impalad-query-executor.h>

Collaboration diagram for impala::ImpaladQueryExecutor:

Public Member Functions

 ImpaladQueryExecutor ()
 
 ~ImpaladQueryExecutor ()
 
Status Setup ()
 
Status Exec (const std::string &query_string, std::vector< Apache::Hadoop::Hive::FieldSchema > *col_types)
 
Status Explain (const std::string &query_string, std::string *explain_plan)
 Return the explain plan for the query. More...
 
Status FetchResult (RowBatch **batch)
 
Status FetchResult (std::string *row)
 
Status FetchResult (std::vector< void * > *row)
 
std::string ErrorString () const
 
std::string FileErrors () const
 Returns a string representation of the file_errors_. More...
 
RuntimeProfilequery_profile ()
 Returns the counters for the entire query. More...
 
bool eos ()
 
void setExecOptions (const std::vector< std::string > &exec_options)
 

Private Member Functions

Status Close ()
 call beeswax.close() for current query, if one in progress More...
 

Private Attributes

boost::scoped_ptr
< ThriftClient
< ImpalaServiceClient > > 
client_
 fe service-related More...
 
std::vector< std::string > exec_options_
 Execution options. More...
 
beeswax::QueryHandle query_handle_
 Beeswax query handle and result. More...
 
beeswax::Results query_results_
 
beeswax::QueryExplanation query_explanation_
 
bool query_in_progress_
 
int current_row_
 
bool eos_
 

Detailed Description

Query execution against running impalad process.

Definition at line 38 of file impalad-query-executor.h.

Constructor & Destructor Documentation

impala::ImpaladQueryExecutor::ImpaladQueryExecutor ( )

Definition at line 36 of file impalad-query-executor.cc.

impala::ImpaladQueryExecutor::~ImpaladQueryExecutor ( )

Definition at line 42 of file impalad-query-executor.cc.

References Close().

Member Function Documentation

Status impala::ImpaladQueryExecutor::Close ( )
private

call beeswax.close() for current query, if one in progress

Definition at line 64 of file impalad-query-executor.cc.

References client_, impala::Status::OK, query_handle_, and query_in_progress_.

Referenced by Exec(), impala::FragmentMgr::FragmentExecState::Exec(), and ~ImpaladQueryExecutor().

bool impala::ImpaladQueryExecutor::eos ( )
inline

Definition at line 82 of file impalad-query-executor.h.

References eos_.

string impala::ImpaladQueryExecutor::ErrorString ( ) const

Returns the error log lines in executor_'s runtime state as a string joined with '
'.

Definition at line 139 of file impalad-query-executor.cc.

Status impala::ImpaladQueryExecutor::Exec ( const std::string &  query_string,
std::vector< Apache::Hadoop::Hive::FieldSchema > *  col_types 
)

Start running query. Call this prior to FetchResult(). If 'col_types' is non-NULL, returns the types of the select list items.

Definition at line 77 of file impalad-query-executor.cc.

References client_, Close(), current_row_, exec_options_, impala::Status::OK, query_handle_, query_in_progress_, and query_results_.

Referenced by impala::ExprTest::GetValue(), and impala::ExprTest::TestNonOkStatus().

Status impala::ImpaladQueryExecutor::Explain ( const std::string &  query_string,
std::string *  explain_plan 
)

Return the explain plan for the query.

Definition at line 148 of file impalad-query-executor.cc.

References client_, impala::Status::OK, and query_explanation_.

Status impala::ImpaladQueryExecutor::FetchResult ( RowBatch **  batch)

Returns result batch in 'batch'. The returned rows are the output rows of the execution tree. In other words, they do not reflect the query's select list exprs, ie, don't call this if the query doesn't have a FROM clause, this function will not return any result rows for that case. Sets 'batch' to NULL if no more data. Batch is owned by ImpaladQueryExecutor and must not be deallocated.

Definition at line 105 of file impalad-query-executor.cc.

References impala::Status::OK.

Referenced by impala::ExprTest::GetValue().

Status impala::ImpaladQueryExecutor::FetchResult ( std::string *  row)

Return single row as comma-separated list of values. Indicates end-of-stream by setting 'row' to the empty string. Returns OK if successful, otherwise error.

Status impala::ImpaladQueryExecutor::FetchResult ( std::vector< void * > *  row)

Return single row as vector of raw values. Indicates end-of-stream by returning empty 'row'. Returns OK if successful, otherwise error.

string impala::ImpaladQueryExecutor::FileErrors ( ) const

Returns a string representation of the file_errors_.

Definition at line 143 of file impalad-query-executor.cc.

RuntimeProfile * impala::ImpaladQueryExecutor::query_profile ( )

Returns the counters for the entire query.

Definition at line 163 of file impalad-query-executor.cc.

void impala::ImpaladQueryExecutor::setExecOptions ( const std::vector< std::string > &  exec_options)
inline

Definition at line 84 of file impalad-query-executor.h.

References exec_options_.

Referenced by main().

Status impala::ImpaladQueryExecutor::Setup ( )

Definition at line 46 of file impalad-query-executor.cc.

References client_, impala::Status::OK, RETURN_IF_ERROR, and impala::WaitForServer().

Referenced by main().

Member Data Documentation

boost::scoped_ptr<ThriftClient<ImpalaServiceClient> > impala::ImpaladQueryExecutor::client_
private

fe service-related

Definition at line 90 of file impalad-query-executor.h.

Referenced by Close(), Exec(), Explain(), and Setup().

int impala::ImpaladQueryExecutor::current_row_
private

Definition at line 101 of file impalad-query-executor.h.

Referenced by Exec().

bool impala::ImpaladQueryExecutor::eos_
private

Definition at line 102 of file impalad-query-executor.h.

Referenced by eos().

std::vector<std::string> impala::ImpaladQueryExecutor::exec_options_
private

Execution options.

Definition at line 93 of file impalad-query-executor.h.

Referenced by Exec(), and setExecOptions().

beeswax::QueryExplanation impala::ImpaladQueryExecutor::query_explanation_
private

Definition at line 98 of file impalad-query-executor.h.

Referenced by Explain().

beeswax::QueryHandle impala::ImpaladQueryExecutor::query_handle_
private

Beeswax query handle and result.

Definition at line 96 of file impalad-query-executor.h.

Referenced by Close(), and Exec().

bool impala::ImpaladQueryExecutor::query_in_progress_
private

Definition at line 100 of file impalad-query-executor.h.

Referenced by Close(), and Exec().

beeswax::Results impala::ImpaladQueryExecutor::query_results_
private

Definition at line 97 of file impalad-query-executor.h.

Referenced by Exec().


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