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

Method DecodeNextValue

be/src/util/dict-encoding.h:605–633  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

603
604template <typename T>
605bool DictDecoder<T>::DecodeNextValue(T* value) {
606 // IMPALA-959: Use memcpy() instead of '=' to set *value: addresses are not always 16
607 // byte aligned for Decimal16Values.
608 int32_t num_repeats = data_decoder_.NextNumRepeats();
609 DCHECK_GE(num_repeats, 0);
610 if (num_repeats > 0) {
611 const IndexType idx = data_decoder_.GetRepeatedValue(num_repeats);
612 if (UNLIKELY(idx >= dict_.size())) return false;
613 memcpy(&decoded_values_[0], &dict_[idx], sizeof(T));
614 memcpy(value, &decoded_values_[0], sizeof(T));
615 num_repeats_ = num_repeats - 1;
616 return true;
617 } else {
618 int32_t num_literals = data_decoder_.NextNumLiterals();
619 if (UNLIKELY(num_literals == 0)) return false;
620
621 DCHECK_GT(num_literals, 0);
622 int32_t num_to_decode = std::min(num_literals, DICT_DECODER_BUFFER_SIZE);
623 StrideWriter<T> dst(&decoded_values_[0], sizeof(T));
624 if (UNLIKELY(!data_decoder_.DecodeLiteralValues(num_to_decode, dict_.data(),
625 dict_.size(), &dst))) {
626 return false;
627 }
628 num_literal_values_ = num_to_decode;
629 memcpy(value, &decoded_values_[0], sizeof(T));
630 next_literal_idx_ = 1;
631 return true;
632 }
633}
634
635template<typename T>
636inline void DictEncoder<T>::WriteDict(uint8_t* buffer) {

Callers

nothing calls this directly

Calls 7

minFunction · 0.85
NextNumRepeatsMethod · 0.80
NextNumLiteralsMethod · 0.80
DecodeLiteralValuesMethod · 0.80
GetRepeatedValueMethod · 0.45
sizeMethod · 0.45
dataMethod · 0.45

Tested by

no test coverage detected