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

Method WriteStruct

be/src/runtime/raw-value.cc:260–289  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

258
259template <bool COLLECT_VAR_LEN_VALS>
260void RawValue::WriteStruct(const void* value, Tuple* tuple,
261 const SlotDescriptor* slot_desc, MemPool* pool, vector<StringValue*>* string_values,
262 vector<pair<CollectionValue*, int64_t>>* collection_values) {
263 DCHECK(tuple != nullptr);
264 DCHECK(slot_desc->type().IsStructType());
265 DCHECK(slot_desc->children_tuple_descriptor() != nullptr);
266 if (value == nullptr) {
267 tuple->SetStructToNull(slot_desc);
268 return;
269 }
270 const StructVal* src = reinterpret_cast<const StructVal*>(value);
271 const TupleDescriptor* children_tuple_desc = slot_desc->children_tuple_descriptor();
272 DCHECK_EQ(src->num_children, children_tuple_desc->slots().size());
273
274 for (int i = 0; i < src->num_children; ++i) {
275 SlotDescriptor* child_slot = children_tuple_desc->slots()[i];
276 uint8_t* src_child = src->ptr[i];
277 // TODO IMPALA-12160: Handle collections in structs.
278 if (child_slot->type().IsStructType()) {
279 // Recursive call in case of nested structs.
280 WriteStruct<COLLECT_VAR_LEN_VALS>(src_child, tuple, child_slot, pool,
281 string_values, collection_values);
282 } else if (src_child == nullptr) {
283 tuple->SetNull(child_slot->null_indicator_offset());
284 } else {
285 WritePrimitiveCollectVarlen<COLLECT_VAR_LEN_VALS>(src_child, tuple, child_slot,
286 pool, string_values);
287 }
288 }
289}
290
291template <bool COLLECT_VAR_LEN_VALS>
292void RawValue::WriteCollection(const void* value, Tuple* tuple,

Callers

nothing calls this directly

Calls 6

IsStructTypeMethod · 0.80
SetStructToNullMethod · 0.80
SetNullMethod · 0.80
typeMethod · 0.45
sizeMethod · 0.45

Tested by

no test coverage detected