36 DeepCopy(result, desc, pool, convert_ptrs);
44 for (vector<SlotDescriptor*>::const_iterator i = desc.
string_slots().begin();
46 DCHECK((*i)->type().IsVarLen());
47 if (!dst->
IsNull((*i)->null_indicator_offset())) {
50 char* string_copy =
reinterpret_cast<char*
>(pool->
Allocate(string_v->
len));
51 memcpy(string_copy, string_v->
ptr, string_v->
len);
52 string_v->
ptr = (convert_ptrs ?
reinterpret_cast<char*
>(
offset) : string_copy);
63 for (vector<SlotDescriptor*>::const_iterator i = desc.
string_slots().begin();
65 DCHECK((*i)->type().IsVarLen());
66 if (!dst->
IsNull((*i)->null_indicator_offset())) {
68 memcpy(*data, string_v->
ptr, string_v->
len);
69 string_v->
ptr = (convert_ptrs ?
reinterpret_cast<char*
>(*offset) : *data);
70 *data += string_v->
len;
71 *offset += string_v->
len;
76 template <
bool collect_
string_vals>
79 const vector<ExprContext*>& materialize_expr_ctxs,
MemPool*
pool,
80 vector<StringValue*>* non_null_var_len_values,
int* total_var_len) {
81 if (collect_string_vals) {
82 non_null_var_len_values->clear();
87 int mat_expr_index = 0;
88 for (
int i = 0; i < desc.
slots().size(); ++i) {
95 slot_desc->
type() == materialize_expr_ctxs[mat_expr_index]->root()->
type());
96 void* src = materialize_expr_ctxs[mat_expr_index]->GetValue(row);
100 if (collect_string_vals && slot_desc->
type().
IsVarLen()) {
102 non_null_var_len_values->push_back(string_val);
103 *total_var_len += string_val->
len;
111 DCHECK_EQ(mat_expr_index, materialize_expr_ctxs.size());
115 const vector<ExprContext*>& materialize_expr_ctxs,
MemPool*
pool,
116 vector<StringValue*>* non_null_var_values,
int* total_var_len);
119 const vector<ExprContext*>& materialize_expr_ctxs,
MemPool*
pool,
120 vector<StringValue*>* non_null_var_values,
int* total_var_len);
void SetNull(const NullIndicatorOffset &offset)
A tuple with 0 materialised slots is represented as NULL.
void * GetSlot(int offset)
int num_null_bytes() const
const std::vector< SlotDescriptor * > & slots() const
const NullIndicatorOffset & null_indicator_offset() const
Tuple * DeepCopy(const TupleDescriptor &desc, MemPool *pool, bool convert_ptrs=false)
bool IsNull(const NullIndicatorOffset &offset) const
const std::vector< SlotDescriptor * > & string_slots() const
static const char * LLVM_CLASS_NAME
For C++/IR interop, we need to be able to look up types by name.
const ColumnType & type() const
int GetCurrentOffset() const
static void Write(const void *value, Tuple *tuple, const SlotDescriptor *slot_desc, MemPool *pool)
StringValue * GetStringSlot(int offset)
uint8_t offset[7 *64-sizeof(uint64_t)]
void MaterializeExprs(TupleRow *row, const TupleDescriptor &desc, const std::vector< ExprContext * > &materialize_expr_ctxs, MemPool *pool, std::vector< StringValue * > *non_null_var_len_values=NULL, int *total_var_len=NULL)
bool is_materialized() const
uint8_t * Allocate(int size)