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

Method VarlenByteSize

be/src/runtime/tuple.cc:60–84  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

58}
59
60int64_t Tuple::VarlenByteSize(const TupleDescriptor& desc, bool assume_smallify) const {
61 int64_t result = 0;
62 vector<SlotDescriptor*>::const_iterator slot = desc.string_slots().begin();
63 for (; slot != desc.string_slots().end(); ++slot) {
64 DCHECK((*slot)->type().IsVarLenStringType());
65 if (IsNull((*slot)->null_indicator_offset())) continue;
66 const StringValue* string_val = GetStringSlot((*slot)->tuple_offset());
67 result += string_val->ExternalLen(assume_smallify);
68 }
69
70 slot = desc.collection_slots().begin();
71 for (; slot != desc.collection_slots().end(); ++slot) {
72 DCHECK((*slot)->type().IsCollectionType());
73 if (IsNull((*slot)->null_indicator_offset())) continue;
74 const CollectionValue* coll_value = GetCollectionSlot((*slot)->tuple_offset());
75 uint8_t* coll_data = coll_value->ptr;
76 const TupleDescriptor& item_desc = *(*slot)->children_tuple_descriptor();
77 for (int i = 0; i < coll_value->num_tuples; ++i) {
78 Tuple* tuple = reinterpret_cast<Tuple*>(coll_data);
79 result += tuple->TotalByteSize(item_desc, assume_smallify);
80 coll_data += item_desc.byte_size();
81 }
82 }
83 return result;
84}
85
86Tuple* Tuple::DeepCopy(const TupleDescriptor& desc, MemPool* pool) const {
87 Tuple* result = reinterpret_cast<Tuple*>(pool->Allocate(desc.byte_size()));

Callers 3

TotalByteSizeMethod · 0.80
TEST_FFunction · 0.80
ComputeRowSizeMethod · 0.80

Calls 10

IsVarLenStringTypeMethod · 0.80
tuple_offsetMethod · 0.80
IsCollectionTypeMethod · 0.80
beginMethod · 0.45
endMethod · 0.45
typeMethod · 0.45
ExternalLenMethod · 0.45
TotalByteSizeMethod · 0.45
byte_sizeMethod · 0.45

Tested by 1

TEST_FFunction · 0.64