Impala
Impalaistheopensource,nativeanalyticdatabaseforApacheHadoop.
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
udf-debug.h
Go to the documentation of this file.
1 // Copyright 2012 Cloudera Inc.
2 //
3 // Licensed under the Apache License, Version 2.0 (the "License");
4 // you may not use this file except in compliance with the License.
5 // You may obtain a copy of the License at
6 //
7 // http://www.apache.org/licenses/LICENSE-2.0
8 //
9 // Unless required by applicable law or agreed to in writing, software
10 // distributed under the License is distributed on an "AS IS" BASIS,
11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 // See the License for the specific language governing permissions and
13 // limitations under the License.
14 
15 
16 #ifndef IMPALA_UDF_UDF_DEBUG_H
17 #define IMPALA_UDF_UDF_DEBUG_H
18 
19 #include "udf/udf.h"
20 
21 #include <string>
22 #include <sstream>
23 
24 namespace impala_udf {
25 
26 template<typename T>
27 inline std::string DebugString(const T& val) {
28  if (val.is_null) return "NULL";
29  std::stringstream ss;
30  ss << val.val;
31  return ss.str();
32 }
33 
34 template<>
35 inline std::string DebugString(const StringVal& val) {
36  if (val.is_null) return "NULL";
37  return std::string(reinterpret_cast<const char*>(val.ptr), val.len);
38 }
39 
40 }
41 
42 #endif
43 
uint8_t * ptr
Definition: udf.h:523
bool is_null
Definition: udf.h:359
std::string DebugString(const T &val)
Definition: udf-debug.h:27