Impala
Impalaistheopensource,nativeanalyticdatabaseforApacheHadoop.
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
text-converter.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_EXEC_TEXT_CONVERTER_H
17 #define IMPALA_EXEC_TEXT_CONVERTER_H
18 
19 #include "runtime/runtime-state.h"
20 
21 #include <string>
22 
23 namespace llvm {
24  class Function;
25 }
26 
27 namespace impala {
28 
29 class LlvmCodeGen;
30 class MemPool;
31 class SlotDescriptor;
32 class Status;
33 struct StringValue;
34 class Tuple;
35 class TupleDescriptor;
36 
40  public:
45  TextConverter(char escape_char, const std::string& null_col_val,
46  bool check_null = true);
47 
58  bool WriteSlot(const SlotDescriptor* slot_desc, Tuple* tuple,
59  const char* data, int len, bool copy_string, bool need_escape, MemPool* pool);
60 
65  void UnescapeString(const char* src, char* dest, int* len, int64_t maxlen = -1);
66 
69  void UnescapeString(StringValue* str, MemPool* pool);
70 
81  static llvm::Function* CodegenWriteSlot(LlvmCodeGen* codegen,
82  TupleDescriptor* tuple_desc, SlotDescriptor* slot_desc,
83  const char* null_col_val, int len, bool check_null);
84 
85  private:
88  std::string null_col_val_;
91 };
92 
93 }
94 
95 #endif
A tuple with 0 materialised slots is represented as NULL.
Definition: tuple.h:48
bool WriteSlot(const SlotDescriptor *slot_desc, Tuple *tuple, const char *data, int len, bool copy_string, bool need_escape, MemPool *pool)
void UnescapeString(const char *src, char *dest, int *len, int64_t maxlen=-1)
TextConverter(char escape_char, const std::string &null_col_val, bool check_null=true)
LLVM code generator. This is the top level object to generate jitted code.
Definition: llvm-codegen.h:107
bool check_null_
Indicates whether we should check for null_col_val_ and set slots to NULL.
ObjectPool pool
std::string null_col_val_
Special string to indicate NULL column values.
static llvm::Function * CodegenWriteSlot(LlvmCodeGen *codegen, TupleDescriptor *tuple_desc, SlotDescriptor *slot_desc, const char *null_col_val, int len, bool check_null)