19 #include <boost/foreach.hpp>
31 namespace glog_internal_namespace_ {
38 using boost::char_separator;
39 using boost::tokenizer;
40 using namespace beeswax;
41 using namespace parquet;
45 #define THRIFT_ENUM_OUTPUT_FN_IMPL(E, MAP) \
46 ostream& operator<<(ostream& os, const E::type& e) {\
47 map<int, const char*>::const_iterator i;\
49 if (i != MAP.end()) {\
56 #define THRIFT_ENUM_OUTPUT_FN(E) THRIFT_ENUM_OUTPUT_FN_IMPL(E , _##E##_VALUES_TO_NAMES)
59 #define THRIFT_ENUM_PRINT_FN(E) \
60 string Print##E(const E::type& e) {\
97 string PrintId(
const TUniqueId&
id,
const string& separator) {
99 out << hex <<
id.hi << separator <<
id.lo;
105 out << hex << std::setfill(
'0');
106 for (
int i = 0; i < len; ++i) {
107 out << setw(2) << static_cast<uint16_t>(bytes[i]);
112 bool ParseId(
const string& s, TUniqueId*
id) {
118 const char* hi_part = s.c_str();
119 char* separator =
const_cast<char*
>(strchr(hi_part,
':'));
120 if (separator == NULL) {
122 char_separator<char> sep(
" ");
123 tokenizer< char_separator<char> > tokens(s, sep);
125 BOOST_FOREACH(
const string& token, tokens) {
127 int64_t component = StringParser::StringToInt<int64_t>(
128 token.c_str(), token.length(), &parse_result);
129 if (parse_result != StringParser::PARSE_SUCCESS)
return false;
144 const char* lo_part = separator + 1;
147 char* error_hi = NULL;
148 char* error_lo = NULL;
149 id->hi = strtoul(hi_part, &error_hi, 16);
150 id->lo = strtoul(lo_part, &error_lo, 16);
152 bool valid = *error_hi ==
'\0' && *error_lo ==
'\0';
158 map<int, const char*>::const_iterator i;
159 i = _TPlanNodeType_VALUES_TO_NAMES.find(type);
160 if (i != _TPlanNodeType_VALUES_TO_NAMES.end()) {
163 return "Invalid plan node type";
167 if (t == NULL)
return "null";
170 bool first_value =
true;
171 for (
int i = 0; i < d.
slots().size(); ++i) {
183 RawValue::PrintValue(
196 if (i != 0) out <<
" ";
205 for (
int i = 0; i < batch->
num_rows(); ++i) {
214 if (path.size() > 0) ss << path[0];
215 for (
int i = 1; i < path.size(); ++i) {
241 ss << google::ProgramInvocationShortName()
string path("/usr/lib/sasl2:/usr/lib64/sasl2:/usr/local/lib/sasl2:/usr/lib/x86_64-linux-gnu/sasl2")
#define IMPALA_BUILD_TIME
bool ParseId(const string &s, TUniqueId *id)
Tuple * GetTuple(int tuple_idx)
#define IMPALA_BUILD_HASH
A tuple with 0 materialised slots is represented as NULL.
const RowDescriptor & row_desc() const
string GetVersionString(bool compact)
Returns "<program short name> version <GetBuildVersion(compact)>".
string PrintPath(const vector< int > &path)
TupleRow * GetRow(int row_idx)
ostream & operator<<(ostream &os, const TUniqueId &id)
void * GetSlot(int offset)
string GetBuildVersion(bool compact)
const std::vector< SlotDescriptor * > & slots() const
string PrintId(const TUniqueId &id, const string &separator)
const NullIndicatorOffset & null_indicator_offset() const
bool IsNull(const NullIndicatorOffset &offset) const
const ColumnType & type() const
#define THRIFT_ENUM_PRINT_FN(E)
string PrintBatch(RowBatch *batch)
const std::vector< TupleDescriptor * > & tuple_descriptors() const
Return descriptors for all tuples in this row, in order of appearance.
string PrintPlanNodeType(const TPlanNodeType::type &type)
void DumpStackTraceToString(std::string *s)
#define IMPALA_BUILD_VERSION
#define THRIFT_ENUM_OUTPUT_FN(E)
bool is_materialized() const
string PrintRow(TupleRow *row, const RowDescriptor &d)
string PrintTuple(const Tuple *t, const TupleDescriptor &d)
string PrintAsHex(const char *bytes, int64_t len)