MCPcopy Create free account
hub / github.com/apache/impala / TryDeepCopyStrings

Method TryDeepCopyStrings

be/src/runtime/tuple-ir.cc:78–99  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

76}
77
78bool Tuple::TryDeepCopyStrings(uint8_t** data, const uint8_t* data_end, int* offset,
79 const TupleDescriptor& desc, bool convert_ptrs) {
80 vector<SlotDescriptor*>::const_iterator slot = desc.string_slots().begin();
81 for (; slot != desc.string_slots().end(); ++slot) {
82 DCHECK((*slot)->type().IsVarLenStringType());
83 if (IsNull((*slot)->null_indicator_offset())) continue;
84
85 StringValue* string_v = GetStringSlot((*slot)->tuple_offset());
86 // It is safe to smallify at this point as DeepCopyVarlenData is called on the new
87 // tuple which can be modified.
88 if (string_v->Smallify()) continue;
89 int len = string_v->Len();
90 DCHECK_GT(len, 0); // Size 0 should be handled by "smallify" case.
91 if (!TryMemCopy(*data, data_end, len, string_v->Ptr())) return false;
92 char* new_ptr = convert_ptrs ? reinterpret_cast<char*>(*offset) :
93 reinterpret_cast<char*>(*data);
94 string_v->SetPtr(new_ptr);
95 *data += len;
96 *offset += len;
97 }
98 return true;
99}
100
101bool Tuple::TryDeepCopyCollections(uint8_t** data, const uint8_t* data_end, int* offset,
102 const TupleDescriptor& desc, bool convert_ptrs) {

Callers 2

TryDeepCopyMethod · 0.80

Calls 10

TryMemCopyFunction · 0.85
IsVarLenStringTypeMethod · 0.80
tuple_offsetMethod · 0.80
beginMethod · 0.45
endMethod · 0.45
typeMethod · 0.45
SmallifyMethod · 0.45
LenMethod · 0.45
PtrMethod · 0.45
SetPtrMethod · 0.45

Tested by

no test coverage detected