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

Method ComputeRowSize

be/src/runtime/buffered-tuple-stream.cc:953–996  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

951}
952
953int64_t BufferedTupleStream::ComputeRowSize(TupleRow* row)
954 const noexcept {
955 int64_t size = 0;
956 if (has_nullable_tuple_) {
957 size += NullIndicatorBytesPerRow();
958 for (int i = 0; i < fixed_tuple_sizes_.size(); ++i) {
959 if (row->GetTuple(i) != nullptr) size += fixed_tuple_sizes_[i];
960 }
961 } else {
962 for (int i = 0; i < fixed_tuple_sizes_.size(); ++i) {
963 size += fixed_tuple_sizes_[i];
964 }
965 }
966 for (int i = 0; i < inlined_string_slots_.size(); ++i) {
967 Tuple* tuple = row->GetTuple(inlined_string_slots_[i].first);
968 if (tuple == nullptr) continue;
969 const vector<SlotDescriptor*>& slots = inlined_string_slots_[i].second;
970 for (auto it = slots.begin(); it != slots.end(); ++it) {
971 if (tuple->IsNull((*it)->null_indicator_offset())) continue;
972 StringValue* sv = tuple->GetStringSlot((*it)->tuple_offset());
973 if (sv->IsSmall()) continue;
974 size += sv->Len();
975 }
976 }
977
978 for (int i = 0; i < inlined_coll_slots_.size(); ++i) {
979 Tuple* tuple = row->GetTuple(inlined_coll_slots_[i].first);
980 if (tuple == nullptr) continue;
981 const vector<SlotDescriptor*>& slots = inlined_coll_slots_[i].second;
982 for (auto it = slots.begin(); it != slots.end(); ++it) {
983 if (tuple->IsNull((*it)->null_indicator_offset())) continue;
984 CollectionValue* cv = tuple->GetCollectionSlot((*it)->tuple_offset());
985 const TupleDescriptor& item_desc = *(*it)->children_tuple_descriptor();
986 size += cv->num_tuples * item_desc.byte_size();
987
988 if (!item_desc.HasVarlenSlots()) continue;
989 for (int j = 0; j < cv->num_tuples; ++j) {
990 Tuple* item = reinterpret_cast<Tuple*>(&cv->ptr[j * item_desc.byte_size()]);
991 size += item->VarlenByteSize(item_desc, false /*assume_smallify*/);
992 }
993 }
994 }
995 return size;
996}
997
998bool BufferedTupleStream::AddRowSlow(TupleRow* row, Status* status) noexcept {
999 // Use AddRowCustom*() to do the work of advancing the page.

Callers 2

TEST_FFunction · 0.80
AddBatchMethod · 0.80

Calls 14

GetStringSlotMethod · 0.80
tuple_offsetMethod · 0.80
GetCollectionSlotMethod · 0.80
VarlenByteSizeMethod · 0.80
sizeMethod · 0.45
GetTupleMethod · 0.45
beginMethod · 0.45
endMethod · 0.45
IsNullMethod · 0.45
IsSmallMethod · 0.45
LenMethod · 0.45

Tested by 1

TEST_FFunction · 0.64