be/src/storage/segment/binary_plain_page.h
Line | Count | Source |
1 | | // Licensed to the Apache Software Foundation (ASF) under one |
2 | | // or more contributor license agreements. See the NOTICE file |
3 | | // distributed with this work for additional information |
4 | | // regarding copyright ownership. The ASF licenses this file |
5 | | // to you under the Apache License, Version 2.0 (the |
6 | | // "License"); you may not use this file except in compliance |
7 | | // with the License. You may obtain a copy of the License at |
8 | | // |
9 | | // http://www.apache.org/licenses/LICENSE-2.0 |
10 | | // |
11 | | // Unless required by applicable law or agreed to in writing, |
12 | | // software distributed under the License is distributed on an |
13 | | // "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY |
14 | | // KIND, either express or implied. See the License for the |
15 | | // specific language governing permissions and limitations |
16 | | // under the License. |
17 | | |
18 | | // Simplistic page encoding for strings. |
19 | | // |
20 | | // The page consists of: |
21 | | // Strings: |
22 | | // raw strings that were written |
23 | | // Trailer |
24 | | // Offsets: |
25 | | // offsets pointing to the beginning of each string |
26 | | // num_elems (32-bit fixed) |
27 | | // |
28 | | |
29 | | #pragma once |
30 | | |
31 | | #include "common/logging.h" |
32 | | #include "core/column/column_complex.h" |
33 | | #include "storage/olap_common.h" |
34 | | #include "storage/segment/options.h" |
35 | | #include "storage/segment/page_builder.h" |
36 | | #include "storage/segment/page_decoder.h" |
37 | | #include "storage/types.h" |
38 | | #include "util/coding.h" |
39 | | #include "util/faststring.h" |
40 | | |
41 | | namespace doris { |
42 | | namespace segment_v2 { |
43 | | |
44 | | template <FieldType Type> |
45 | | class BinaryPlainPageBuilder : public PageBuilderHelper<BinaryPlainPageBuilder<Type>> { |
46 | | public: |
47 | | using Self = BinaryPlainPageBuilder<Type>; |
48 | | friend class PageBuilderHelper<Self>; |
49 | | |
50 | 21.3k | Status init() override { return reset(); }Unexecuted instantiation: _ZN5doris10segment_v222BinaryPlainPageBuilderILNS_9FieldTypeE13EE4initEv _ZN5doris10segment_v222BinaryPlainPageBuilderILNS_9FieldTypeE17EE4initEv Line | Count | Source | 50 | 5.56k | Status init() override { return reset(); } |
Unexecuted instantiation: _ZN5doris10segment_v222BinaryPlainPageBuilderILNS_9FieldTypeE26EE4initEv Unexecuted instantiation: _ZN5doris10segment_v222BinaryPlainPageBuilderILNS_9FieldTypeE34EE4initEv Unexecuted instantiation: _ZN5doris10segment_v222BinaryPlainPageBuilderILNS_9FieldTypeE35EE4initEv Unexecuted instantiation: _ZN5doris10segment_v222BinaryPlainPageBuilderILNS_9FieldTypeE23EE4initEv _ZN5doris10segment_v222BinaryPlainPageBuilderILNS_9FieldTypeE25EE4initEv Line | Count | Source | 50 | 15.7k | Status init() override { return reset(); } |
Unexecuted instantiation: _ZN5doris10segment_v222BinaryPlainPageBuilderILNS_9FieldTypeE27EE4initEv Unexecuted instantiation: _ZN5doris10segment_v222BinaryPlainPageBuilderILNS_9FieldTypeE36EE4initEv |
51 | | |
52 | 1.52M | bool is_page_full() override { |
53 | 1.52M | bool ret = false; |
54 | 1.52M | if (_options.is_dict_page) { |
55 | | // dict_page_size is 0, do not limit the page size |
56 | 1.11M | ret = _options.dict_page_size != 0 && _size_estimate > _options.dict_page_size; |
57 | 1.11M | } else { |
58 | 407k | ret = _options.data_page_size != 0 && _size_estimate > _options.data_page_size; |
59 | 407k | } |
60 | 1.52M | return ret; |
61 | 1.52M | } Unexecuted instantiation: _ZN5doris10segment_v222BinaryPlainPageBuilderILNS_9FieldTypeE13EE12is_page_fullEv _ZN5doris10segment_v222BinaryPlainPageBuilderILNS_9FieldTypeE17EE12is_page_fullEv Line | Count | Source | 52 | 1.46M | bool is_page_full() override { | 53 | 1.46M | bool ret = false; | 54 | 1.46M | if (_options.is_dict_page) { | 55 | | // dict_page_size is 0, do not limit the page size | 56 | 1.11M | ret = _options.dict_page_size != 0 && _size_estimate > _options.dict_page_size; | 57 | 1.11M | } else { | 58 | 347k | ret = _options.data_page_size != 0 && _size_estimate > _options.data_page_size; | 59 | 347k | } | 60 | 1.46M | return ret; | 61 | 1.46M | } |
Unexecuted instantiation: _ZN5doris10segment_v222BinaryPlainPageBuilderILNS_9FieldTypeE26EE12is_page_fullEv Unexecuted instantiation: _ZN5doris10segment_v222BinaryPlainPageBuilderILNS_9FieldTypeE34EE12is_page_fullEv Unexecuted instantiation: _ZN5doris10segment_v222BinaryPlainPageBuilderILNS_9FieldTypeE35EE12is_page_fullEv Unexecuted instantiation: _ZN5doris10segment_v222BinaryPlainPageBuilderILNS_9FieldTypeE23EE12is_page_fullEv _ZN5doris10segment_v222BinaryPlainPageBuilderILNS_9FieldTypeE25EE12is_page_fullEv Line | Count | Source | 52 | 59.5k | bool is_page_full() override { | 53 | 59.5k | bool ret = false; | 54 | 59.5k | if (_options.is_dict_page) { | 55 | | // dict_page_size is 0, do not limit the page size | 56 | 0 | ret = _options.dict_page_size != 0 && _size_estimate > _options.dict_page_size; | 57 | 59.5k | } else { | 58 | 59.5k | ret = _options.data_page_size != 0 && _size_estimate > _options.data_page_size; | 59 | 59.5k | } | 60 | 59.5k | return ret; | 61 | 59.5k | } |
Unexecuted instantiation: _ZN5doris10segment_v222BinaryPlainPageBuilderILNS_9FieldTypeE27EE12is_page_fullEv Unexecuted instantiation: _ZN5doris10segment_v222BinaryPlainPageBuilderILNS_9FieldTypeE36EE12is_page_fullEv |
62 | | |
63 | 250k | Status add(const uint8_t* vals, size_t* count) override { |
64 | 250k | DCHECK(!_finished); |
65 | 250k | DCHECK_GT(*count, 0); |
66 | 250k | size_t i = 0; |
67 | | |
68 | | // If the page is full, should stop adding more items. |
69 | 537k | while (!is_page_full() && i < *count) { |
70 | 287k | const auto* src = reinterpret_cast<const Slice*>(vals); |
71 | 287k | if constexpr (Type == FieldType::OLAP_FIELD_TYPE_BITMAP) { |
72 | 19.8k | if (_options.need_check_bitmap) { |
73 | 0 | RETURN_IF_ERROR(BitmapTypeCode::validate(*(src->data))); |
74 | 0 | } |
75 | 19.8k | } |
76 | 19.8k | size_t offset = _buffer.size(); |
77 | 287k | _offsets.push_back(cast_set<uint32_t>(offset)); |
78 | | // This may need a large memory, should return error if could not allocated |
79 | | // successfully, to avoid BE OOM. |
80 | 287k | RETURN_IF_CATCH_EXCEPTION(_buffer.append(src->data, src->size)); |
81 | | |
82 | 287k | _last_value_size = cast_set<uint32_t>(src->size); |
83 | 287k | _size_estimate += src->size; |
84 | 287k | _size_estimate += sizeof(uint32_t); |
85 | 287k | _raw_data_size += src->size; |
86 | | |
87 | 287k | i++; |
88 | 287k | vals += sizeof(Slice); |
89 | 287k | } |
90 | | |
91 | 250k | *count = i; |
92 | 250k | return Status::OK(); |
93 | 250k | } Unexecuted instantiation: _ZN5doris10segment_v222BinaryPlainPageBuilderILNS_9FieldTypeE13EE3addEPKhPm _ZN5doris10segment_v222BinaryPlainPageBuilderILNS_9FieldTypeE17EE3addEPKhPm Line | Count | Source | 63 | 230k | Status add(const uint8_t* vals, size_t* count) override { | 64 | 230k | DCHECK(!_finished); | 65 | 230k | DCHECK_GT(*count, 0); | 66 | 230k | size_t i = 0; | 67 | | | 68 | | // If the page is full, should stop adding more items. | 69 | 497k | while (!is_page_full() && i < *count) { | 70 | 267k | const auto* src = reinterpret_cast<const Slice*>(vals); | 71 | | if constexpr (Type == FieldType::OLAP_FIELD_TYPE_BITMAP) { | 72 | | if (_options.need_check_bitmap) { | 73 | | RETURN_IF_ERROR(BitmapTypeCode::validate(*(src->data))); | 74 | | } | 75 | | } | 76 | 267k | size_t offset = _buffer.size(); | 77 | 267k | _offsets.push_back(cast_set<uint32_t>(offset)); | 78 | | // This may need a large memory, should return error if could not allocated | 79 | | // successfully, to avoid BE OOM. | 80 | 267k | RETURN_IF_CATCH_EXCEPTION(_buffer.append(src->data, src->size)); | 81 | | | 82 | 267k | _last_value_size = cast_set<uint32_t>(src->size); | 83 | 267k | _size_estimate += src->size; | 84 | 267k | _size_estimate += sizeof(uint32_t); | 85 | 267k | _raw_data_size += src->size; | 86 | | | 87 | 267k | i++; | 88 | 267k | vals += sizeof(Slice); | 89 | 267k | } | 90 | | | 91 | 230k | *count = i; | 92 | 230k | return Status::OK(); | 93 | 230k | } |
Unexecuted instantiation: _ZN5doris10segment_v222BinaryPlainPageBuilderILNS_9FieldTypeE26EE3addEPKhPm Unexecuted instantiation: _ZN5doris10segment_v222BinaryPlainPageBuilderILNS_9FieldTypeE34EE3addEPKhPm Unexecuted instantiation: _ZN5doris10segment_v222BinaryPlainPageBuilderILNS_9FieldTypeE35EE3addEPKhPm Unexecuted instantiation: _ZN5doris10segment_v222BinaryPlainPageBuilderILNS_9FieldTypeE23EE3addEPKhPm _ZN5doris10segment_v222BinaryPlainPageBuilderILNS_9FieldTypeE25EE3addEPKhPm Line | Count | Source | 63 | 19.8k | Status add(const uint8_t* vals, size_t* count) override { | 64 | 19.8k | DCHECK(!_finished); | 65 | 19.8k | DCHECK_GT(*count, 0); | 66 | 19.8k | size_t i = 0; | 67 | | | 68 | | // If the page is full, should stop adding more items. | 69 | 39.6k | while (!is_page_full() && i < *count) { | 70 | 19.8k | const auto* src = reinterpret_cast<const Slice*>(vals); | 71 | 19.8k | if constexpr (Type == FieldType::OLAP_FIELD_TYPE_BITMAP) { | 72 | 19.8k | if (_options.need_check_bitmap) { | 73 | 0 | RETURN_IF_ERROR(BitmapTypeCode::validate(*(src->data))); | 74 | 0 | } | 75 | 19.8k | } | 76 | 19.8k | size_t offset = _buffer.size(); | 77 | 19.8k | _offsets.push_back(cast_set<uint32_t>(offset)); | 78 | | // This may need a large memory, should return error if could not allocated | 79 | | // successfully, to avoid BE OOM. | 80 | 19.8k | RETURN_IF_CATCH_EXCEPTION(_buffer.append(src->data, src->size)); | 81 | | | 82 | 19.8k | _last_value_size = cast_set<uint32_t>(src->size); | 83 | 19.8k | _size_estimate += src->size; | 84 | 19.8k | _size_estimate += sizeof(uint32_t); | 85 | 19.8k | _raw_data_size += src->size; | 86 | | | 87 | 19.8k | i++; | 88 | 19.8k | vals += sizeof(Slice); | 89 | 19.8k | } | 90 | | | 91 | 19.8k | *count = i; | 92 | 19.8k | return Status::OK(); | 93 | 19.8k | } |
Unexecuted instantiation: _ZN5doris10segment_v222BinaryPlainPageBuilderILNS_9FieldTypeE27EE3addEPKhPm Unexecuted instantiation: _ZN5doris10segment_v222BinaryPlainPageBuilderILNS_9FieldTypeE36EE3addEPKhPm |
94 | | |
95 | 23.2k | Status finish(OwnedSlice* slice) override { |
96 | 23.2k | DCHECK(!_finished); |
97 | 23.2k | _finished = true; |
98 | 23.2k | RETURN_IF_CATCH_EXCEPTION({ |
99 | | // Set up trailer |
100 | 23.2k | for (uint32_t _offset : _offsets) { |
101 | 23.2k | put_fixed32_le(&_buffer, _offset); |
102 | 23.2k | } |
103 | 23.2k | put_fixed32_le(&_buffer, cast_set<uint32_t>(_offsets.size())); |
104 | 23.2k | *slice = _buffer.build(); |
105 | 23.2k | }); |
106 | 23.2k | return Status::OK(); |
107 | 23.2k | } Unexecuted instantiation: _ZN5doris10segment_v222BinaryPlainPageBuilderILNS_9FieldTypeE13EE6finishEPNS_10OwnedSliceE _ZN5doris10segment_v222BinaryPlainPageBuilderILNS_9FieldTypeE17EE6finishEPNS_10OwnedSliceE Line | Count | Source | 95 | 7.48k | Status finish(OwnedSlice* slice) override { | 96 | 7.48k | DCHECK(!_finished); | 97 | 7.48k | _finished = true; | 98 | 7.48k | RETURN_IF_CATCH_EXCEPTION({ | 99 | | // Set up trailer | 100 | 7.48k | for (uint32_t _offset : _offsets) { | 101 | 7.48k | put_fixed32_le(&_buffer, _offset); | 102 | 7.48k | } | 103 | 7.48k | put_fixed32_le(&_buffer, cast_set<uint32_t>(_offsets.size())); | 104 | 7.48k | *slice = _buffer.build(); | 105 | 7.48k | }); | 106 | 7.48k | return Status::OK(); | 107 | 7.48k | } |
Unexecuted instantiation: _ZN5doris10segment_v222BinaryPlainPageBuilderILNS_9FieldTypeE26EE6finishEPNS_10OwnedSliceE Unexecuted instantiation: _ZN5doris10segment_v222BinaryPlainPageBuilderILNS_9FieldTypeE34EE6finishEPNS_10OwnedSliceE Unexecuted instantiation: _ZN5doris10segment_v222BinaryPlainPageBuilderILNS_9FieldTypeE35EE6finishEPNS_10OwnedSliceE Unexecuted instantiation: _ZN5doris10segment_v222BinaryPlainPageBuilderILNS_9FieldTypeE23EE6finishEPNS_10OwnedSliceE _ZN5doris10segment_v222BinaryPlainPageBuilderILNS_9FieldTypeE25EE6finishEPNS_10OwnedSliceE Line | Count | Source | 95 | 15.7k | Status finish(OwnedSlice* slice) override { | 96 | 15.7k | DCHECK(!_finished); | 97 | 15.7k | _finished = true; | 98 | 15.7k | RETURN_IF_CATCH_EXCEPTION({ | 99 | | // Set up trailer | 100 | 15.7k | for (uint32_t _offset : _offsets) { | 101 | 15.7k | put_fixed32_le(&_buffer, _offset); | 102 | 15.7k | } | 103 | 15.7k | put_fixed32_le(&_buffer, cast_set<uint32_t>(_offsets.size())); | 104 | 15.7k | *slice = _buffer.build(); | 105 | 15.7k | }); | 106 | 15.7k | return Status::OK(); | 107 | 15.7k | } |
Unexecuted instantiation: _ZN5doris10segment_v222BinaryPlainPageBuilderILNS_9FieldTypeE27EE6finishEPNS_10OwnedSliceE Unexecuted instantiation: _ZN5doris10segment_v222BinaryPlainPageBuilderILNS_9FieldTypeE36EE6finishEPNS_10OwnedSliceE |
108 | | |
109 | 40.7k | Status reset() override { |
110 | 40.7k | RETURN_IF_CATCH_EXCEPTION({ |
111 | 40.7k | _offsets.clear(); |
112 | 40.7k | _buffer.clear(); |
113 | 40.7k | _buffer.reserve(_options.data_page_size == 0 |
114 | 40.7k | ? 1024 |
115 | 40.7k | : std::min(_options.data_page_size, _options.dict_page_size)); |
116 | 40.7k | _size_estimate = sizeof(uint32_t); |
117 | 40.7k | _finished = false; |
118 | 40.7k | _last_value_size = 0; |
119 | 40.7k | _raw_data_size = 0; |
120 | 40.7k | }); |
121 | 40.7k | return Status::OK(); |
122 | 40.7k | } Unexecuted instantiation: _ZN5doris10segment_v222BinaryPlainPageBuilderILNS_9FieldTypeE13EE5resetEv _ZN5doris10segment_v222BinaryPlainPageBuilderILNS_9FieldTypeE17EE5resetEv Line | Count | Source | 109 | 9.20k | Status reset() override { | 110 | 9.20k | RETURN_IF_CATCH_EXCEPTION({ | 111 | 9.20k | _offsets.clear(); | 112 | 9.20k | _buffer.clear(); | 113 | 9.20k | _buffer.reserve(_options.data_page_size == 0 | 114 | 9.20k | ? 1024 | 115 | 9.20k | : std::min(_options.data_page_size, _options.dict_page_size)); | 116 | 9.20k | _size_estimate = sizeof(uint32_t); | 117 | 9.20k | _finished = false; | 118 | 9.20k | _last_value_size = 0; | 119 | 9.20k | _raw_data_size = 0; | 120 | 9.20k | }); | 121 | 9.20k | return Status::OK(); | 122 | 9.20k | } |
Unexecuted instantiation: _ZN5doris10segment_v222BinaryPlainPageBuilderILNS_9FieldTypeE26EE5resetEv Unexecuted instantiation: _ZN5doris10segment_v222BinaryPlainPageBuilderILNS_9FieldTypeE34EE5resetEv Unexecuted instantiation: _ZN5doris10segment_v222BinaryPlainPageBuilderILNS_9FieldTypeE35EE5resetEv Unexecuted instantiation: _ZN5doris10segment_v222BinaryPlainPageBuilderILNS_9FieldTypeE23EE5resetEv _ZN5doris10segment_v222BinaryPlainPageBuilderILNS_9FieldTypeE25EE5resetEv Line | Count | Source | 109 | 31.5k | Status reset() override { | 110 | 31.5k | RETURN_IF_CATCH_EXCEPTION({ | 111 | 31.5k | _offsets.clear(); | 112 | 31.5k | _buffer.clear(); | 113 | 31.5k | _buffer.reserve(_options.data_page_size == 0 | 114 | 31.5k | ? 1024 | 115 | 31.5k | : std::min(_options.data_page_size, _options.dict_page_size)); | 116 | 31.5k | _size_estimate = sizeof(uint32_t); | 117 | 31.5k | _finished = false; | 118 | 31.5k | _last_value_size = 0; | 119 | 31.5k | _raw_data_size = 0; | 120 | 31.5k | }); | 121 | 31.5k | return Status::OK(); | 122 | 31.5k | } |
Unexecuted instantiation: _ZN5doris10segment_v222BinaryPlainPageBuilderILNS_9FieldTypeE27EE5resetEv Unexecuted instantiation: _ZN5doris10segment_v222BinaryPlainPageBuilderILNS_9FieldTypeE36EE5resetEv |
123 | | |
124 | 15.9k | size_t count() const override { return _offsets.size(); }Unexecuted instantiation: _ZNK5doris10segment_v222BinaryPlainPageBuilderILNS_9FieldTypeE13EE5countEv _ZNK5doris10segment_v222BinaryPlainPageBuilderILNS_9FieldTypeE17EE5countEv Line | Count | Source | 124 | 118 | size_t count() const override { return _offsets.size(); } |
Unexecuted instantiation: _ZNK5doris10segment_v222BinaryPlainPageBuilderILNS_9FieldTypeE26EE5countEv Unexecuted instantiation: _ZNK5doris10segment_v222BinaryPlainPageBuilderILNS_9FieldTypeE34EE5countEv Unexecuted instantiation: _ZNK5doris10segment_v222BinaryPlainPageBuilderILNS_9FieldTypeE35EE5countEv Unexecuted instantiation: _ZNK5doris10segment_v222BinaryPlainPageBuilderILNS_9FieldTypeE23EE5countEv _ZNK5doris10segment_v222BinaryPlainPageBuilderILNS_9FieldTypeE25EE5countEv Line | Count | Source | 124 | 15.7k | size_t count() const override { return _offsets.size(); } |
Unexecuted instantiation: _ZNK5doris10segment_v222BinaryPlainPageBuilderILNS_9FieldTypeE27EE5countEv Unexecuted instantiation: _ZNK5doris10segment_v222BinaryPlainPageBuilderILNS_9FieldTypeE36EE5countEv |
125 | | |
126 | 1.02k | uint64_t size() const override { return _size_estimate; }Unexecuted instantiation: _ZNK5doris10segment_v222BinaryPlainPageBuilderILNS_9FieldTypeE13EE4sizeEv _ZNK5doris10segment_v222BinaryPlainPageBuilderILNS_9FieldTypeE17EE4sizeEv Line | Count | Source | 126 | 1.02k | uint64_t size() const override { return _size_estimate; } |
Unexecuted instantiation: _ZNK5doris10segment_v222BinaryPlainPageBuilderILNS_9FieldTypeE26EE4sizeEv Unexecuted instantiation: _ZNK5doris10segment_v222BinaryPlainPageBuilderILNS_9FieldTypeE34EE4sizeEv Unexecuted instantiation: _ZNK5doris10segment_v222BinaryPlainPageBuilderILNS_9FieldTypeE35EE4sizeEv Unexecuted instantiation: _ZNK5doris10segment_v222BinaryPlainPageBuilderILNS_9FieldTypeE23EE4sizeEv Unexecuted instantiation: _ZNK5doris10segment_v222BinaryPlainPageBuilderILNS_9FieldTypeE25EE4sizeEv Unexecuted instantiation: _ZNK5doris10segment_v222BinaryPlainPageBuilderILNS_9FieldTypeE27EE4sizeEv Unexecuted instantiation: _ZNK5doris10segment_v222BinaryPlainPageBuilderILNS_9FieldTypeE36EE4sizeEv |
127 | | |
128 | 0 | uint64_t get_raw_data_size() const override { return _raw_data_size; }Unexecuted instantiation: _ZNK5doris10segment_v222BinaryPlainPageBuilderILNS_9FieldTypeE13EE17get_raw_data_sizeEv Unexecuted instantiation: _ZNK5doris10segment_v222BinaryPlainPageBuilderILNS_9FieldTypeE17EE17get_raw_data_sizeEv Unexecuted instantiation: _ZNK5doris10segment_v222BinaryPlainPageBuilderILNS_9FieldTypeE26EE17get_raw_data_sizeEv Unexecuted instantiation: _ZNK5doris10segment_v222BinaryPlainPageBuilderILNS_9FieldTypeE34EE17get_raw_data_sizeEv Unexecuted instantiation: _ZNK5doris10segment_v222BinaryPlainPageBuilderILNS_9FieldTypeE35EE17get_raw_data_sizeEv Unexecuted instantiation: _ZNK5doris10segment_v222BinaryPlainPageBuilderILNS_9FieldTypeE23EE17get_raw_data_sizeEv Unexecuted instantiation: _ZNK5doris10segment_v222BinaryPlainPageBuilderILNS_9FieldTypeE25EE17get_raw_data_sizeEv Unexecuted instantiation: _ZNK5doris10segment_v222BinaryPlainPageBuilderILNS_9FieldTypeE27EE17get_raw_data_sizeEv Unexecuted instantiation: _ZNK5doris10segment_v222BinaryPlainPageBuilderILNS_9FieldTypeE36EE17get_raw_data_sizeEv |
129 | | |
130 | | private: |
131 | | BinaryPlainPageBuilder(const PageBuilderOptions& options) |
132 | 21.3k | : _size_estimate(0), _options(options) {}Unexecuted instantiation: _ZN5doris10segment_v222BinaryPlainPageBuilderILNS_9FieldTypeE13EEC2ERKNS0_18PageBuilderOptionsE _ZN5doris10segment_v222BinaryPlainPageBuilderILNS_9FieldTypeE17EEC2ERKNS0_18PageBuilderOptionsE Line | Count | Source | 132 | 5.56k | : _size_estimate(0), _options(options) {} |
Unexecuted instantiation: _ZN5doris10segment_v222BinaryPlainPageBuilderILNS_9FieldTypeE26EEC2ERKNS0_18PageBuilderOptionsE Unexecuted instantiation: _ZN5doris10segment_v222BinaryPlainPageBuilderILNS_9FieldTypeE34EEC2ERKNS0_18PageBuilderOptionsE Unexecuted instantiation: _ZN5doris10segment_v222BinaryPlainPageBuilderILNS_9FieldTypeE35EEC2ERKNS0_18PageBuilderOptionsE Unexecuted instantiation: _ZN5doris10segment_v222BinaryPlainPageBuilderILNS_9FieldTypeE23EEC2ERKNS0_18PageBuilderOptionsE _ZN5doris10segment_v222BinaryPlainPageBuilderILNS_9FieldTypeE25EEC2ERKNS0_18PageBuilderOptionsE Line | Count | Source | 132 | 15.7k | : _size_estimate(0), _options(options) {} |
Unexecuted instantiation: _ZN5doris10segment_v222BinaryPlainPageBuilderILNS_9FieldTypeE27EEC2ERKNS0_18PageBuilderOptionsE Unexecuted instantiation: _ZN5doris10segment_v222BinaryPlainPageBuilderILNS_9FieldTypeE36EEC2ERKNS0_18PageBuilderOptionsE |
133 | | |
134 | | faststring _buffer; |
135 | | size_t _size_estimate; |
136 | | // Offsets of each entry, relative to the start of the page |
137 | | std::vector<uint32_t> _offsets; |
138 | | bool _finished; |
139 | | PageBuilderOptions _options; |
140 | | // size of last added value |
141 | | uint32_t _last_value_size = 0; |
142 | | uint64_t _raw_data_size = 0; |
143 | | }; |
144 | | |
145 | | template <FieldType Type> |
146 | | class BinaryPlainPageDecoder : public PageDecoder { |
147 | | public: |
148 | | BinaryPlainPageDecoder(Slice data) : BinaryPlainPageDecoder(data, PageDecoderOptions()) {} |
149 | | |
150 | | BinaryPlainPageDecoder(Slice data, const PageDecoderOptions& options) |
151 | 4.78k | : _data(data), |
152 | 4.78k | _options(options), |
153 | 4.78k | _parsed(false), |
154 | 4.78k | _num_elems(0), |
155 | 4.78k | _offsets_pos(0), |
156 | 4.78k | _cur_idx(0) {}_ZN5doris10segment_v222BinaryPlainPageDecoderILNS_9FieldTypeE17EEC2ENS_5SliceERKNS0_18PageDecoderOptionsE Line | Count | Source | 151 | 4.75k | : _data(data), | 152 | 4.75k | _options(options), | 153 | 4.75k | _parsed(false), | 154 | 4.75k | _num_elems(0), | 155 | 4.75k | _offsets_pos(0), | 156 | 4.75k | _cur_idx(0) {} |
_ZN5doris10segment_v222BinaryPlainPageDecoderILNS_9FieldTypeE26EEC2ENS_5SliceERKNS0_18PageDecoderOptionsE Line | Count | Source | 151 | 4 | : _data(data), | 152 | 4 | _options(options), | 153 | 4 | _parsed(false), | 154 | 4 | _num_elems(0), | 155 | 4 | _offsets_pos(0), | 156 | 4 | _cur_idx(0) {} |
_ZN5doris10segment_v222BinaryPlainPageDecoderILNS_9FieldTypeE13EEC2ENS_5SliceERKNS0_18PageDecoderOptionsE Line | Count | Source | 151 | 1 | : _data(data), | 152 | 1 | _options(options), | 153 | 1 | _parsed(false), | 154 | 1 | _num_elems(0), | 155 | 1 | _offsets_pos(0), | 156 | 1 | _cur_idx(0) {} |
Unexecuted instantiation: _ZN5doris10segment_v222BinaryPlainPageDecoderILNS_9FieldTypeE34EEC2ENS_5SliceERKNS0_18PageDecoderOptionsE Unexecuted instantiation: _ZN5doris10segment_v222BinaryPlainPageDecoderILNS_9FieldTypeE35EEC2ENS_5SliceERKNS0_18PageDecoderOptionsE Unexecuted instantiation: _ZN5doris10segment_v222BinaryPlainPageDecoderILNS_9FieldTypeE23EEC2ENS_5SliceERKNS0_18PageDecoderOptionsE _ZN5doris10segment_v222BinaryPlainPageDecoderILNS_9FieldTypeE25EEC2ENS_5SliceERKNS0_18PageDecoderOptionsE Line | Count | Source | 151 | 21 | : _data(data), | 152 | 21 | _options(options), | 153 | 21 | _parsed(false), | 154 | 21 | _num_elems(0), | 155 | 21 | _offsets_pos(0), | 156 | 21 | _cur_idx(0) {} |
Unexecuted instantiation: _ZN5doris10segment_v222BinaryPlainPageDecoderILNS_9FieldTypeE27EEC2ENS_5SliceERKNS0_18PageDecoderOptionsE Unexecuted instantiation: _ZN5doris10segment_v222BinaryPlainPageDecoderILNS_9FieldTypeE36EEC2ENS_5SliceERKNS0_18PageDecoderOptionsE |
157 | | |
158 | 4.78k | Status init() override { |
159 | 4.78k | CHECK(!_parsed); |
160 | | |
161 | 4.78k | if (_data.size < sizeof(uint32_t)) { |
162 | 0 | return Status::Corruption( |
163 | 0 | "file corruption: not enough bytes for trailer in BinaryPlainPageDecoder ." |
164 | 0 | "invalid data size:{}, trailer size:{}", |
165 | 0 | _data.size, sizeof(uint32_t)); |
166 | 0 | } |
167 | | |
168 | | // Decode trailer |
169 | 4.78k | _num_elems = decode_fixed32_le((const uint8_t*)&_data[_data.get_size() - sizeof(uint32_t)]); |
170 | 4.78k | _offsets_pos = cast_set<uint32_t>(_data.get_size() - ((_num_elems + 1) * sizeof(uint32_t))); |
171 | | |
172 | 4.78k | if (_offsets_pos > _data.get_size() - sizeof(uint32_t)) { |
173 | 0 | return Status::Corruption( |
174 | 0 | "file corruption: offsets pos beyonds data_size: {}, num_element: {}" |
175 | 0 | ", offset_pos: {}", |
176 | 0 | _data.size, _num_elems, _offsets_pos); |
177 | 0 | } |
178 | 4.78k | _parsed = true; |
179 | | |
180 | 4.78k | return Status::OK(); |
181 | 4.78k | } _ZN5doris10segment_v222BinaryPlainPageDecoderILNS_9FieldTypeE17EE4initEv Line | Count | Source | 158 | 4.75k | Status init() override { | 159 | 4.75k | CHECK(!_parsed); | 160 | | | 161 | 4.75k | if (_data.size < sizeof(uint32_t)) { | 162 | 0 | return Status::Corruption( | 163 | 0 | "file corruption: not enough bytes for trailer in BinaryPlainPageDecoder ." | 164 | 0 | "invalid data size:{}, trailer size:{}", | 165 | 0 | _data.size, sizeof(uint32_t)); | 166 | 0 | } | 167 | | | 168 | | // Decode trailer | 169 | 4.75k | _num_elems = decode_fixed32_le((const uint8_t*)&_data[_data.get_size() - sizeof(uint32_t)]); | 170 | 4.75k | _offsets_pos = cast_set<uint32_t>(_data.get_size() - ((_num_elems + 1) * sizeof(uint32_t))); | 171 | | | 172 | 4.75k | if (_offsets_pos > _data.get_size() - sizeof(uint32_t)) { | 173 | 0 | return Status::Corruption( | 174 | 0 | "file corruption: offsets pos beyonds data_size: {}, num_element: {}" | 175 | 0 | ", offset_pos: {}", | 176 | 0 | _data.size, _num_elems, _offsets_pos); | 177 | 0 | } | 178 | 4.75k | _parsed = true; | 179 | | | 180 | 4.75k | return Status::OK(); | 181 | 4.75k | } |
_ZN5doris10segment_v222BinaryPlainPageDecoderILNS_9FieldTypeE26EE4initEv Line | Count | Source | 158 | 4 | Status init() override { | 159 | 4 | CHECK(!_parsed); | 160 | | | 161 | 4 | if (_data.size < sizeof(uint32_t)) { | 162 | 0 | return Status::Corruption( | 163 | 0 | "file corruption: not enough bytes for trailer in BinaryPlainPageDecoder ." | 164 | 0 | "invalid data size:{}, trailer size:{}", | 165 | 0 | _data.size, sizeof(uint32_t)); | 166 | 0 | } | 167 | | | 168 | | // Decode trailer | 169 | 4 | _num_elems = decode_fixed32_le((const uint8_t*)&_data[_data.get_size() - sizeof(uint32_t)]); | 170 | 4 | _offsets_pos = cast_set<uint32_t>(_data.get_size() - ((_num_elems + 1) * sizeof(uint32_t))); | 171 | | | 172 | 4 | if (_offsets_pos > _data.get_size() - sizeof(uint32_t)) { | 173 | 0 | return Status::Corruption( | 174 | 0 | "file corruption: offsets pos beyonds data_size: {}, num_element: {}" | 175 | 0 | ", offset_pos: {}", | 176 | 0 | _data.size, _num_elems, _offsets_pos); | 177 | 0 | } | 178 | 4 | _parsed = true; | 179 | | | 180 | 4 | return Status::OK(); | 181 | 4 | } |
_ZN5doris10segment_v222BinaryPlainPageDecoderILNS_9FieldTypeE13EE4initEv Line | Count | Source | 158 | 1 | Status init() override { | 159 | 1 | CHECK(!_parsed); | 160 | | | 161 | 1 | if (_data.size < sizeof(uint32_t)) { | 162 | 0 | return Status::Corruption( | 163 | 0 | "file corruption: not enough bytes for trailer in BinaryPlainPageDecoder ." | 164 | 0 | "invalid data size:{}, trailer size:{}", | 165 | 0 | _data.size, sizeof(uint32_t)); | 166 | 0 | } | 167 | | | 168 | | // Decode trailer | 169 | 1 | _num_elems = decode_fixed32_le((const uint8_t*)&_data[_data.get_size() - sizeof(uint32_t)]); | 170 | 1 | _offsets_pos = cast_set<uint32_t>(_data.get_size() - ((_num_elems + 1) * sizeof(uint32_t))); | 171 | | | 172 | 1 | if (_offsets_pos > _data.get_size() - sizeof(uint32_t)) { | 173 | 0 | return Status::Corruption( | 174 | 0 | "file corruption: offsets pos beyonds data_size: {}, num_element: {}" | 175 | 0 | ", offset_pos: {}", | 176 | 0 | _data.size, _num_elems, _offsets_pos); | 177 | 0 | } | 178 | 1 | _parsed = true; | 179 | | | 180 | 1 | return Status::OK(); | 181 | 1 | } |
Unexecuted instantiation: _ZN5doris10segment_v222BinaryPlainPageDecoderILNS_9FieldTypeE34EE4initEv Unexecuted instantiation: _ZN5doris10segment_v222BinaryPlainPageDecoderILNS_9FieldTypeE35EE4initEv Unexecuted instantiation: _ZN5doris10segment_v222BinaryPlainPageDecoderILNS_9FieldTypeE23EE4initEv _ZN5doris10segment_v222BinaryPlainPageDecoderILNS_9FieldTypeE25EE4initEv Line | Count | Source | 158 | 21 | Status init() override { | 159 | 21 | CHECK(!_parsed); | 160 | | | 161 | 21 | if (_data.size < sizeof(uint32_t)) { | 162 | 0 | return Status::Corruption( | 163 | 0 | "file corruption: not enough bytes for trailer in BinaryPlainPageDecoder ." | 164 | 0 | "invalid data size:{}, trailer size:{}", | 165 | 0 | _data.size, sizeof(uint32_t)); | 166 | 0 | } | 167 | | | 168 | | // Decode trailer | 169 | 21 | _num_elems = decode_fixed32_le((const uint8_t*)&_data[_data.get_size() - sizeof(uint32_t)]); | 170 | 21 | _offsets_pos = cast_set<uint32_t>(_data.get_size() - ((_num_elems + 1) * sizeof(uint32_t))); | 171 | | | 172 | 21 | if (_offsets_pos > _data.get_size() - sizeof(uint32_t)) { | 173 | 0 | return Status::Corruption( | 174 | 0 | "file corruption: offsets pos beyonds data_size: {}, num_element: {}" | 175 | 0 | ", offset_pos: {}", | 176 | 0 | _data.size, _num_elems, _offsets_pos); | 177 | 0 | } | 178 | 21 | _parsed = true; | 179 | | | 180 | 21 | return Status::OK(); | 181 | 21 | } |
Unexecuted instantiation: _ZN5doris10segment_v222BinaryPlainPageDecoderILNS_9FieldTypeE27EE4initEv Unexecuted instantiation: _ZN5doris10segment_v222BinaryPlainPageDecoderILNS_9FieldTypeE36EE4initEv |
182 | | |
183 | 238 | Status seek_to_position_in_page(size_t pos) override { |
184 | 238 | if (_num_elems == 0) [[unlikely]] { |
185 | 0 | if (pos != 0) { |
186 | 0 | return Status::Error<ErrorCode::INTERNAL_ERROR, false>( |
187 | 0 | "seek pos {} is larger than total elements {}", pos, _num_elems); |
188 | 0 | } |
189 | 0 | } |
190 | 238 | DCHECK_LE(pos, _num_elems); |
191 | 238 | _cur_idx = pos; |
192 | 238 | return Status::OK(); |
193 | 238 | } _ZN5doris10segment_v222BinaryPlainPageDecoderILNS_9FieldTypeE17EE24seek_to_position_in_pageEm Line | Count | Source | 183 | 191 | Status seek_to_position_in_page(size_t pos) override { | 184 | 191 | if (_num_elems == 0) [[unlikely]] { | 185 | 0 | if (pos != 0) { | 186 | 0 | return Status::Error<ErrorCode::INTERNAL_ERROR, false>( | 187 | 0 | "seek pos {} is larger than total elements {}", pos, _num_elems); | 188 | 0 | } | 189 | 0 | } | 190 | 191 | DCHECK_LE(pos, _num_elems); | 191 | 191 | _cur_idx = pos; | 192 | 191 | return Status::OK(); | 193 | 191 | } |
_ZN5doris10segment_v222BinaryPlainPageDecoderILNS_9FieldTypeE26EE24seek_to_position_in_pageEm Line | Count | Source | 183 | 4 | Status seek_to_position_in_page(size_t pos) override { | 184 | 4 | if (_num_elems == 0) [[unlikely]] { | 185 | 0 | if (pos != 0) { | 186 | 0 | return Status::Error<ErrorCode::INTERNAL_ERROR, false>( | 187 | 0 | "seek pos {} is larger than total elements {}", pos, _num_elems); | 188 | 0 | } | 189 | 0 | } | 190 | 4 | DCHECK_LE(pos, _num_elems); | 191 | 4 | _cur_idx = pos; | 192 | 4 | return Status::OK(); | 193 | 4 | } |
Unexecuted instantiation: _ZN5doris10segment_v222BinaryPlainPageDecoderILNS_9FieldTypeE13EE24seek_to_position_in_pageEm Unexecuted instantiation: _ZN5doris10segment_v222BinaryPlainPageDecoderILNS_9FieldTypeE34EE24seek_to_position_in_pageEm Unexecuted instantiation: _ZN5doris10segment_v222BinaryPlainPageDecoderILNS_9FieldTypeE35EE24seek_to_position_in_pageEm Unexecuted instantiation: _ZN5doris10segment_v222BinaryPlainPageDecoderILNS_9FieldTypeE23EE24seek_to_position_in_pageEm _ZN5doris10segment_v222BinaryPlainPageDecoderILNS_9FieldTypeE25EE24seek_to_position_in_pageEm Line | Count | Source | 183 | 43 | Status seek_to_position_in_page(size_t pos) override { | 184 | 43 | if (_num_elems == 0) [[unlikely]] { | 185 | 0 | if (pos != 0) { | 186 | 0 | return Status::Error<ErrorCode::INTERNAL_ERROR, false>( | 187 | 0 | "seek pos {} is larger than total elements {}", pos, _num_elems); | 188 | 0 | } | 189 | 0 | } | 190 | 43 | DCHECK_LE(pos, _num_elems); | 191 | 43 | _cur_idx = pos; | 192 | 43 | return Status::OK(); | 193 | 43 | } |
Unexecuted instantiation: _ZN5doris10segment_v222BinaryPlainPageDecoderILNS_9FieldTypeE27EE24seek_to_position_in_pageEm Unexecuted instantiation: _ZN5doris10segment_v222BinaryPlainPageDecoderILNS_9FieldTypeE36EE24seek_to_position_in_pageEm |
194 | | |
195 | 1.56k | Status next_batch(size_t* n, MutableColumnPtr& dst) override { |
196 | 1.56k | DCHECK(_parsed); |
197 | 1.56k | if (*n == 0 || _cur_idx >= _num_elems) [[unlikely]] { |
198 | 2 | *n = 0; |
199 | 2 | return Status::OK(); |
200 | 2 | } |
201 | 1.56k | const size_t max_fetch = std::min(*n, static_cast<size_t>(_num_elems - _cur_idx)); |
202 | | |
203 | 1.56k | if (_options.only_read_offsets) { |
204 | | // OFFSET_ONLY mode: read string lengths from page offset trailer |
205 | | // without copying actual char data. This allows length() to work. |
206 | 0 | _offsets.resize(max_fetch); |
207 | 0 | for (size_t i = 0; i < max_fetch; ++i) { |
208 | 0 | uint32_t str_start = offset(_cur_idx + i); |
209 | 0 | uint32_t str_end = offset(_cur_idx + i + 1); |
210 | 0 | _offsets[i] = str_end - str_start; |
211 | 0 | } |
212 | 0 | dst->insert_offsets_from_lengths(_offsets.data(), max_fetch); |
213 | 0 | _cur_idx += max_fetch; |
214 | 0 | *n = max_fetch; |
215 | 0 | return Status::OK(); |
216 | 0 | } |
217 | | |
218 | 1.56k | uint32_t last_offset = guarded_offset(_cur_idx); |
219 | 1.56k | _offsets.resize(max_fetch + 1); |
220 | 1.56k | _offsets[0] = last_offset; |
221 | 305k | for (int i = 0; i < max_fetch - 1; i++, _cur_idx++) { |
222 | 303k | const uint32_t start_offset = last_offset; |
223 | 303k | last_offset = guarded_offset(_cur_idx + 1); |
224 | 303k | _offsets[i + 1] = last_offset; |
225 | 303k | if constexpr (Type == FieldType::OLAP_FIELD_TYPE_BITMAP) { |
226 | 0 | if (_options.need_check_bitmap) { |
227 | 0 | RETURN_IF_ERROR(BitmapTypeCode::validate(*(_data.data + start_offset))); |
228 | 0 | } |
229 | 0 | } |
230 | 303k | } |
231 | 1.56k | _cur_idx++; |
232 | 1.56k | _offsets[max_fetch] = offset(_cur_idx); |
233 | 1.56k | if constexpr (Type == FieldType::OLAP_FIELD_TYPE_BITMAP) { |
234 | 43 | if (_options.need_check_bitmap) { |
235 | 0 | RETURN_IF_ERROR(BitmapTypeCode::validate(*(_data.data + last_offset))); |
236 | 0 | } |
237 | 43 | } |
238 | 43 | dst->insert_many_continuous_binary_data(_data.data, _offsets.data(), max_fetch); |
239 | | |
240 | 1.56k | *n = max_fetch; |
241 | 1.56k | return Status::OK(); |
242 | 1.56k | } _ZN5doris10segment_v222BinaryPlainPageDecoderILNS_9FieldTypeE17EE10next_batchEPmRNS_3COWINS_7IColumnEE11mutable_ptrIS6_EE Line | Count | Source | 195 | 1.51k | Status next_batch(size_t* n, MutableColumnPtr& dst) override { | 196 | 1.51k | DCHECK(_parsed); | 197 | 1.51k | if (*n == 0 || _cur_idx >= _num_elems) [[unlikely]] { | 198 | 1 | *n = 0; | 199 | 1 | return Status::OK(); | 200 | 1 | } | 201 | 1.51k | const size_t max_fetch = std::min(*n, static_cast<size_t>(_num_elems - _cur_idx)); | 202 | | | 203 | 1.51k | if (_options.only_read_offsets) { | 204 | | // OFFSET_ONLY mode: read string lengths from page offset trailer | 205 | | // without copying actual char data. This allows length() to work. | 206 | 0 | _offsets.resize(max_fetch); | 207 | 0 | for (size_t i = 0; i < max_fetch; ++i) { | 208 | 0 | uint32_t str_start = offset(_cur_idx + i); | 209 | 0 | uint32_t str_end = offset(_cur_idx + i + 1); | 210 | 0 | _offsets[i] = str_end - str_start; | 211 | 0 | } | 212 | 0 | dst->insert_offsets_from_lengths(_offsets.data(), max_fetch); | 213 | 0 | _cur_idx += max_fetch; | 214 | 0 | *n = max_fetch; | 215 | 0 | return Status::OK(); | 216 | 0 | } | 217 | | | 218 | 1.51k | uint32_t last_offset = guarded_offset(_cur_idx); | 219 | 1.51k | _offsets.resize(max_fetch + 1); | 220 | 1.51k | _offsets[0] = last_offset; | 221 | 305k | for (int i = 0; i < max_fetch - 1; i++, _cur_idx++) { | 222 | 303k | const uint32_t start_offset = last_offset; | 223 | 303k | last_offset = guarded_offset(_cur_idx + 1); | 224 | 303k | _offsets[i + 1] = last_offset; | 225 | | if constexpr (Type == FieldType::OLAP_FIELD_TYPE_BITMAP) { | 226 | | if (_options.need_check_bitmap) { | 227 | | RETURN_IF_ERROR(BitmapTypeCode::validate(*(_data.data + start_offset))); | 228 | | } | 229 | | } | 230 | 303k | } | 231 | 1.51k | _cur_idx++; | 232 | 1.51k | _offsets[max_fetch] = offset(_cur_idx); | 233 | | if constexpr (Type == FieldType::OLAP_FIELD_TYPE_BITMAP) { | 234 | | if (_options.need_check_bitmap) { | 235 | | RETURN_IF_ERROR(BitmapTypeCode::validate(*(_data.data + last_offset))); | 236 | | } | 237 | | } | 238 | 1.51k | dst->insert_many_continuous_binary_data(_data.data, _offsets.data(), max_fetch); | 239 | | | 240 | 1.51k | *n = max_fetch; | 241 | 1.51k | return Status::OK(); | 242 | 1.51k | } |
_ZN5doris10segment_v222BinaryPlainPageDecoderILNS_9FieldTypeE26EE10next_batchEPmRNS_3COWINS_7IColumnEE11mutable_ptrIS6_EE Line | Count | Source | 195 | 6 | Status next_batch(size_t* n, MutableColumnPtr& dst) override { | 196 | 6 | DCHECK(_parsed); | 197 | 6 | if (*n == 0 || _cur_idx >= _num_elems) [[unlikely]] { | 198 | 1 | *n = 0; | 199 | 1 | return Status::OK(); | 200 | 1 | } | 201 | 5 | const size_t max_fetch = std::min(*n, static_cast<size_t>(_num_elems - _cur_idx)); | 202 | | | 203 | 5 | if (_options.only_read_offsets) { | 204 | | // OFFSET_ONLY mode: read string lengths from page offset trailer | 205 | | // without copying actual char data. This allows length() to work. | 206 | 0 | _offsets.resize(max_fetch); | 207 | 0 | for (size_t i = 0; i < max_fetch; ++i) { | 208 | 0 | uint32_t str_start = offset(_cur_idx + i); | 209 | 0 | uint32_t str_end = offset(_cur_idx + i + 1); | 210 | 0 | _offsets[i] = str_end - str_start; | 211 | 0 | } | 212 | 0 | dst->insert_offsets_from_lengths(_offsets.data(), max_fetch); | 213 | 0 | _cur_idx += max_fetch; | 214 | 0 | *n = max_fetch; | 215 | 0 | return Status::OK(); | 216 | 0 | } | 217 | | | 218 | 5 | uint32_t last_offset = guarded_offset(_cur_idx); | 219 | 5 | _offsets.resize(max_fetch + 1); | 220 | 5 | _offsets[0] = last_offset; | 221 | 7 | for (int i = 0; i < max_fetch - 1; i++, _cur_idx++) { | 222 | 2 | const uint32_t start_offset = last_offset; | 223 | 2 | last_offset = guarded_offset(_cur_idx + 1); | 224 | 2 | _offsets[i + 1] = last_offset; | 225 | | if constexpr (Type == FieldType::OLAP_FIELD_TYPE_BITMAP) { | 226 | | if (_options.need_check_bitmap) { | 227 | | RETURN_IF_ERROR(BitmapTypeCode::validate(*(_data.data + start_offset))); | 228 | | } | 229 | | } | 230 | 2 | } | 231 | 5 | _cur_idx++; | 232 | 5 | _offsets[max_fetch] = offset(_cur_idx); | 233 | | if constexpr (Type == FieldType::OLAP_FIELD_TYPE_BITMAP) { | 234 | | if (_options.need_check_bitmap) { | 235 | | RETURN_IF_ERROR(BitmapTypeCode::validate(*(_data.data + last_offset))); | 236 | | } | 237 | | } | 238 | 5 | dst->insert_many_continuous_binary_data(_data.data, _offsets.data(), max_fetch); | 239 | | | 240 | 5 | *n = max_fetch; | 241 | 5 | return Status::OK(); | 242 | 5 | } |
_ZN5doris10segment_v222BinaryPlainPageDecoderILNS_9FieldTypeE13EE10next_batchEPmRNS_3COWINS_7IColumnEE11mutable_ptrIS6_EE Line | Count | Source | 195 | 1 | Status next_batch(size_t* n, MutableColumnPtr& dst) override { | 196 | 1 | DCHECK(_parsed); | 197 | 1 | if (*n == 0 || _cur_idx >= _num_elems) [[unlikely]] { | 198 | 0 | *n = 0; | 199 | 0 | return Status::OK(); | 200 | 0 | } | 201 | 1 | const size_t max_fetch = std::min(*n, static_cast<size_t>(_num_elems - _cur_idx)); | 202 | | | 203 | 1 | if (_options.only_read_offsets) { | 204 | | // OFFSET_ONLY mode: read string lengths from page offset trailer | 205 | | // without copying actual char data. This allows length() to work. | 206 | 0 | _offsets.resize(max_fetch); | 207 | 0 | for (size_t i = 0; i < max_fetch; ++i) { | 208 | 0 | uint32_t str_start = offset(_cur_idx + i); | 209 | 0 | uint32_t str_end = offset(_cur_idx + i + 1); | 210 | 0 | _offsets[i] = str_end - str_start; | 211 | 0 | } | 212 | 0 | dst->insert_offsets_from_lengths(_offsets.data(), max_fetch); | 213 | 0 | _cur_idx += max_fetch; | 214 | 0 | *n = max_fetch; | 215 | 0 | return Status::OK(); | 216 | 0 | } | 217 | | | 218 | 1 | uint32_t last_offset = guarded_offset(_cur_idx); | 219 | 1 | _offsets.resize(max_fetch + 1); | 220 | 1 | _offsets[0] = last_offset; | 221 | 3 | for (int i = 0; i < max_fetch - 1; i++, _cur_idx++) { | 222 | 2 | const uint32_t start_offset = last_offset; | 223 | 2 | last_offset = guarded_offset(_cur_idx + 1); | 224 | 2 | _offsets[i + 1] = last_offset; | 225 | | if constexpr (Type == FieldType::OLAP_FIELD_TYPE_BITMAP) { | 226 | | if (_options.need_check_bitmap) { | 227 | | RETURN_IF_ERROR(BitmapTypeCode::validate(*(_data.data + start_offset))); | 228 | | } | 229 | | } | 230 | 2 | } | 231 | 1 | _cur_idx++; | 232 | 1 | _offsets[max_fetch] = offset(_cur_idx); | 233 | | if constexpr (Type == FieldType::OLAP_FIELD_TYPE_BITMAP) { | 234 | | if (_options.need_check_bitmap) { | 235 | | RETURN_IF_ERROR(BitmapTypeCode::validate(*(_data.data + last_offset))); | 236 | | } | 237 | | } | 238 | 1 | dst->insert_many_continuous_binary_data(_data.data, _offsets.data(), max_fetch); | 239 | | | 240 | 1 | *n = max_fetch; | 241 | 1 | return Status::OK(); | 242 | 1 | } |
Unexecuted instantiation: _ZN5doris10segment_v222BinaryPlainPageDecoderILNS_9FieldTypeE34EE10next_batchEPmRNS_3COWINS_7IColumnEE11mutable_ptrIS6_EE Unexecuted instantiation: _ZN5doris10segment_v222BinaryPlainPageDecoderILNS_9FieldTypeE35EE10next_batchEPmRNS_3COWINS_7IColumnEE11mutable_ptrIS6_EE Unexecuted instantiation: _ZN5doris10segment_v222BinaryPlainPageDecoderILNS_9FieldTypeE23EE10next_batchEPmRNS_3COWINS_7IColumnEE11mutable_ptrIS6_EE _ZN5doris10segment_v222BinaryPlainPageDecoderILNS_9FieldTypeE25EE10next_batchEPmRNS_3COWINS_7IColumnEE11mutable_ptrIS6_EE Line | Count | Source | 195 | 43 | Status next_batch(size_t* n, MutableColumnPtr& dst) override { | 196 | 43 | DCHECK(_parsed); | 197 | 43 | if (*n == 0 || _cur_idx >= _num_elems) [[unlikely]] { | 198 | 0 | *n = 0; | 199 | 0 | return Status::OK(); | 200 | 0 | } | 201 | 43 | const size_t max_fetch = std::min(*n, static_cast<size_t>(_num_elems - _cur_idx)); | 202 | | | 203 | 43 | if (_options.only_read_offsets) { | 204 | | // OFFSET_ONLY mode: read string lengths from page offset trailer | 205 | | // without copying actual char data. This allows length() to work. | 206 | 0 | _offsets.resize(max_fetch); | 207 | 0 | for (size_t i = 0; i < max_fetch; ++i) { | 208 | 0 | uint32_t str_start = offset(_cur_idx + i); | 209 | 0 | uint32_t str_end = offset(_cur_idx + i + 1); | 210 | 0 | _offsets[i] = str_end - str_start; | 211 | 0 | } | 212 | 0 | dst->insert_offsets_from_lengths(_offsets.data(), max_fetch); | 213 | 0 | _cur_idx += max_fetch; | 214 | 0 | *n = max_fetch; | 215 | 0 | return Status::OK(); | 216 | 0 | } | 217 | | | 218 | 43 | uint32_t last_offset = guarded_offset(_cur_idx); | 219 | 43 | _offsets.resize(max_fetch + 1); | 220 | 43 | _offsets[0] = last_offset; | 221 | 43 | for (int i = 0; i < max_fetch - 1; i++, _cur_idx++) { | 222 | 0 | const uint32_t start_offset = last_offset; | 223 | 0 | last_offset = guarded_offset(_cur_idx + 1); | 224 | 0 | _offsets[i + 1] = last_offset; | 225 | 0 | if constexpr (Type == FieldType::OLAP_FIELD_TYPE_BITMAP) { | 226 | 0 | if (_options.need_check_bitmap) { | 227 | 0 | RETURN_IF_ERROR(BitmapTypeCode::validate(*(_data.data + start_offset))); | 228 | 0 | } | 229 | 0 | } | 230 | 0 | } | 231 | 43 | _cur_idx++; | 232 | 43 | _offsets[max_fetch] = offset(_cur_idx); | 233 | 43 | if constexpr (Type == FieldType::OLAP_FIELD_TYPE_BITMAP) { | 234 | 43 | if (_options.need_check_bitmap) { | 235 | 0 | RETURN_IF_ERROR(BitmapTypeCode::validate(*(_data.data + last_offset))); | 236 | 0 | } | 237 | 43 | } | 238 | 43 | dst->insert_many_continuous_binary_data(_data.data, _offsets.data(), max_fetch); | 239 | | | 240 | 43 | *n = max_fetch; | 241 | 43 | return Status::OK(); | 242 | 43 | } |
Unexecuted instantiation: _ZN5doris10segment_v222BinaryPlainPageDecoderILNS_9FieldTypeE27EE10next_batchEPmRNS_3COWINS_7IColumnEE11mutable_ptrIS6_EE Unexecuted instantiation: _ZN5doris10segment_v222BinaryPlainPageDecoderILNS_9FieldTypeE36EE10next_batchEPmRNS_3COWINS_7IColumnEE11mutable_ptrIS6_EE |
243 | | |
244 | | Status read_by_rowids(const rowid_t* rowids, ordinal_t page_first_ordinal, size_t* n, |
245 | 509 | MutableColumnPtr& dst) override { |
246 | 509 | DCHECK(_parsed); |
247 | 509 | if (*n == 0) [[unlikely]] { |
248 | 0 | *n = 0; |
249 | 0 | return Status::OK(); |
250 | 0 | } |
251 | | |
252 | 509 | auto total = *n; |
253 | | |
254 | 509 | if (_options.only_read_offsets) { |
255 | | // OFFSET_ONLY mode: read string lengths from page offset trailer |
256 | | // without copying actual char data. This allows length() to work. |
257 | 0 | size_t read_count = 0; |
258 | 0 | _offsets.resize(total); |
259 | 0 | for (size_t i = 0; i < total; ++i) { |
260 | 0 | ordinal_t ord = rowids[i] - page_first_ordinal; |
261 | 0 | if (UNLIKELY(ord >= _num_elems)) { |
262 | 0 | break; |
263 | 0 | } |
264 | 0 | uint32_t str_start = offset(ord); |
265 | 0 | uint32_t str_end = offset(ord + 1); |
266 | 0 | _offsets[read_count] = str_end - str_start; |
267 | 0 | read_count++; |
268 | 0 | } |
269 | 0 | if (read_count > 0) { |
270 | 0 | dst->insert_offsets_from_lengths(_offsets.data(), read_count); |
271 | 0 | } |
272 | 0 | *n = read_count; |
273 | 0 | return Status::OK(); |
274 | 0 | } |
275 | | |
276 | 509 | size_t read_count = 0; |
277 | 509 | _binary_data.resize(total); |
278 | 2.27k | for (size_t i = 0; i < total; ++i) { |
279 | 1.76k | ordinal_t ord = rowids[i] - page_first_ordinal; |
280 | 1.76k | if (UNLIKELY(ord >= _num_elems)) { |
281 | 0 | break; |
282 | 0 | } |
283 | | |
284 | 1.76k | const uint32_t start_offset = offset(ord); |
285 | 1.76k | _binary_data[read_count].data = _data.mutable_data() + start_offset; |
286 | 1.76k | _binary_data[read_count].size = offset(ord + 1) - start_offset; |
287 | 1.76k | read_count++; |
288 | 1.76k | } |
289 | | |
290 | 509 | if (LIKELY(read_count > 0)) { |
291 | 509 | dst->insert_many_strings(_binary_data.data(), read_count); |
292 | 509 | } |
293 | | |
294 | 509 | *n = read_count; |
295 | 509 | return Status::OK(); |
296 | 509 | } _ZN5doris10segment_v222BinaryPlainPageDecoderILNS_9FieldTypeE17EE14read_by_rowidsEPKjmPmRNS_3COWINS_7IColumnEE11mutable_ptrIS8_EE Line | Count | Source | 245 | 508 | MutableColumnPtr& dst) override { | 246 | 508 | DCHECK(_parsed); | 247 | 508 | if (*n == 0) [[unlikely]] { | 248 | 0 | *n = 0; | 249 | 0 | return Status::OK(); | 250 | 0 | } | 251 | | | 252 | 508 | auto total = *n; | 253 | | | 254 | 508 | if (_options.only_read_offsets) { | 255 | | // OFFSET_ONLY mode: read string lengths from page offset trailer | 256 | | // without copying actual char data. This allows length() to work. | 257 | 0 | size_t read_count = 0; | 258 | 0 | _offsets.resize(total); | 259 | 0 | for (size_t i = 0; i < total; ++i) { | 260 | 0 | ordinal_t ord = rowids[i] - page_first_ordinal; | 261 | 0 | if (UNLIKELY(ord >= _num_elems)) { | 262 | 0 | break; | 263 | 0 | } | 264 | 0 | uint32_t str_start = offset(ord); | 265 | 0 | uint32_t str_end = offset(ord + 1); | 266 | 0 | _offsets[read_count] = str_end - str_start; | 267 | 0 | read_count++; | 268 | 0 | } | 269 | 0 | if (read_count > 0) { | 270 | 0 | dst->insert_offsets_from_lengths(_offsets.data(), read_count); | 271 | 0 | } | 272 | 0 | *n = read_count; | 273 | 0 | return Status::OK(); | 274 | 0 | } | 275 | | | 276 | 508 | size_t read_count = 0; | 277 | 508 | _binary_data.resize(total); | 278 | 2.26k | for (size_t i = 0; i < total; ++i) { | 279 | 1.76k | ordinal_t ord = rowids[i] - page_first_ordinal; | 280 | 1.76k | if (UNLIKELY(ord >= _num_elems)) { | 281 | 0 | break; | 282 | 0 | } | 283 | | | 284 | 1.76k | const uint32_t start_offset = offset(ord); | 285 | 1.76k | _binary_data[read_count].data = _data.mutable_data() + start_offset; | 286 | 1.76k | _binary_data[read_count].size = offset(ord + 1) - start_offset; | 287 | 1.76k | read_count++; | 288 | 1.76k | } | 289 | | | 290 | 508 | if (LIKELY(read_count > 0)) { | 291 | 508 | dst->insert_many_strings(_binary_data.data(), read_count); | 292 | 508 | } | 293 | | | 294 | 508 | *n = read_count; | 295 | 508 | return Status::OK(); | 296 | 508 | } |
_ZN5doris10segment_v222BinaryPlainPageDecoderILNS_9FieldTypeE26EE14read_by_rowidsEPKjmPmRNS_3COWINS_7IColumnEE11mutable_ptrIS8_EE Line | Count | Source | 245 | 1 | MutableColumnPtr& dst) override { | 246 | 1 | DCHECK(_parsed); | 247 | 1 | if (*n == 0) [[unlikely]] { | 248 | 0 | *n = 0; | 249 | 0 | return Status::OK(); | 250 | 0 | } | 251 | | | 252 | 1 | auto total = *n; | 253 | | | 254 | 1 | if (_options.only_read_offsets) { | 255 | | // OFFSET_ONLY mode: read string lengths from page offset trailer | 256 | | // without copying actual char data. This allows length() to work. | 257 | 0 | size_t read_count = 0; | 258 | 0 | _offsets.resize(total); | 259 | 0 | for (size_t i = 0; i < total; ++i) { | 260 | 0 | ordinal_t ord = rowids[i] - page_first_ordinal; | 261 | 0 | if (UNLIKELY(ord >= _num_elems)) { | 262 | 0 | break; | 263 | 0 | } | 264 | 0 | uint32_t str_start = offset(ord); | 265 | 0 | uint32_t str_end = offset(ord + 1); | 266 | 0 | _offsets[read_count] = str_end - str_start; | 267 | 0 | read_count++; | 268 | 0 | } | 269 | 0 | if (read_count > 0) { | 270 | 0 | dst->insert_offsets_from_lengths(_offsets.data(), read_count); | 271 | 0 | } | 272 | 0 | *n = read_count; | 273 | 0 | return Status::OK(); | 274 | 0 | } | 275 | | | 276 | 1 | size_t read_count = 0; | 277 | 1 | _binary_data.resize(total); | 278 | 5 | for (size_t i = 0; i < total; ++i) { | 279 | 4 | ordinal_t ord = rowids[i] - page_first_ordinal; | 280 | 4 | if (UNLIKELY(ord >= _num_elems)) { | 281 | 0 | break; | 282 | 0 | } | 283 | | | 284 | 4 | const uint32_t start_offset = offset(ord); | 285 | 4 | _binary_data[read_count].data = _data.mutable_data() + start_offset; | 286 | 4 | _binary_data[read_count].size = offset(ord + 1) - start_offset; | 287 | 4 | read_count++; | 288 | 4 | } | 289 | | | 290 | 1 | if (LIKELY(read_count > 0)) { | 291 | 1 | dst->insert_many_strings(_binary_data.data(), read_count); | 292 | 1 | } | 293 | | | 294 | 1 | *n = read_count; | 295 | 1 | return Status::OK(); | 296 | 1 | } |
Unexecuted instantiation: _ZN5doris10segment_v222BinaryPlainPageDecoderILNS_9FieldTypeE13EE14read_by_rowidsEPKjmPmRNS_3COWINS_7IColumnEE11mutable_ptrIS8_EE Unexecuted instantiation: _ZN5doris10segment_v222BinaryPlainPageDecoderILNS_9FieldTypeE34EE14read_by_rowidsEPKjmPmRNS_3COWINS_7IColumnEE11mutable_ptrIS8_EE Unexecuted instantiation: _ZN5doris10segment_v222BinaryPlainPageDecoderILNS_9FieldTypeE35EE14read_by_rowidsEPKjmPmRNS_3COWINS_7IColumnEE11mutable_ptrIS8_EE Unexecuted instantiation: _ZN5doris10segment_v222BinaryPlainPageDecoderILNS_9FieldTypeE23EE14read_by_rowidsEPKjmPmRNS_3COWINS_7IColumnEE11mutable_ptrIS8_EE Unexecuted instantiation: _ZN5doris10segment_v222BinaryPlainPageDecoderILNS_9FieldTypeE25EE14read_by_rowidsEPKjmPmRNS_3COWINS_7IColumnEE11mutable_ptrIS8_EE Unexecuted instantiation: _ZN5doris10segment_v222BinaryPlainPageDecoderILNS_9FieldTypeE27EE14read_by_rowidsEPKjmPmRNS_3COWINS_7IColumnEE11mutable_ptrIS8_EE Unexecuted instantiation: _ZN5doris10segment_v222BinaryPlainPageDecoderILNS_9FieldTypeE36EE14read_by_rowidsEPKjmPmRNS_3COWINS_7IColumnEE11mutable_ptrIS8_EE |
297 | | |
298 | 5.57k | size_t count() const override { |
299 | 5.57k | DCHECK(_parsed); |
300 | 5.57k | return _num_elems; |
301 | 5.57k | } _ZNK5doris10segment_v222BinaryPlainPageDecoderILNS_9FieldTypeE17EE5countEv Line | Count | Source | 298 | 5.57k | size_t count() const override { | 299 | | DCHECK(_parsed); | 300 | 5.57k | return _num_elems; | 301 | 5.57k | } |
_ZNK5doris10segment_v222BinaryPlainPageDecoderILNS_9FieldTypeE26EE5countEv Line | Count | Source | 298 | 2 | size_t count() const override { | 299 | | DCHECK(_parsed); | 300 | 2 | return _num_elems; | 301 | 2 | } |
_ZNK5doris10segment_v222BinaryPlainPageDecoderILNS_9FieldTypeE13EE5countEv Line | Count | Source | 298 | 1 | size_t count() const override { | 299 | | DCHECK(_parsed); | 300 | 1 | return _num_elems; | 301 | 1 | } |
Unexecuted instantiation: _ZNK5doris10segment_v222BinaryPlainPageDecoderILNS_9FieldTypeE34EE5countEv Unexecuted instantiation: _ZNK5doris10segment_v222BinaryPlainPageDecoderILNS_9FieldTypeE35EE5countEv Unexecuted instantiation: _ZNK5doris10segment_v222BinaryPlainPageDecoderILNS_9FieldTypeE23EE5countEv Unexecuted instantiation: _ZNK5doris10segment_v222BinaryPlainPageDecoderILNS_9FieldTypeE25EE5countEv Unexecuted instantiation: _ZNK5doris10segment_v222BinaryPlainPageDecoderILNS_9FieldTypeE27EE5countEv Unexecuted instantiation: _ZNK5doris10segment_v222BinaryPlainPageDecoderILNS_9FieldTypeE36EE5countEv |
302 | | |
303 | 138 | size_t current_index() const override { |
304 | 138 | DCHECK(_parsed); |
305 | 138 | return _cur_idx; |
306 | 138 | } _ZNK5doris10segment_v222BinaryPlainPageDecoderILNS_9FieldTypeE17EE13current_indexEv Line | Count | Source | 303 | 91 | size_t current_index() const override { | 304 | | DCHECK(_parsed); | 305 | 91 | return _cur_idx; | 306 | 91 | } |
_ZNK5doris10segment_v222BinaryPlainPageDecoderILNS_9FieldTypeE26EE13current_indexEv Line | Count | Source | 303 | 4 | size_t current_index() const override { | 304 | | DCHECK(_parsed); | 305 | 4 | return _cur_idx; | 306 | 4 | } |
Unexecuted instantiation: _ZNK5doris10segment_v222BinaryPlainPageDecoderILNS_9FieldTypeE13EE13current_indexEv Unexecuted instantiation: _ZNK5doris10segment_v222BinaryPlainPageDecoderILNS_9FieldTypeE34EE13current_indexEv Unexecuted instantiation: _ZNK5doris10segment_v222BinaryPlainPageDecoderILNS_9FieldTypeE35EE13current_indexEv Unexecuted instantiation: _ZNK5doris10segment_v222BinaryPlainPageDecoderILNS_9FieldTypeE23EE13current_indexEv _ZNK5doris10segment_v222BinaryPlainPageDecoderILNS_9FieldTypeE25EE13current_indexEv Line | Count | Source | 303 | 43 | size_t current_index() const override { | 304 | | DCHECK(_parsed); | 305 | 43 | return _cur_idx; | 306 | 43 | } |
Unexecuted instantiation: _ZNK5doris10segment_v222BinaryPlainPageDecoderILNS_9FieldTypeE27EE13current_indexEv Unexecuted instantiation: _ZNK5doris10segment_v222BinaryPlainPageDecoderILNS_9FieldTypeE36EE13current_indexEv |
307 | | |
308 | 2.77k | Status get_dict_word_info(StringRef* dict_word_info) override { |
309 | 2.77k | if (UNLIKELY(_num_elems <= 0)) { |
310 | 0 | return Status::OK(); |
311 | 0 | } |
312 | | |
313 | 2.77k | char* data_begin = (char*)&_data[0]; |
314 | 2.77k | char* offset_ptr = (char*)&_data[_offsets_pos]; |
315 | | |
316 | 76.5k | for (uint32_t i = 0; i < _num_elems; ++i) { |
317 | 73.7k | uint32_t offset = decode_fixed32_le((uint8_t*)offset_ptr); |
318 | 73.7k | if (offset > _offsets_pos) { |
319 | 0 | return Status::Corruption( |
320 | 0 | "file corruption: offsets pos beyonds data_size: {}, num_element: {}" |
321 | 0 | ", offset_pos: {}, offset: {}", |
322 | 0 | _data.size, _num_elems, _offsets_pos, offset); |
323 | 0 | } |
324 | 73.7k | dict_word_info[i].data = data_begin + offset; |
325 | 73.7k | offset_ptr += sizeof(uint32_t); |
326 | 73.7k | } |
327 | | |
328 | 73.7k | for (int i = 0; i < (int)_num_elems - 1; ++i) { |
329 | 70.9k | dict_word_info[i].size = |
330 | 70.9k | (char*)dict_word_info[i + 1].data - (char*)dict_word_info[i].data; |
331 | 70.9k | } |
332 | | |
333 | 2.77k | dict_word_info[_num_elems - 1].size = |
334 | 2.77k | (data_begin + _offsets_pos) - (char*)dict_word_info[_num_elems - 1].data; |
335 | 2.77k | return Status::OK(); |
336 | 2.77k | } _ZN5doris10segment_v222BinaryPlainPageDecoderILNS_9FieldTypeE17EE18get_dict_word_infoEPNS_9StringRefE Line | Count | Source | 308 | 2.77k | Status get_dict_word_info(StringRef* dict_word_info) override { | 309 | 2.77k | if (UNLIKELY(_num_elems <= 0)) { | 310 | 0 | return Status::OK(); | 311 | 0 | } | 312 | | | 313 | 2.77k | char* data_begin = (char*)&_data[0]; | 314 | 2.77k | char* offset_ptr = (char*)&_data[_offsets_pos]; | 315 | | | 316 | 76.5k | for (uint32_t i = 0; i < _num_elems; ++i) { | 317 | 73.7k | uint32_t offset = decode_fixed32_le((uint8_t*)offset_ptr); | 318 | 73.7k | if (offset > _offsets_pos) { | 319 | 0 | return Status::Corruption( | 320 | 0 | "file corruption: offsets pos beyonds data_size: {}, num_element: {}" | 321 | 0 | ", offset_pos: {}, offset: {}", | 322 | 0 | _data.size, _num_elems, _offsets_pos, offset); | 323 | 0 | } | 324 | 73.7k | dict_word_info[i].data = data_begin + offset; | 325 | 73.7k | offset_ptr += sizeof(uint32_t); | 326 | 73.7k | } | 327 | | | 328 | 73.7k | for (int i = 0; i < (int)_num_elems - 1; ++i) { | 329 | 70.9k | dict_word_info[i].size = | 330 | 70.9k | (char*)dict_word_info[i + 1].data - (char*)dict_word_info[i].data; | 331 | 70.9k | } | 332 | | | 333 | 2.77k | dict_word_info[_num_elems - 1].size = | 334 | 2.77k | (data_begin + _offsets_pos) - (char*)dict_word_info[_num_elems - 1].data; | 335 | 2.77k | return Status::OK(); | 336 | 2.77k | } |
Unexecuted instantiation: _ZN5doris10segment_v222BinaryPlainPageDecoderILNS_9FieldTypeE26EE18get_dict_word_infoEPNS_9StringRefE Unexecuted instantiation: _ZN5doris10segment_v222BinaryPlainPageDecoderILNS_9FieldTypeE13EE18get_dict_word_infoEPNS_9StringRefE Unexecuted instantiation: _ZN5doris10segment_v222BinaryPlainPageDecoderILNS_9FieldTypeE34EE18get_dict_word_infoEPNS_9StringRefE Unexecuted instantiation: _ZN5doris10segment_v222BinaryPlainPageDecoderILNS_9FieldTypeE35EE18get_dict_word_infoEPNS_9StringRefE Unexecuted instantiation: _ZN5doris10segment_v222BinaryPlainPageDecoderILNS_9FieldTypeE23EE18get_dict_word_infoEPNS_9StringRefE Unexecuted instantiation: _ZN5doris10segment_v222BinaryPlainPageDecoderILNS_9FieldTypeE25EE18get_dict_word_infoEPNS_9StringRefE Unexecuted instantiation: _ZN5doris10segment_v222BinaryPlainPageDecoderILNS_9FieldTypeE27EE18get_dict_word_infoEPNS_9StringRefE Unexecuted instantiation: _ZN5doris10segment_v222BinaryPlainPageDecoderILNS_9FieldTypeE36EE18get_dict_word_infoEPNS_9StringRefE |
337 | | |
338 | | private: |
339 | | static constexpr size_t SIZE_OF_INT32 = sizeof(uint32_t); |
340 | | // Return the offset within '_data' where the string value with index 'idx' can be found. |
341 | 5.09k | uint32_t offset(size_t idx) const { |
342 | 5.09k | if (idx >= _num_elems) { |
343 | 1.97k | return _offsets_pos; |
344 | 1.97k | } |
345 | 3.12k | return guarded_offset(idx); |
346 | 5.09k | } _ZNK5doris10segment_v222BinaryPlainPageDecoderILNS_9FieldTypeE17EE6offsetEm Line | Count | Source | 341 | 5.03k | uint32_t offset(size_t idx) const { | 342 | 5.03k | if (idx >= _num_elems) { | 343 | 1.94k | return _offsets_pos; | 344 | 1.94k | } | 345 | 3.09k | return guarded_offset(idx); | 346 | 5.03k | } |
_ZNK5doris10segment_v222BinaryPlainPageDecoderILNS_9FieldTypeE26EE6offsetEm Line | Count | Source | 341 | 13 | uint32_t offset(size_t idx) const { | 342 | 13 | if (idx >= _num_elems) { | 343 | 4 | return _offsets_pos; | 344 | 4 | } | 345 | 9 | return guarded_offset(idx); | 346 | 13 | } |
_ZNK5doris10segment_v222BinaryPlainPageDecoderILNS_9FieldTypeE13EE6offsetEm Line | Count | Source | 341 | 1 | uint32_t offset(size_t idx) const { | 342 | 1 | if (idx >= _num_elems) { | 343 | 1 | return _offsets_pos; | 344 | 1 | } | 345 | 0 | return guarded_offset(idx); | 346 | 1 | } |
Unexecuted instantiation: _ZNK5doris10segment_v222BinaryPlainPageDecoderILNS_9FieldTypeE34EE6offsetEm Unexecuted instantiation: _ZNK5doris10segment_v222BinaryPlainPageDecoderILNS_9FieldTypeE35EE6offsetEm Unexecuted instantiation: _ZNK5doris10segment_v222BinaryPlainPageDecoderILNS_9FieldTypeE23EE6offsetEm _ZNK5doris10segment_v222BinaryPlainPageDecoderILNS_9FieldTypeE25EE6offsetEm Line | Count | Source | 341 | 43 | uint32_t offset(size_t idx) const { | 342 | 43 | if (idx >= _num_elems) { | 343 | 21 | return _offsets_pos; | 344 | 21 | } | 345 | 22 | return guarded_offset(idx); | 346 | 43 | } |
Unexecuted instantiation: _ZNK5doris10segment_v222BinaryPlainPageDecoderILNS_9FieldTypeE27EE6offsetEm Unexecuted instantiation: _ZNK5doris10segment_v222BinaryPlainPageDecoderILNS_9FieldTypeE36EE6offsetEm |
347 | | |
348 | 308k | uint32_t guarded_offset(size_t idx) const { |
349 | 308k | const auto* p = |
350 | 308k | reinterpret_cast<const uint8_t*>(&_data[_offsets_pos + idx * SIZE_OF_INT32]); |
351 | 308k | return decode_fixed32_le(p); |
352 | 308k | } _ZNK5doris10segment_v222BinaryPlainPageDecoderILNS_9FieldTypeE17EE14guarded_offsetEm Line | Count | Source | 348 | 308k | uint32_t guarded_offset(size_t idx) const { | 349 | 308k | const auto* p = | 350 | 308k | reinterpret_cast<const uint8_t*>(&_data[_offsets_pos + idx * SIZE_OF_INT32]); | 351 | 308k | return decode_fixed32_le(p); | 352 | 308k | } |
_ZNK5doris10segment_v222BinaryPlainPageDecoderILNS_9FieldTypeE26EE14guarded_offsetEm Line | Count | Source | 348 | 16 | uint32_t guarded_offset(size_t idx) const { | 349 | 16 | const auto* p = | 350 | 16 | reinterpret_cast<const uint8_t*>(&_data[_offsets_pos + idx * SIZE_OF_INT32]); | 351 | 16 | return decode_fixed32_le(p); | 352 | 16 | } |
_ZNK5doris10segment_v222BinaryPlainPageDecoderILNS_9FieldTypeE13EE14guarded_offsetEm Line | Count | Source | 348 | 3 | uint32_t guarded_offset(size_t idx) const { | 349 | 3 | const auto* p = | 350 | 3 | reinterpret_cast<const uint8_t*>(&_data[_offsets_pos + idx * SIZE_OF_INT32]); | 351 | 3 | return decode_fixed32_le(p); | 352 | 3 | } |
Unexecuted instantiation: _ZNK5doris10segment_v222BinaryPlainPageDecoderILNS_9FieldTypeE34EE14guarded_offsetEm Unexecuted instantiation: _ZNK5doris10segment_v222BinaryPlainPageDecoderILNS_9FieldTypeE35EE14guarded_offsetEm Unexecuted instantiation: _ZNK5doris10segment_v222BinaryPlainPageDecoderILNS_9FieldTypeE23EE14guarded_offsetEm _ZNK5doris10segment_v222BinaryPlainPageDecoderILNS_9FieldTypeE25EE14guarded_offsetEm Line | Count | Source | 348 | 65 | uint32_t guarded_offset(size_t idx) const { | 349 | 65 | const auto* p = | 350 | 65 | reinterpret_cast<const uint8_t*>(&_data[_offsets_pos + idx * SIZE_OF_INT32]); | 351 | 65 | return decode_fixed32_le(p); | 352 | 65 | } |
Unexecuted instantiation: _ZNK5doris10segment_v222BinaryPlainPageDecoderILNS_9FieldTypeE27EE14guarded_offsetEm Unexecuted instantiation: _ZNK5doris10segment_v222BinaryPlainPageDecoderILNS_9FieldTypeE36EE14guarded_offsetEm |
353 | | |
354 | | Slice _data; |
355 | | PageDecoderOptions _options; |
356 | | bool _parsed; |
357 | | |
358 | | uint32_t _num_elems; |
359 | | uint32_t _offsets_pos; |
360 | | |
361 | | std::vector<uint32_t> _offsets; |
362 | | std::vector<StringRef> _binary_data; |
363 | | |
364 | | // Index of the currently seeked element in the page. |
365 | | size_t _cur_idx; |
366 | | friend class BinaryDictPageDecoder; |
367 | | friend class FileColumnIterator; |
368 | | }; |
369 | | |
370 | | } // namespace segment_v2 |
371 | | } // namespace doris |