17 #include <boost/algorithm/string/join.hpp>
18 #include <boost/algorithm/string.hpp>
24 DEFINE_string(impalad,
"localhost:21000",
"host:port of impalad process");
29 using boost::algorithm::is_any_of;
30 using boost::algorithm::split;
31 using namespace Apache::Hadoop::Hive;
32 using namespace beeswax;
36 ImpaladQueryExecutor::ImpaladQueryExecutor()
37 : query_in_progress_(false),
47 DCHECK(!FLAGS_impalad.empty());
49 split(elems, FLAGS_impalad, is_any_of(
":"));
50 DCHECK_EQ(elems.size(), 2);
51 int port = atoi(elems[1].c_str());
68 }
catch (BeeswaxException& e) {
70 ss << e.SQLState <<
": " << e.message;
78 const string& query_string, vector<FieldSchema>* col_schema) {
82 query.query = query_string;
84 query.hadoop_user =
"impala_test_user";
90 ResultsMetadata resultsMetadata;
94 }
catch (BeeswaxException& e) {
96 ss << e.SQLState <<
": " << e.message;
101 if (col_schema != NULL) *col_schema = resultsMetadata.schema.fieldSchemas;
136 return Status(
"ImpaladQueryExecutor::FetchResult(vector<void*>) not supported");
150 query.query = query_string;
155 }
catch (BeeswaxException& e) {
157 ss << e.SQLState <<
": " << e.message;
Status Exec(const std::string &query_string, std::vector< Apache::Hadoop::Hive::FieldSchema > *col_types)
#define RETURN_IF_ERROR(stmt)
some generally useful macros
beeswax::QueryHandle query_handle_
Beeswax query handle and result.
beeswax::Results query_results_
Status Close()
call beeswax.close() for current query, if one in progress
boost::scoped_ptr< ThriftClient< ImpalaServiceClient > > client_
fe service-related
beeswax::QueryExplanation query_explanation_
std::string ErrorString() const
std::vector< std::string > exec_options_
Execution options.
Status WaitForServer(const string &host, int port, int num_retries, int retry_interval_ms)
RuntimeProfile * query_profile()
Returns the counters for the entire query.
std::string FileErrors() const
Returns a string representation of the file_errors_.
DEFINE_string(impalad,"localhost:21000","host:port of impalad process")
Status FetchResult(RowBatch **batch)
Status Explain(const std::string &query_string, std::string *explain_plan)
Return the explain plan for the query.