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

Method WriteCollectionVarlenChild

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

Source from the content-addressed store, hash-verified

360
361template <bool COLLECT_VAR_LEN_VALS>
362void RawValue::WriteCollectionVarlenChild(Tuple* child_dest_tuple, Tuple* child_src_tuple,
363 const SlotDescriptor* slot_desc, MemPool* pool, vector<StringValue*>* string_values,
364 vector<pair<CollectionValue*, int64_t>>* collection_values ) {
365 DCHECK(slot_desc != nullptr);
366 DCHECK(slot_desc->type().IsVarLenStringType() || slot_desc->type().IsCollectionType());
367
368 if (!child_dest_tuple->IsNull(slot_desc->null_indicator_offset())) {
369 // The fixed length part of the child (the pointer and the length / number of tuples)
370 // is already in the destination tuple, copied there as the var-len data of the
371 // parent. We continue the recursion for two things:
372 // 1. deep-copying the var-len data of the child
373 // 2. collecting var-len slots.
374 // At least one of these is true, otherwise we never get here. The called recursive
375 // function will once again set the length (always unnecessary) and the pointer
376 // (unnecessary if we're not deep-copying, only collecting). This is not costly enough
377 // to justify complicating the code. Note, however, that although at this point the
378 // source and destination slots hold the same value (pointer and length / number of
379 // tuples), we take 'child_value', the source in the recursive call, from the source
380 // tuple, because in case of deep-copying, the pointer of the destination slot will be
381 // re-assigned to the newly allocated buffer, and if we took 'child_value' from the
382 // destination slot, the 'source' pointer and the 'destination' pointer would be the
383 // same, meaning the 'source' pointer would also be overwritten before we copied the
384 // data it pointed to.
385 void* child_value = child_src_tuple->GetSlot(slot_desc->tuple_offset());
386
387 WriteNonNull<COLLECT_VAR_LEN_VALS>(child_value, child_dest_tuple,
388 slot_desc, pool, string_values, collection_values);
389 }
390}
391
392template <bool COLLECT_VAR_LEN_VALS>
393void RawValue::WritePrimitiveCollectVarlen(const void* value, Tuple* tuple,

Callers

nothing calls this directly

Calls 6

IsVarLenStringTypeMethod · 0.80
IsCollectionTypeMethod · 0.80
tuple_offsetMethod · 0.80
typeMethod · 0.45
IsNullMethod · 0.45
GetSlotMethod · 0.45

Tested by

no test coverage detected