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

Method CopyCollections

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

Source from the content-addressed store, hash-verified

1134}
1135
1136bool BufferedTupleStream::CopyCollections(const Tuple* tuple,
1137 const vector<SlotDescriptor*>& collection_slots, uint8_t** data, const uint8_t* data_end) {
1138 for (const SlotDescriptor* slot_desc : collection_slots) {
1139 if (tuple->IsNull(slot_desc->null_indicator_offset())) continue;
1140 const CollectionValue* cv = tuple->GetCollectionSlot(slot_desc->tuple_offset());
1141 const TupleDescriptor& item_desc = *slot_desc->children_tuple_descriptor();
1142 if (LIKELY(cv->num_tuples > 0)) {
1143 int coll_byte_size = cv->num_tuples * item_desc.byte_size();
1144 if (UNLIKELY(*data + coll_byte_size > data_end)) return false;
1145 uint8_t* coll_data = *data;
1146 memcpy(coll_data, cv->ptr, coll_byte_size);
1147 *data += coll_byte_size;
1148
1149 if (!item_desc.HasVarlenSlots()) continue;
1150 // Copy variable length data when present in collection items.
1151 for (int i = 0; i < cv->num_tuples; ++i) {
1152 const Tuple* item = reinterpret_cast<Tuple*>(coll_data);
1153 if (UNLIKELY(!CopyStrings(item, item_desc.string_slots(), data, data_end))) {
1154 return false;
1155 }
1156 if (UNLIKELY(
1157 !CopyCollections(item, item_desc.collection_slots(), data, data_end))) {
1158 return false;
1159 }
1160 coll_data += item_desc.byte_size();
1161 }
1162 }
1163 }
1164 return true;
1165}
1166
1167void BufferedTupleStream::ReadIterator::Reset(std::list<Page>* pages) {
1168 valid_ = false;

Callers

nothing calls this directly

Calls 6

GetCollectionSlotMethod · 0.80
tuple_offsetMethod · 0.80
IsNullMethod · 0.45
byte_sizeMethod · 0.45
HasVarlenSlotsMethod · 0.45

Tested by

no test coverage detected