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 | | #include "common/compile_check_begin.h" |
44 | | |
45 | | template <FieldType Type> |
46 | | class BinaryPlainPageBuilder : public PageBuilderHelper<BinaryPlainPageBuilder<Type>> { |
47 | | public: |
48 | | using Self = BinaryPlainPageBuilder<Type>; |
49 | | friend class PageBuilderHelper<Self>; |
50 | | |
51 | 21.3k | Status init() override { return reset(); }Unexecuted instantiation: _ZN5doris10segment_v222BinaryPlainPageBuilderILNS_9FieldTypeE13EE4initEv _ZN5doris10segment_v222BinaryPlainPageBuilderILNS_9FieldTypeE17EE4initEv Line | Count | Source | 51 | 5.54k | 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 | 51 | 15.7k | Status init() override { return reset(); } |
Unexecuted instantiation: _ZN5doris10segment_v222BinaryPlainPageBuilderILNS_9FieldTypeE27EE4initEv Unexecuted instantiation: _ZN5doris10segment_v222BinaryPlainPageBuilderILNS_9FieldTypeE36EE4initEv |
52 | | |
53 | 1.52M | bool is_page_full() override { |
54 | 1.52M | bool ret = false; |
55 | 1.52M | if (_options.is_dict_page) { |
56 | | // dict_page_size is 0, do not limit the page size |
57 | 1.11M | ret = _options.dict_page_size != 0 && _size_estimate > _options.dict_page_size; |
58 | 1.11M | } else { |
59 | 407k | ret = _options.data_page_size != 0 && _size_estimate > _options.data_page_size; |
60 | 407k | } |
61 | 1.52M | return ret; |
62 | 1.52M | } Unexecuted instantiation: _ZN5doris10segment_v222BinaryPlainPageBuilderILNS_9FieldTypeE13EE12is_page_fullEv _ZN5doris10segment_v222BinaryPlainPageBuilderILNS_9FieldTypeE17EE12is_page_fullEv Line | Count | Source | 53 | 1.46M | bool is_page_full() override { | 54 | 1.46M | bool ret = false; | 55 | 1.46M | if (_options.is_dict_page) { | 56 | | // dict_page_size is 0, do not limit the page size | 57 | 1.11M | ret = _options.dict_page_size != 0 && _size_estimate > _options.dict_page_size; | 58 | 1.11M | } else { | 59 | 347k | ret = _options.data_page_size != 0 && _size_estimate > _options.data_page_size; | 60 | 347k | } | 61 | 1.46M | return ret; | 62 | 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 | 53 | 59.4k | bool is_page_full() override { | 54 | 59.4k | bool ret = false; | 55 | 59.4k | if (_options.is_dict_page) { | 56 | | // dict_page_size is 0, do not limit the page size | 57 | 0 | ret = _options.dict_page_size != 0 && _size_estimate > _options.dict_page_size; | 58 | 59.4k | } else { | 59 | 59.4k | ret = _options.data_page_size != 0 && _size_estimate > _options.data_page_size; | 60 | 59.4k | } | 61 | 59.4k | return ret; | 62 | 59.4k | } |
Unexecuted instantiation: _ZN5doris10segment_v222BinaryPlainPageBuilderILNS_9FieldTypeE27EE12is_page_fullEv Unexecuted instantiation: _ZN5doris10segment_v222BinaryPlainPageBuilderILNS_9FieldTypeE36EE12is_page_fullEv |
63 | | |
64 | 250k | Status add(const uint8_t* vals, size_t* count) override { |
65 | 250k | DCHECK(!_finished); |
66 | 250k | DCHECK_GT(*count, 0); |
67 | 250k | size_t i = 0; |
68 | | |
69 | | // If the page is full, should stop adding more items. |
70 | 537k | while (!is_page_full() && i < *count) { |
71 | 287k | const auto* src = reinterpret_cast<const Slice*>(vals); |
72 | 287k | if constexpr (Type == FieldType::OLAP_FIELD_TYPE_BITMAP) { |
73 | 19.8k | if (_options.need_check_bitmap) { |
74 | 0 | RETURN_IF_ERROR(BitmapTypeCode::validate(*(src->data))); |
75 | 0 | } |
76 | 19.8k | } |
77 | 19.8k | size_t offset = _buffer.size(); |
78 | 287k | _offsets.push_back(cast_set<uint32_t>(offset)); |
79 | | // This may need a large memory, should return error if could not allocated |
80 | | // successfully, to avoid BE OOM. |
81 | 287k | RETURN_IF_CATCH_EXCEPTION(_buffer.append(src->data, src->size)); |
82 | | |
83 | 287k | _last_value_size = cast_set<uint32_t>(src->size); |
84 | 287k | _size_estimate += src->size; |
85 | 287k | _size_estimate += sizeof(uint32_t); |
86 | 287k | _raw_data_size += src->size; |
87 | | |
88 | 287k | i++; |
89 | 287k | vals += sizeof(Slice); |
90 | 287k | } |
91 | | |
92 | 250k | *count = i; |
93 | 250k | return Status::OK(); |
94 | 250k | } Unexecuted instantiation: _ZN5doris10segment_v222BinaryPlainPageBuilderILNS_9FieldTypeE13EE3addEPKhPm _ZN5doris10segment_v222BinaryPlainPageBuilderILNS_9FieldTypeE17EE3addEPKhPm Line | Count | Source | 64 | 230k | Status add(const uint8_t* vals, size_t* count) override { | 65 | 230k | DCHECK(!_finished); | 66 | 230k | DCHECK_GT(*count, 0); | 67 | 230k | size_t i = 0; | 68 | | | 69 | | // If the page is full, should stop adding more items. | 70 | 497k | while (!is_page_full() && i < *count) { | 71 | 267k | const auto* src = reinterpret_cast<const Slice*>(vals); | 72 | | if constexpr (Type == FieldType::OLAP_FIELD_TYPE_BITMAP) { | 73 | | if (_options.need_check_bitmap) { | 74 | | RETURN_IF_ERROR(BitmapTypeCode::validate(*(src->data))); | 75 | | } | 76 | | } | 77 | 267k | size_t offset = _buffer.size(); | 78 | 267k | _offsets.push_back(cast_set<uint32_t>(offset)); | 79 | | // This may need a large memory, should return error if could not allocated | 80 | | // successfully, to avoid BE OOM. | 81 | 267k | RETURN_IF_CATCH_EXCEPTION(_buffer.append(src->data, src->size)); | 82 | | | 83 | 267k | _last_value_size = cast_set<uint32_t>(src->size); | 84 | 267k | _size_estimate += src->size; | 85 | 267k | _size_estimate += sizeof(uint32_t); | 86 | 267k | _raw_data_size += src->size; | 87 | | | 88 | 267k | i++; | 89 | 267k | vals += sizeof(Slice); | 90 | 267k | } | 91 | | | 92 | 230k | *count = i; | 93 | 230k | return Status::OK(); | 94 | 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 | 64 | 19.8k | Status add(const uint8_t* vals, size_t* count) override { | 65 | 19.8k | DCHECK(!_finished); | 66 | 19.8k | DCHECK_GT(*count, 0); | 67 | 19.8k | size_t i = 0; | 68 | | | 69 | | // If the page is full, should stop adding more items. | 70 | 39.6k | while (!is_page_full() && i < *count) { | 71 | 19.8k | const auto* src = reinterpret_cast<const Slice*>(vals); | 72 | 19.8k | if constexpr (Type == FieldType::OLAP_FIELD_TYPE_BITMAP) { | 73 | 19.8k | if (_options.need_check_bitmap) { | 74 | 0 | RETURN_IF_ERROR(BitmapTypeCode::validate(*(src->data))); | 75 | 0 | } | 76 | 19.8k | } | 77 | 19.8k | size_t offset = _buffer.size(); | 78 | 19.8k | _offsets.push_back(cast_set<uint32_t>(offset)); | 79 | | // This may need a large memory, should return error if could not allocated | 80 | | // successfully, to avoid BE OOM. | 81 | 19.8k | RETURN_IF_CATCH_EXCEPTION(_buffer.append(src->data, src->size)); | 82 | | | 83 | 19.8k | _last_value_size = cast_set<uint32_t>(src->size); | 84 | 19.8k | _size_estimate += src->size; | 85 | 19.8k | _size_estimate += sizeof(uint32_t); | 86 | 19.8k | _raw_data_size += src->size; | 87 | | | 88 | 19.8k | i++; | 89 | 19.8k | vals += sizeof(Slice); | 90 | 19.8k | } | 91 | | | 92 | 19.8k | *count = i; | 93 | 19.8k | return Status::OK(); | 94 | 19.8k | } |
Unexecuted instantiation: _ZN5doris10segment_v222BinaryPlainPageBuilderILNS_9FieldTypeE27EE3addEPKhPm Unexecuted instantiation: _ZN5doris10segment_v222BinaryPlainPageBuilderILNS_9FieldTypeE36EE3addEPKhPm |
95 | | |
96 | 23.2k | Status finish(OwnedSlice* slice) override { |
97 | 23.2k | DCHECK(!_finished); |
98 | 23.2k | _finished = true; |
99 | 23.2k | RETURN_IF_CATCH_EXCEPTION({ |
100 | | // Set up trailer |
101 | 23.2k | for (uint32_t _offset : _offsets) { |
102 | 23.2k | put_fixed32_le(&_buffer, _offset); |
103 | 23.2k | } |
104 | 23.2k | put_fixed32_le(&_buffer, cast_set<uint32_t>(_offsets.size())); |
105 | 23.2k | if (_offsets.size() > 0) { |
106 | 23.2k | _copy_value_at(0, &_first_value); |
107 | 23.2k | _copy_value_at(_offsets.size() - 1, &_last_value); |
108 | 23.2k | } |
109 | 23.2k | *slice = _buffer.build(); |
110 | 23.2k | }); |
111 | 23.2k | return Status::OK(); |
112 | 23.2k | } Unexecuted instantiation: _ZN5doris10segment_v222BinaryPlainPageBuilderILNS_9FieldTypeE13EE6finishEPNS_10OwnedSliceE _ZN5doris10segment_v222BinaryPlainPageBuilderILNS_9FieldTypeE17EE6finishEPNS_10OwnedSliceE Line | Count | Source | 96 | 7.46k | Status finish(OwnedSlice* slice) override { | 97 | 7.46k | DCHECK(!_finished); | 98 | 7.46k | _finished = true; | 99 | 7.46k | RETURN_IF_CATCH_EXCEPTION({ | 100 | | // Set up trailer | 101 | 7.46k | for (uint32_t _offset : _offsets) { | 102 | 7.46k | put_fixed32_le(&_buffer, _offset); | 103 | 7.46k | } | 104 | 7.46k | put_fixed32_le(&_buffer, cast_set<uint32_t>(_offsets.size())); | 105 | 7.46k | if (_offsets.size() > 0) { | 106 | 7.46k | _copy_value_at(0, &_first_value); | 107 | 7.46k | _copy_value_at(_offsets.size() - 1, &_last_value); | 108 | 7.46k | } | 109 | 7.46k | *slice = _buffer.build(); | 110 | 7.46k | }); | 111 | 7.46k | return Status::OK(); | 112 | 7.46k | } |
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 | 96 | 15.7k | Status finish(OwnedSlice* slice) override { | 97 | 15.7k | DCHECK(!_finished); | 98 | 15.7k | _finished = true; | 99 | 15.7k | RETURN_IF_CATCH_EXCEPTION({ | 100 | | // Set up trailer | 101 | 15.7k | for (uint32_t _offset : _offsets) { | 102 | 15.7k | put_fixed32_le(&_buffer, _offset); | 103 | 15.7k | } | 104 | 15.7k | put_fixed32_le(&_buffer, cast_set<uint32_t>(_offsets.size())); | 105 | 15.7k | if (_offsets.size() > 0) { | 106 | 15.7k | _copy_value_at(0, &_first_value); | 107 | 15.7k | _copy_value_at(_offsets.size() - 1, &_last_value); | 108 | 15.7k | } | 109 | 15.7k | *slice = _buffer.build(); | 110 | 15.7k | }); | 111 | 15.7k | return Status::OK(); | 112 | 15.7k | } |
Unexecuted instantiation: _ZN5doris10segment_v222BinaryPlainPageBuilderILNS_9FieldTypeE27EE6finishEPNS_10OwnedSliceE Unexecuted instantiation: _ZN5doris10segment_v222BinaryPlainPageBuilderILNS_9FieldTypeE36EE6finishEPNS_10OwnedSliceE |
113 | | |
114 | 40.7k | Status reset() override { |
115 | 40.7k | RETURN_IF_CATCH_EXCEPTION({ |
116 | 40.7k | _offsets.clear(); |
117 | 40.7k | _buffer.clear(); |
118 | 40.7k | _buffer.reserve(_options.data_page_size == 0 |
119 | 40.7k | ? 1024 |
120 | 40.7k | : std::min(_options.data_page_size, _options.dict_page_size)); |
121 | 40.7k | _size_estimate = sizeof(uint32_t); |
122 | 40.7k | _finished = false; |
123 | 40.7k | _last_value_size = 0; |
124 | 40.7k | _raw_data_size = 0; |
125 | 40.7k | }); |
126 | 40.7k | return Status::OK(); |
127 | 40.7k | } Unexecuted instantiation: _ZN5doris10segment_v222BinaryPlainPageBuilderILNS_9FieldTypeE13EE5resetEv _ZN5doris10segment_v222BinaryPlainPageBuilderILNS_9FieldTypeE17EE5resetEv Line | Count | Source | 114 | 9.17k | Status reset() override { | 115 | 9.17k | RETURN_IF_CATCH_EXCEPTION({ | 116 | 9.17k | _offsets.clear(); | 117 | 9.17k | _buffer.clear(); | 118 | 9.17k | _buffer.reserve(_options.data_page_size == 0 | 119 | 9.17k | ? 1024 | 120 | 9.17k | : std::min(_options.data_page_size, _options.dict_page_size)); | 121 | 9.17k | _size_estimate = sizeof(uint32_t); | 122 | 9.17k | _finished = false; | 123 | 9.17k | _last_value_size = 0; | 124 | 9.17k | _raw_data_size = 0; | 125 | 9.17k | }); | 126 | 9.17k | return Status::OK(); | 127 | 9.17k | } |
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 | 114 | 31.5k | Status reset() override { | 115 | 31.5k | RETURN_IF_CATCH_EXCEPTION({ | 116 | 31.5k | _offsets.clear(); | 117 | 31.5k | _buffer.clear(); | 118 | 31.5k | _buffer.reserve(_options.data_page_size == 0 | 119 | 31.5k | ? 1024 | 120 | 31.5k | : std::min(_options.data_page_size, _options.dict_page_size)); | 121 | 31.5k | _size_estimate = sizeof(uint32_t); | 122 | 31.5k | _finished = false; | 123 | 31.5k | _last_value_size = 0; | 124 | 31.5k | _raw_data_size = 0; | 125 | 31.5k | }); | 126 | 31.5k | return Status::OK(); | 127 | 31.5k | } |
Unexecuted instantiation: _ZN5doris10segment_v222BinaryPlainPageBuilderILNS_9FieldTypeE27EE5resetEv Unexecuted instantiation: _ZN5doris10segment_v222BinaryPlainPageBuilderILNS_9FieldTypeE36EE5resetEv |
128 | | |
129 | 15.8k | size_t count() const override { return _offsets.size(); }Unexecuted instantiation: _ZNK5doris10segment_v222BinaryPlainPageBuilderILNS_9FieldTypeE13EE5countEv _ZNK5doris10segment_v222BinaryPlainPageBuilderILNS_9FieldTypeE17EE5countEv Line | Count | Source | 129 | 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 | 129 | 15.7k | size_t count() const override { return _offsets.size(); } |
Unexecuted instantiation: _ZNK5doris10segment_v222BinaryPlainPageBuilderILNS_9FieldTypeE27EE5countEv Unexecuted instantiation: _ZNK5doris10segment_v222BinaryPlainPageBuilderILNS_9FieldTypeE36EE5countEv |
130 | | |
131 | 1.02k | uint64_t size() const override { return _size_estimate; }Unexecuted instantiation: _ZNK5doris10segment_v222BinaryPlainPageBuilderILNS_9FieldTypeE13EE4sizeEv _ZNK5doris10segment_v222BinaryPlainPageBuilderILNS_9FieldTypeE17EE4sizeEv Line | Count | Source | 131 | 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 |
132 | | |
133 | 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 |
134 | | |
135 | 0 | Status get_first_value(void* value) const override { |
136 | 0 | DCHECK(_finished); |
137 | 0 | if (_offsets.size() == 0) { |
138 | 0 | return Status::Error<ErrorCode::ENTRY_NOT_FOUND>("page is empty"); |
139 | 0 | } |
140 | 0 | *reinterpret_cast<Slice*>(value) = Slice(_first_value); |
141 | 0 | return Status::OK(); |
142 | 0 | } Unexecuted instantiation: _ZNK5doris10segment_v222BinaryPlainPageBuilderILNS_9FieldTypeE13EE15get_first_valueEPv Unexecuted instantiation: _ZNK5doris10segment_v222BinaryPlainPageBuilderILNS_9FieldTypeE17EE15get_first_valueEPv Unexecuted instantiation: _ZNK5doris10segment_v222BinaryPlainPageBuilderILNS_9FieldTypeE26EE15get_first_valueEPv Unexecuted instantiation: _ZNK5doris10segment_v222BinaryPlainPageBuilderILNS_9FieldTypeE34EE15get_first_valueEPv Unexecuted instantiation: _ZNK5doris10segment_v222BinaryPlainPageBuilderILNS_9FieldTypeE35EE15get_first_valueEPv Unexecuted instantiation: _ZNK5doris10segment_v222BinaryPlainPageBuilderILNS_9FieldTypeE23EE15get_first_valueEPv Unexecuted instantiation: _ZNK5doris10segment_v222BinaryPlainPageBuilderILNS_9FieldTypeE25EE15get_first_valueEPv Unexecuted instantiation: _ZNK5doris10segment_v222BinaryPlainPageBuilderILNS_9FieldTypeE27EE15get_first_valueEPv Unexecuted instantiation: _ZNK5doris10segment_v222BinaryPlainPageBuilderILNS_9FieldTypeE36EE15get_first_valueEPv |
143 | 0 | Status get_last_value(void* value) const override { |
144 | 0 | DCHECK(_finished); |
145 | 0 | if (_offsets.size() == 0) { |
146 | 0 | return Status::Error<ErrorCode::ENTRY_NOT_FOUND>("page is empty"); |
147 | 0 | } |
148 | 0 | *reinterpret_cast<Slice*>(value) = Slice(_last_value); |
149 | 0 | return Status::OK(); |
150 | 0 | } Unexecuted instantiation: _ZNK5doris10segment_v222BinaryPlainPageBuilderILNS_9FieldTypeE13EE14get_last_valueEPv Unexecuted instantiation: _ZNK5doris10segment_v222BinaryPlainPageBuilderILNS_9FieldTypeE17EE14get_last_valueEPv Unexecuted instantiation: _ZNK5doris10segment_v222BinaryPlainPageBuilderILNS_9FieldTypeE26EE14get_last_valueEPv Unexecuted instantiation: _ZNK5doris10segment_v222BinaryPlainPageBuilderILNS_9FieldTypeE34EE14get_last_valueEPv Unexecuted instantiation: _ZNK5doris10segment_v222BinaryPlainPageBuilderILNS_9FieldTypeE35EE14get_last_valueEPv Unexecuted instantiation: _ZNK5doris10segment_v222BinaryPlainPageBuilderILNS_9FieldTypeE23EE14get_last_valueEPv Unexecuted instantiation: _ZNK5doris10segment_v222BinaryPlainPageBuilderILNS_9FieldTypeE25EE14get_last_valueEPv Unexecuted instantiation: _ZNK5doris10segment_v222BinaryPlainPageBuilderILNS_9FieldTypeE27EE14get_last_valueEPv Unexecuted instantiation: _ZNK5doris10segment_v222BinaryPlainPageBuilderILNS_9FieldTypeE36EE14get_last_valueEPv |
151 | | |
152 | 2 | inline Slice operator[](size_t idx) const { |
153 | 2 | DCHECK(!_finished); |
154 | 2 | DCHECK_LT(idx, _offsets.size()); |
155 | 2 | size_t value_size = |
156 | 2 | (idx < _offsets.size() - 1) ? _offsets[idx + 1] - _offsets[idx] : _last_value_size; |
157 | 2 | return Slice(&_buffer[_offsets[idx]], value_size); |
158 | 2 | } Unexecuted instantiation: _ZNK5doris10segment_v222BinaryPlainPageBuilderILNS_9FieldTypeE13EEixEm _ZNK5doris10segment_v222BinaryPlainPageBuilderILNS_9FieldTypeE17EEixEm Line | Count | Source | 152 | 2 | inline Slice operator[](size_t idx) const { | 153 | 2 | DCHECK(!_finished); | 154 | 2 | DCHECK_LT(idx, _offsets.size()); | 155 | 2 | size_t value_size = | 156 | 2 | (idx < _offsets.size() - 1) ? _offsets[idx + 1] - _offsets[idx] : _last_value_size; | 157 | 2 | return Slice(&_buffer[_offsets[idx]], value_size); | 158 | 2 | } |
Unexecuted instantiation: _ZNK5doris10segment_v222BinaryPlainPageBuilderILNS_9FieldTypeE26EEixEm Unexecuted instantiation: _ZNK5doris10segment_v222BinaryPlainPageBuilderILNS_9FieldTypeE34EEixEm Unexecuted instantiation: _ZNK5doris10segment_v222BinaryPlainPageBuilderILNS_9FieldTypeE35EEixEm Unexecuted instantiation: _ZNK5doris10segment_v222BinaryPlainPageBuilderILNS_9FieldTypeE23EEixEm Unexecuted instantiation: _ZNK5doris10segment_v222BinaryPlainPageBuilderILNS_9FieldTypeE25EEixEm Unexecuted instantiation: _ZNK5doris10segment_v222BinaryPlainPageBuilderILNS_9FieldTypeE27EEixEm Unexecuted instantiation: _ZNK5doris10segment_v222BinaryPlainPageBuilderILNS_9FieldTypeE36EEixEm |
159 | | |
160 | 2 | Status get_dict_word(uint32_t value_code, Slice* word) override { |
161 | 2 | *word = (*this)[value_code]; |
162 | 2 | return Status::OK(); |
163 | 2 | } Unexecuted instantiation: _ZN5doris10segment_v222BinaryPlainPageBuilderILNS_9FieldTypeE13EE13get_dict_wordEjPNS_5SliceE _ZN5doris10segment_v222BinaryPlainPageBuilderILNS_9FieldTypeE17EE13get_dict_wordEjPNS_5SliceE Line | Count | Source | 160 | 2 | Status get_dict_word(uint32_t value_code, Slice* word) override { | 161 | 2 | *word = (*this)[value_code]; | 162 | 2 | return Status::OK(); | 163 | 2 | } |
Unexecuted instantiation: _ZN5doris10segment_v222BinaryPlainPageBuilderILNS_9FieldTypeE26EE13get_dict_wordEjPNS_5SliceE Unexecuted instantiation: _ZN5doris10segment_v222BinaryPlainPageBuilderILNS_9FieldTypeE34EE13get_dict_wordEjPNS_5SliceE Unexecuted instantiation: _ZN5doris10segment_v222BinaryPlainPageBuilderILNS_9FieldTypeE35EE13get_dict_wordEjPNS_5SliceE Unexecuted instantiation: _ZN5doris10segment_v222BinaryPlainPageBuilderILNS_9FieldTypeE23EE13get_dict_wordEjPNS_5SliceE Unexecuted instantiation: _ZN5doris10segment_v222BinaryPlainPageBuilderILNS_9FieldTypeE25EE13get_dict_wordEjPNS_5SliceE Unexecuted instantiation: _ZN5doris10segment_v222BinaryPlainPageBuilderILNS_9FieldTypeE27EE13get_dict_wordEjPNS_5SliceE Unexecuted instantiation: _ZN5doris10segment_v222BinaryPlainPageBuilderILNS_9FieldTypeE36EE13get_dict_wordEjPNS_5SliceE |
164 | | |
165 | | private: |
166 | | BinaryPlainPageBuilder(const PageBuilderOptions& options) |
167 | 21.3k | : _size_estimate(0), _options(options) {}Unexecuted instantiation: _ZN5doris10segment_v222BinaryPlainPageBuilderILNS_9FieldTypeE13EEC2ERKNS0_18PageBuilderOptionsE _ZN5doris10segment_v222BinaryPlainPageBuilderILNS_9FieldTypeE17EEC2ERKNS0_18PageBuilderOptionsE Line | Count | Source | 167 | 5.54k | : _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 | 167 | 15.7k | : _size_estimate(0), _options(options) {} |
Unexecuted instantiation: _ZN5doris10segment_v222BinaryPlainPageBuilderILNS_9FieldTypeE27EEC2ERKNS0_18PageBuilderOptionsE Unexecuted instantiation: _ZN5doris10segment_v222BinaryPlainPageBuilderILNS_9FieldTypeE36EEC2ERKNS0_18PageBuilderOptionsE |
168 | | |
169 | 46.4k | void _copy_value_at(size_t idx, faststring* value) const { |
170 | 46.4k | size_t value_size = |
171 | 46.4k | (idx < _offsets.size() - 1) ? _offsets[idx + 1] - _offsets[idx] : _last_value_size; |
172 | 46.4k | value->assign_copy(&_buffer[_offsets[idx]], value_size); |
173 | 46.4k | } Unexecuted instantiation: _ZNK5doris10segment_v222BinaryPlainPageBuilderILNS_9FieldTypeE13EE14_copy_value_atEmPNS_10faststringE _ZNK5doris10segment_v222BinaryPlainPageBuilderILNS_9FieldTypeE17EE14_copy_value_atEmPNS_10faststringE Line | Count | Source | 169 | 14.8k | void _copy_value_at(size_t idx, faststring* value) const { | 170 | 14.8k | size_t value_size = | 171 | 14.8k | (idx < _offsets.size() - 1) ? _offsets[idx + 1] - _offsets[idx] : _last_value_size; | 172 | 14.8k | value->assign_copy(&_buffer[_offsets[idx]], value_size); | 173 | 14.8k | } |
Unexecuted instantiation: _ZNK5doris10segment_v222BinaryPlainPageBuilderILNS_9FieldTypeE26EE14_copy_value_atEmPNS_10faststringE Unexecuted instantiation: _ZNK5doris10segment_v222BinaryPlainPageBuilderILNS_9FieldTypeE34EE14_copy_value_atEmPNS_10faststringE Unexecuted instantiation: _ZNK5doris10segment_v222BinaryPlainPageBuilderILNS_9FieldTypeE35EE14_copy_value_atEmPNS_10faststringE Unexecuted instantiation: _ZNK5doris10segment_v222BinaryPlainPageBuilderILNS_9FieldTypeE23EE14_copy_value_atEmPNS_10faststringE _ZNK5doris10segment_v222BinaryPlainPageBuilderILNS_9FieldTypeE25EE14_copy_value_atEmPNS_10faststringE Line | Count | Source | 169 | 31.5k | void _copy_value_at(size_t idx, faststring* value) const { | 170 | 31.5k | size_t value_size = | 171 | 31.5k | (idx < _offsets.size() - 1) ? _offsets[idx + 1] - _offsets[idx] : _last_value_size; | 172 | 31.5k | value->assign_copy(&_buffer[_offsets[idx]], value_size); | 173 | 31.5k | } |
Unexecuted instantiation: _ZNK5doris10segment_v222BinaryPlainPageBuilderILNS_9FieldTypeE27EE14_copy_value_atEmPNS_10faststringE Unexecuted instantiation: _ZNK5doris10segment_v222BinaryPlainPageBuilderILNS_9FieldTypeE36EE14_copy_value_atEmPNS_10faststringE |
174 | | |
175 | | faststring _buffer; |
176 | | size_t _size_estimate; |
177 | | // Offsets of each entry, relative to the start of the page |
178 | | std::vector<uint32_t> _offsets; |
179 | | bool _finished; |
180 | | PageBuilderOptions _options; |
181 | | // size of last added value |
182 | | uint32_t _last_value_size = 0; |
183 | | uint64_t _raw_data_size = 0; |
184 | | faststring _first_value; |
185 | | faststring _last_value; |
186 | | }; |
187 | | |
188 | | template <FieldType Type> |
189 | | class BinaryPlainPageDecoder : public PageDecoder { |
190 | | public: |
191 | | BinaryPlainPageDecoder(Slice data) : BinaryPlainPageDecoder(data, PageDecoderOptions()) {} |
192 | | |
193 | | BinaryPlainPageDecoder(Slice data, const PageDecoderOptions& options) |
194 | 4.76k | : _data(data), |
195 | 4.76k | _options(options), |
196 | 4.76k | _parsed(false), |
197 | 4.76k | _num_elems(0), |
198 | 4.76k | _offsets_pos(0), |
199 | 4.76k | _cur_idx(0) {}_ZN5doris10segment_v222BinaryPlainPageDecoderILNS_9FieldTypeE17EEC2ENS_5SliceERKNS0_18PageDecoderOptionsE Line | Count | Source | 194 | 4.73k | : _data(data), | 195 | 4.73k | _options(options), | 196 | 4.73k | _parsed(false), | 197 | 4.73k | _num_elems(0), | 198 | 4.73k | _offsets_pos(0), | 199 | 4.73k | _cur_idx(0) {} |
_ZN5doris10segment_v222BinaryPlainPageDecoderILNS_9FieldTypeE26EEC2ENS_5SliceERKNS0_18PageDecoderOptionsE Line | Count | Source | 194 | 4 | : _data(data), | 195 | 4 | _options(options), | 196 | 4 | _parsed(false), | 197 | 4 | _num_elems(0), | 198 | 4 | _offsets_pos(0), | 199 | 4 | _cur_idx(0) {} |
_ZN5doris10segment_v222BinaryPlainPageDecoderILNS_9FieldTypeE13EEC2ENS_5SliceERKNS0_18PageDecoderOptionsE Line | Count | Source | 194 | 1 | : _data(data), | 195 | 1 | _options(options), | 196 | 1 | _parsed(false), | 197 | 1 | _num_elems(0), | 198 | 1 | _offsets_pos(0), | 199 | 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 | 194 | 21 | : _data(data), | 195 | 21 | _options(options), | 196 | 21 | _parsed(false), | 197 | 21 | _num_elems(0), | 198 | 21 | _offsets_pos(0), | 199 | 21 | _cur_idx(0) {} |
Unexecuted instantiation: _ZN5doris10segment_v222BinaryPlainPageDecoderILNS_9FieldTypeE27EEC2ENS_5SliceERKNS0_18PageDecoderOptionsE Unexecuted instantiation: _ZN5doris10segment_v222BinaryPlainPageDecoderILNS_9FieldTypeE36EEC2ENS_5SliceERKNS0_18PageDecoderOptionsE |
200 | | |
201 | 4.76k | Status init() override { |
202 | 4.76k | CHECK(!_parsed); |
203 | | |
204 | 4.76k | if (_data.size < sizeof(uint32_t)) { |
205 | 0 | return Status::Corruption( |
206 | 0 | "file corruption: not enough bytes for trailer in BinaryPlainPageDecoder ." |
207 | 0 | "invalid data size:{}, trailer size:{}", |
208 | 0 | _data.size, sizeof(uint32_t)); |
209 | 0 | } |
210 | | |
211 | | // Decode trailer |
212 | 4.76k | _num_elems = decode_fixed32_le((const uint8_t*)&_data[_data.get_size() - sizeof(uint32_t)]); |
213 | 4.76k | _offsets_pos = cast_set<uint32_t>(_data.get_size() - ((_num_elems + 1) * sizeof(uint32_t))); |
214 | | |
215 | 4.76k | if (_offsets_pos > _data.get_size() - sizeof(uint32_t)) { |
216 | 0 | return Status::Corruption( |
217 | 0 | "file corruption: offsets pos beyonds data_size: {}, num_element: {}" |
218 | 0 | ", offset_pos: {}", |
219 | 0 | _data.size, _num_elems, _offsets_pos); |
220 | 0 | } |
221 | 4.76k | _parsed = true; |
222 | | |
223 | 4.76k | return Status::OK(); |
224 | 4.76k | } _ZN5doris10segment_v222BinaryPlainPageDecoderILNS_9FieldTypeE17EE4initEv Line | Count | Source | 201 | 4.73k | Status init() override { | 202 | 4.73k | CHECK(!_parsed); | 203 | | | 204 | 4.73k | if (_data.size < sizeof(uint32_t)) { | 205 | 0 | return Status::Corruption( | 206 | 0 | "file corruption: not enough bytes for trailer in BinaryPlainPageDecoder ." | 207 | 0 | "invalid data size:{}, trailer size:{}", | 208 | 0 | _data.size, sizeof(uint32_t)); | 209 | 0 | } | 210 | | | 211 | | // Decode trailer | 212 | 4.73k | _num_elems = decode_fixed32_le((const uint8_t*)&_data[_data.get_size() - sizeof(uint32_t)]); | 213 | 4.73k | _offsets_pos = cast_set<uint32_t>(_data.get_size() - ((_num_elems + 1) * sizeof(uint32_t))); | 214 | | | 215 | 4.73k | if (_offsets_pos > _data.get_size() - sizeof(uint32_t)) { | 216 | 0 | return Status::Corruption( | 217 | 0 | "file corruption: offsets pos beyonds data_size: {}, num_element: {}" | 218 | 0 | ", offset_pos: {}", | 219 | 0 | _data.size, _num_elems, _offsets_pos); | 220 | 0 | } | 221 | 4.73k | _parsed = true; | 222 | | | 223 | 4.73k | return Status::OK(); | 224 | 4.73k | } |
_ZN5doris10segment_v222BinaryPlainPageDecoderILNS_9FieldTypeE26EE4initEv Line | Count | Source | 201 | 4 | Status init() override { | 202 | 4 | CHECK(!_parsed); | 203 | | | 204 | 4 | if (_data.size < sizeof(uint32_t)) { | 205 | 0 | return Status::Corruption( | 206 | 0 | "file corruption: not enough bytes for trailer in BinaryPlainPageDecoder ." | 207 | 0 | "invalid data size:{}, trailer size:{}", | 208 | 0 | _data.size, sizeof(uint32_t)); | 209 | 0 | } | 210 | | | 211 | | // Decode trailer | 212 | 4 | _num_elems = decode_fixed32_le((const uint8_t*)&_data[_data.get_size() - sizeof(uint32_t)]); | 213 | 4 | _offsets_pos = cast_set<uint32_t>(_data.get_size() - ((_num_elems + 1) * sizeof(uint32_t))); | 214 | | | 215 | 4 | if (_offsets_pos > _data.get_size() - sizeof(uint32_t)) { | 216 | 0 | return Status::Corruption( | 217 | 0 | "file corruption: offsets pos beyonds data_size: {}, num_element: {}" | 218 | 0 | ", offset_pos: {}", | 219 | 0 | _data.size, _num_elems, _offsets_pos); | 220 | 0 | } | 221 | 4 | _parsed = true; | 222 | | | 223 | 4 | return Status::OK(); | 224 | 4 | } |
_ZN5doris10segment_v222BinaryPlainPageDecoderILNS_9FieldTypeE13EE4initEv Line | Count | Source | 201 | 1 | Status init() override { | 202 | 1 | CHECK(!_parsed); | 203 | | | 204 | 1 | if (_data.size < sizeof(uint32_t)) { | 205 | 0 | return Status::Corruption( | 206 | 0 | "file corruption: not enough bytes for trailer in BinaryPlainPageDecoder ." | 207 | 0 | "invalid data size:{}, trailer size:{}", | 208 | 0 | _data.size, sizeof(uint32_t)); | 209 | 0 | } | 210 | | | 211 | | // Decode trailer | 212 | 1 | _num_elems = decode_fixed32_le((const uint8_t*)&_data[_data.get_size() - sizeof(uint32_t)]); | 213 | 1 | _offsets_pos = cast_set<uint32_t>(_data.get_size() - ((_num_elems + 1) * sizeof(uint32_t))); | 214 | | | 215 | 1 | if (_offsets_pos > _data.get_size() - sizeof(uint32_t)) { | 216 | 0 | return Status::Corruption( | 217 | 0 | "file corruption: offsets pos beyonds data_size: {}, num_element: {}" | 218 | 0 | ", offset_pos: {}", | 219 | 0 | _data.size, _num_elems, _offsets_pos); | 220 | 0 | } | 221 | 1 | _parsed = true; | 222 | | | 223 | 1 | return Status::OK(); | 224 | 1 | } |
Unexecuted instantiation: _ZN5doris10segment_v222BinaryPlainPageDecoderILNS_9FieldTypeE34EE4initEv Unexecuted instantiation: _ZN5doris10segment_v222BinaryPlainPageDecoderILNS_9FieldTypeE35EE4initEv Unexecuted instantiation: _ZN5doris10segment_v222BinaryPlainPageDecoderILNS_9FieldTypeE23EE4initEv _ZN5doris10segment_v222BinaryPlainPageDecoderILNS_9FieldTypeE25EE4initEv Line | Count | Source | 201 | 21 | Status init() override { | 202 | 21 | CHECK(!_parsed); | 203 | | | 204 | 21 | if (_data.size < sizeof(uint32_t)) { | 205 | 0 | return Status::Corruption( | 206 | 0 | "file corruption: not enough bytes for trailer in BinaryPlainPageDecoder ." | 207 | 0 | "invalid data size:{}, trailer size:{}", | 208 | 0 | _data.size, sizeof(uint32_t)); | 209 | 0 | } | 210 | | | 211 | | // Decode trailer | 212 | 21 | _num_elems = decode_fixed32_le((const uint8_t*)&_data[_data.get_size() - sizeof(uint32_t)]); | 213 | 21 | _offsets_pos = cast_set<uint32_t>(_data.get_size() - ((_num_elems + 1) * sizeof(uint32_t))); | 214 | | | 215 | 21 | if (_offsets_pos > _data.get_size() - sizeof(uint32_t)) { | 216 | 0 | return Status::Corruption( | 217 | 0 | "file corruption: offsets pos beyonds data_size: {}, num_element: {}" | 218 | 0 | ", offset_pos: {}", | 219 | 0 | _data.size, _num_elems, _offsets_pos); | 220 | 0 | } | 221 | 21 | _parsed = true; | 222 | | | 223 | 21 | return Status::OK(); | 224 | 21 | } |
Unexecuted instantiation: _ZN5doris10segment_v222BinaryPlainPageDecoderILNS_9FieldTypeE27EE4initEv Unexecuted instantiation: _ZN5doris10segment_v222BinaryPlainPageDecoderILNS_9FieldTypeE36EE4initEv |
225 | | |
226 | 238 | Status seek_to_position_in_page(size_t pos) override { |
227 | 238 | if (_num_elems == 0) [[unlikely]] { |
228 | 0 | if (pos != 0) { |
229 | 0 | return Status::Error<ErrorCode::INTERNAL_ERROR, false>( |
230 | 0 | "seek pos {} is larger than total elements {}", pos, _num_elems); |
231 | 0 | } |
232 | 0 | } |
233 | 238 | DCHECK_LE(pos, _num_elems); |
234 | 238 | _cur_idx = pos; |
235 | 238 | return Status::OK(); |
236 | 238 | } _ZN5doris10segment_v222BinaryPlainPageDecoderILNS_9FieldTypeE17EE24seek_to_position_in_pageEm Line | Count | Source | 226 | 191 | Status seek_to_position_in_page(size_t pos) override { | 227 | 191 | if (_num_elems == 0) [[unlikely]] { | 228 | 0 | if (pos != 0) { | 229 | 0 | return Status::Error<ErrorCode::INTERNAL_ERROR, false>( | 230 | 0 | "seek pos {} is larger than total elements {}", pos, _num_elems); | 231 | 0 | } | 232 | 0 | } | 233 | 191 | DCHECK_LE(pos, _num_elems); | 234 | 191 | _cur_idx = pos; | 235 | 191 | return Status::OK(); | 236 | 191 | } |
_ZN5doris10segment_v222BinaryPlainPageDecoderILNS_9FieldTypeE26EE24seek_to_position_in_pageEm Line | Count | Source | 226 | 4 | Status seek_to_position_in_page(size_t pos) override { | 227 | 4 | if (_num_elems == 0) [[unlikely]] { | 228 | 0 | if (pos != 0) { | 229 | 0 | return Status::Error<ErrorCode::INTERNAL_ERROR, false>( | 230 | 0 | "seek pos {} is larger than total elements {}", pos, _num_elems); | 231 | 0 | } | 232 | 0 | } | 233 | 4 | DCHECK_LE(pos, _num_elems); | 234 | 4 | _cur_idx = pos; | 235 | 4 | return Status::OK(); | 236 | 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 | 226 | 43 | Status seek_to_position_in_page(size_t pos) override { | 227 | 43 | if (_num_elems == 0) [[unlikely]] { | 228 | 0 | if (pos != 0) { | 229 | 0 | return Status::Error<ErrorCode::INTERNAL_ERROR, false>( | 230 | 0 | "seek pos {} is larger than total elements {}", pos, _num_elems); | 231 | 0 | } | 232 | 0 | } | 233 | 43 | DCHECK_LE(pos, _num_elems); | 234 | 43 | _cur_idx = pos; | 235 | 43 | return Status::OK(); | 236 | 43 | } |
Unexecuted instantiation: _ZN5doris10segment_v222BinaryPlainPageDecoderILNS_9FieldTypeE27EE24seek_to_position_in_pageEm Unexecuted instantiation: _ZN5doris10segment_v222BinaryPlainPageDecoderILNS_9FieldTypeE36EE24seek_to_position_in_pageEm |
237 | | |
238 | 1.56k | Status next_batch(size_t* n, MutableColumnPtr& dst) override { |
239 | 1.56k | DCHECK(_parsed); |
240 | 1.56k | if (*n == 0 || _cur_idx >= _num_elems) [[unlikely]] { |
241 | 2 | *n = 0; |
242 | 2 | return Status::OK(); |
243 | 2 | } |
244 | 1.56k | const size_t max_fetch = std::min(*n, static_cast<size_t>(_num_elems - _cur_idx)); |
245 | | |
246 | 1.56k | if (_options.only_read_offsets) { |
247 | | // OFFSET_ONLY mode: read string lengths from page offset trailer |
248 | | // without copying actual char data. This allows length() to work. |
249 | 0 | _offsets.resize(max_fetch); |
250 | 0 | for (size_t i = 0; i < max_fetch; ++i) { |
251 | 0 | uint32_t str_start = offset(_cur_idx + i); |
252 | 0 | uint32_t str_end = offset(_cur_idx + i + 1); |
253 | 0 | _offsets[i] = str_end - str_start; |
254 | 0 | } |
255 | 0 | dst->insert_offsets_from_lengths(_offsets.data(), max_fetch); |
256 | 0 | _cur_idx += max_fetch; |
257 | 0 | *n = max_fetch; |
258 | 0 | return Status::OK(); |
259 | 0 | } |
260 | | |
261 | 1.56k | uint32_t last_offset = guarded_offset(_cur_idx); |
262 | 1.56k | _offsets.resize(max_fetch + 1); |
263 | 1.56k | _offsets[0] = last_offset; |
264 | 305k | for (int i = 0; i < max_fetch - 1; i++, _cur_idx++) { |
265 | 303k | const uint32_t start_offset = last_offset; |
266 | 303k | last_offset = guarded_offset(_cur_idx + 1); |
267 | 303k | _offsets[i + 1] = last_offset; |
268 | 303k | if constexpr (Type == FieldType::OLAP_FIELD_TYPE_BITMAP) { |
269 | 0 | if (_options.need_check_bitmap) { |
270 | 0 | RETURN_IF_ERROR(BitmapTypeCode::validate(*(_data.data + start_offset))); |
271 | 0 | } |
272 | 0 | } |
273 | 303k | } |
274 | 1.56k | _cur_idx++; |
275 | 1.56k | _offsets[max_fetch] = offset(_cur_idx); |
276 | 1.56k | if constexpr (Type == FieldType::OLAP_FIELD_TYPE_BITMAP) { |
277 | 43 | if (_options.need_check_bitmap) { |
278 | 0 | RETURN_IF_ERROR(BitmapTypeCode::validate(*(_data.data + last_offset))); |
279 | 0 | } |
280 | 43 | } |
281 | 43 | dst->insert_many_continuous_binary_data(_data.data, _offsets.data(), max_fetch); |
282 | | |
283 | 1.56k | *n = max_fetch; |
284 | 1.56k | return Status::OK(); |
285 | 1.56k | } _ZN5doris10segment_v222BinaryPlainPageDecoderILNS_9FieldTypeE17EE10next_batchEPmRNS_3COWINS_7IColumnEE11mutable_ptrIS6_EE Line | Count | Source | 238 | 1.51k | Status next_batch(size_t* n, MutableColumnPtr& dst) override { | 239 | 1.51k | DCHECK(_parsed); | 240 | 1.51k | if (*n == 0 || _cur_idx >= _num_elems) [[unlikely]] { | 241 | 1 | *n = 0; | 242 | 1 | return Status::OK(); | 243 | 1 | } | 244 | 1.51k | const size_t max_fetch = std::min(*n, static_cast<size_t>(_num_elems - _cur_idx)); | 245 | | | 246 | 1.51k | if (_options.only_read_offsets) { | 247 | | // OFFSET_ONLY mode: read string lengths from page offset trailer | 248 | | // without copying actual char data. This allows length() to work. | 249 | 0 | _offsets.resize(max_fetch); | 250 | 0 | for (size_t i = 0; i < max_fetch; ++i) { | 251 | 0 | uint32_t str_start = offset(_cur_idx + i); | 252 | 0 | uint32_t str_end = offset(_cur_idx + i + 1); | 253 | 0 | _offsets[i] = str_end - str_start; | 254 | 0 | } | 255 | 0 | dst->insert_offsets_from_lengths(_offsets.data(), max_fetch); | 256 | 0 | _cur_idx += max_fetch; | 257 | 0 | *n = max_fetch; | 258 | 0 | return Status::OK(); | 259 | 0 | } | 260 | | | 261 | 1.51k | uint32_t last_offset = guarded_offset(_cur_idx); | 262 | 1.51k | _offsets.resize(max_fetch + 1); | 263 | 1.51k | _offsets[0] = last_offset; | 264 | 305k | for (int i = 0; i < max_fetch - 1; i++, _cur_idx++) { | 265 | 303k | const uint32_t start_offset = last_offset; | 266 | 303k | last_offset = guarded_offset(_cur_idx + 1); | 267 | 303k | _offsets[i + 1] = last_offset; | 268 | | if constexpr (Type == FieldType::OLAP_FIELD_TYPE_BITMAP) { | 269 | | if (_options.need_check_bitmap) { | 270 | | RETURN_IF_ERROR(BitmapTypeCode::validate(*(_data.data + start_offset))); | 271 | | } | 272 | | } | 273 | 303k | } | 274 | 1.51k | _cur_idx++; | 275 | 1.51k | _offsets[max_fetch] = offset(_cur_idx); | 276 | | if constexpr (Type == FieldType::OLAP_FIELD_TYPE_BITMAP) { | 277 | | if (_options.need_check_bitmap) { | 278 | | RETURN_IF_ERROR(BitmapTypeCode::validate(*(_data.data + last_offset))); | 279 | | } | 280 | | } | 281 | 1.51k | dst->insert_many_continuous_binary_data(_data.data, _offsets.data(), max_fetch); | 282 | | | 283 | 1.51k | *n = max_fetch; | 284 | 1.51k | return Status::OK(); | 285 | 1.51k | } |
_ZN5doris10segment_v222BinaryPlainPageDecoderILNS_9FieldTypeE26EE10next_batchEPmRNS_3COWINS_7IColumnEE11mutable_ptrIS6_EE Line | Count | Source | 238 | 6 | Status next_batch(size_t* n, MutableColumnPtr& dst) override { | 239 | 6 | DCHECK(_parsed); | 240 | 6 | if (*n == 0 || _cur_idx >= _num_elems) [[unlikely]] { | 241 | 1 | *n = 0; | 242 | 1 | return Status::OK(); | 243 | 1 | } | 244 | 5 | const size_t max_fetch = std::min(*n, static_cast<size_t>(_num_elems - _cur_idx)); | 245 | | | 246 | 5 | if (_options.only_read_offsets) { | 247 | | // OFFSET_ONLY mode: read string lengths from page offset trailer | 248 | | // without copying actual char data. This allows length() to work. | 249 | 0 | _offsets.resize(max_fetch); | 250 | 0 | for (size_t i = 0; i < max_fetch; ++i) { | 251 | 0 | uint32_t str_start = offset(_cur_idx + i); | 252 | 0 | uint32_t str_end = offset(_cur_idx + i + 1); | 253 | 0 | _offsets[i] = str_end - str_start; | 254 | 0 | } | 255 | 0 | dst->insert_offsets_from_lengths(_offsets.data(), max_fetch); | 256 | 0 | _cur_idx += max_fetch; | 257 | 0 | *n = max_fetch; | 258 | 0 | return Status::OK(); | 259 | 0 | } | 260 | | | 261 | 5 | uint32_t last_offset = guarded_offset(_cur_idx); | 262 | 5 | _offsets.resize(max_fetch + 1); | 263 | 5 | _offsets[0] = last_offset; | 264 | 7 | for (int i = 0; i < max_fetch - 1; i++, _cur_idx++) { | 265 | 2 | const uint32_t start_offset = last_offset; | 266 | 2 | last_offset = guarded_offset(_cur_idx + 1); | 267 | 2 | _offsets[i + 1] = last_offset; | 268 | | if constexpr (Type == FieldType::OLAP_FIELD_TYPE_BITMAP) { | 269 | | if (_options.need_check_bitmap) { | 270 | | RETURN_IF_ERROR(BitmapTypeCode::validate(*(_data.data + start_offset))); | 271 | | } | 272 | | } | 273 | 2 | } | 274 | 5 | _cur_idx++; | 275 | 5 | _offsets[max_fetch] = offset(_cur_idx); | 276 | | if constexpr (Type == FieldType::OLAP_FIELD_TYPE_BITMAP) { | 277 | | if (_options.need_check_bitmap) { | 278 | | RETURN_IF_ERROR(BitmapTypeCode::validate(*(_data.data + last_offset))); | 279 | | } | 280 | | } | 281 | 5 | dst->insert_many_continuous_binary_data(_data.data, _offsets.data(), max_fetch); | 282 | | | 283 | 5 | *n = max_fetch; | 284 | 5 | return Status::OK(); | 285 | 5 | } |
_ZN5doris10segment_v222BinaryPlainPageDecoderILNS_9FieldTypeE13EE10next_batchEPmRNS_3COWINS_7IColumnEE11mutable_ptrIS6_EE Line | Count | Source | 238 | 1 | Status next_batch(size_t* n, MutableColumnPtr& dst) override { | 239 | 1 | DCHECK(_parsed); | 240 | 1 | if (*n == 0 || _cur_idx >= _num_elems) [[unlikely]] { | 241 | 0 | *n = 0; | 242 | 0 | return Status::OK(); | 243 | 0 | } | 244 | 1 | const size_t max_fetch = std::min(*n, static_cast<size_t>(_num_elems - _cur_idx)); | 245 | | | 246 | 1 | if (_options.only_read_offsets) { | 247 | | // OFFSET_ONLY mode: read string lengths from page offset trailer | 248 | | // without copying actual char data. This allows length() to work. | 249 | 0 | _offsets.resize(max_fetch); | 250 | 0 | for (size_t i = 0; i < max_fetch; ++i) { | 251 | 0 | uint32_t str_start = offset(_cur_idx + i); | 252 | 0 | uint32_t str_end = offset(_cur_idx + i + 1); | 253 | 0 | _offsets[i] = str_end - str_start; | 254 | 0 | } | 255 | 0 | dst->insert_offsets_from_lengths(_offsets.data(), max_fetch); | 256 | 0 | _cur_idx += max_fetch; | 257 | 0 | *n = max_fetch; | 258 | 0 | return Status::OK(); | 259 | 0 | } | 260 | | | 261 | 1 | uint32_t last_offset = guarded_offset(_cur_idx); | 262 | 1 | _offsets.resize(max_fetch + 1); | 263 | 1 | _offsets[0] = last_offset; | 264 | 3 | for (int i = 0; i < max_fetch - 1; i++, _cur_idx++) { | 265 | 2 | const uint32_t start_offset = last_offset; | 266 | 2 | last_offset = guarded_offset(_cur_idx + 1); | 267 | 2 | _offsets[i + 1] = last_offset; | 268 | | if constexpr (Type == FieldType::OLAP_FIELD_TYPE_BITMAP) { | 269 | | if (_options.need_check_bitmap) { | 270 | | RETURN_IF_ERROR(BitmapTypeCode::validate(*(_data.data + start_offset))); | 271 | | } | 272 | | } | 273 | 2 | } | 274 | 1 | _cur_idx++; | 275 | 1 | _offsets[max_fetch] = offset(_cur_idx); | 276 | | if constexpr (Type == FieldType::OLAP_FIELD_TYPE_BITMAP) { | 277 | | if (_options.need_check_bitmap) { | 278 | | RETURN_IF_ERROR(BitmapTypeCode::validate(*(_data.data + last_offset))); | 279 | | } | 280 | | } | 281 | 1 | dst->insert_many_continuous_binary_data(_data.data, _offsets.data(), max_fetch); | 282 | | | 283 | 1 | *n = max_fetch; | 284 | 1 | return Status::OK(); | 285 | 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 | 238 | 43 | Status next_batch(size_t* n, MutableColumnPtr& dst) override { | 239 | 43 | DCHECK(_parsed); | 240 | 43 | if (*n == 0 || _cur_idx >= _num_elems) [[unlikely]] { | 241 | 0 | *n = 0; | 242 | 0 | return Status::OK(); | 243 | 0 | } | 244 | 43 | const size_t max_fetch = std::min(*n, static_cast<size_t>(_num_elems - _cur_idx)); | 245 | | | 246 | 43 | if (_options.only_read_offsets) { | 247 | | // OFFSET_ONLY mode: read string lengths from page offset trailer | 248 | | // without copying actual char data. This allows length() to work. | 249 | 0 | _offsets.resize(max_fetch); | 250 | 0 | for (size_t i = 0; i < max_fetch; ++i) { | 251 | 0 | uint32_t str_start = offset(_cur_idx + i); | 252 | 0 | uint32_t str_end = offset(_cur_idx + i + 1); | 253 | 0 | _offsets[i] = str_end - str_start; | 254 | 0 | } | 255 | 0 | dst->insert_offsets_from_lengths(_offsets.data(), max_fetch); | 256 | 0 | _cur_idx += max_fetch; | 257 | 0 | *n = max_fetch; | 258 | 0 | return Status::OK(); | 259 | 0 | } | 260 | | | 261 | 43 | uint32_t last_offset = guarded_offset(_cur_idx); | 262 | 43 | _offsets.resize(max_fetch + 1); | 263 | 43 | _offsets[0] = last_offset; | 264 | 43 | for (int i = 0; i < max_fetch - 1; i++, _cur_idx++) { | 265 | 0 | const uint32_t start_offset = last_offset; | 266 | 0 | last_offset = guarded_offset(_cur_idx + 1); | 267 | 0 | _offsets[i + 1] = last_offset; | 268 | 0 | if constexpr (Type == FieldType::OLAP_FIELD_TYPE_BITMAP) { | 269 | 0 | if (_options.need_check_bitmap) { | 270 | 0 | RETURN_IF_ERROR(BitmapTypeCode::validate(*(_data.data + start_offset))); | 271 | 0 | } | 272 | 0 | } | 273 | 0 | } | 274 | 43 | _cur_idx++; | 275 | 43 | _offsets[max_fetch] = offset(_cur_idx); | 276 | 43 | if constexpr (Type == FieldType::OLAP_FIELD_TYPE_BITMAP) { | 277 | 43 | if (_options.need_check_bitmap) { | 278 | 0 | RETURN_IF_ERROR(BitmapTypeCode::validate(*(_data.data + last_offset))); | 279 | 0 | } | 280 | 43 | } | 281 | 43 | dst->insert_many_continuous_binary_data(_data.data, _offsets.data(), max_fetch); | 282 | | | 283 | 43 | *n = max_fetch; | 284 | 43 | return Status::OK(); | 285 | 43 | } |
Unexecuted instantiation: _ZN5doris10segment_v222BinaryPlainPageDecoderILNS_9FieldTypeE27EE10next_batchEPmRNS_3COWINS_7IColumnEE11mutable_ptrIS6_EE Unexecuted instantiation: _ZN5doris10segment_v222BinaryPlainPageDecoderILNS_9FieldTypeE36EE10next_batchEPmRNS_3COWINS_7IColumnEE11mutable_ptrIS6_EE |
286 | | |
287 | | Status read_by_rowids(const rowid_t* rowids, ordinal_t page_first_ordinal, size_t* n, |
288 | 509 | MutableColumnPtr& dst) override { |
289 | 509 | DCHECK(_parsed); |
290 | 509 | if (*n == 0) [[unlikely]] { |
291 | 0 | *n = 0; |
292 | 0 | return Status::OK(); |
293 | 0 | } |
294 | | |
295 | 509 | auto total = *n; |
296 | | |
297 | 509 | if (_options.only_read_offsets) { |
298 | | // OFFSET_ONLY mode: read string lengths from page offset trailer |
299 | | // without copying actual char data. This allows length() to work. |
300 | 0 | size_t read_count = 0; |
301 | 0 | _offsets.resize(total); |
302 | 0 | for (size_t i = 0; i < total; ++i) { |
303 | 0 | ordinal_t ord = rowids[i] - page_first_ordinal; |
304 | 0 | if (UNLIKELY(ord >= _num_elems)) { |
305 | 0 | break; |
306 | 0 | } |
307 | 0 | uint32_t str_start = offset(ord); |
308 | 0 | uint32_t str_end = offset(ord + 1); |
309 | 0 | _offsets[read_count] = str_end - str_start; |
310 | 0 | read_count++; |
311 | 0 | } |
312 | 0 | if (read_count > 0) { |
313 | 0 | dst->insert_offsets_from_lengths(_offsets.data(), read_count); |
314 | 0 | } |
315 | 0 | *n = read_count; |
316 | 0 | return Status::OK(); |
317 | 0 | } |
318 | | |
319 | 509 | size_t read_count = 0; |
320 | 509 | _binary_data.resize(total); |
321 | 2.27k | for (size_t i = 0; i < total; ++i) { |
322 | 1.76k | ordinal_t ord = rowids[i] - page_first_ordinal; |
323 | 1.76k | if (UNLIKELY(ord >= _num_elems)) { |
324 | 0 | break; |
325 | 0 | } |
326 | | |
327 | 1.76k | const uint32_t start_offset = offset(ord); |
328 | 1.76k | _binary_data[read_count].data = _data.mutable_data() + start_offset; |
329 | 1.76k | _binary_data[read_count].size = offset(ord + 1) - start_offset; |
330 | 1.76k | read_count++; |
331 | 1.76k | } |
332 | | |
333 | 509 | if (LIKELY(read_count > 0)) { |
334 | 509 | dst->insert_many_strings(_binary_data.data(), read_count); |
335 | 509 | } |
336 | | |
337 | 509 | *n = read_count; |
338 | 509 | return Status::OK(); |
339 | 509 | } _ZN5doris10segment_v222BinaryPlainPageDecoderILNS_9FieldTypeE17EE14read_by_rowidsEPKjmPmRNS_3COWINS_7IColumnEE11mutable_ptrIS8_EE Line | Count | Source | 288 | 508 | MutableColumnPtr& dst) override { | 289 | 508 | DCHECK(_parsed); | 290 | 508 | if (*n == 0) [[unlikely]] { | 291 | 0 | *n = 0; | 292 | 0 | return Status::OK(); | 293 | 0 | } | 294 | | | 295 | 508 | auto total = *n; | 296 | | | 297 | 508 | if (_options.only_read_offsets) { | 298 | | // OFFSET_ONLY mode: read string lengths from page offset trailer | 299 | | // without copying actual char data. This allows length() to work. | 300 | 0 | size_t read_count = 0; | 301 | 0 | _offsets.resize(total); | 302 | 0 | for (size_t i = 0; i < total; ++i) { | 303 | 0 | ordinal_t ord = rowids[i] - page_first_ordinal; | 304 | 0 | if (UNLIKELY(ord >= _num_elems)) { | 305 | 0 | break; | 306 | 0 | } | 307 | 0 | uint32_t str_start = offset(ord); | 308 | 0 | uint32_t str_end = offset(ord + 1); | 309 | 0 | _offsets[read_count] = str_end - str_start; | 310 | 0 | read_count++; | 311 | 0 | } | 312 | 0 | if (read_count > 0) { | 313 | 0 | dst->insert_offsets_from_lengths(_offsets.data(), read_count); | 314 | 0 | } | 315 | 0 | *n = read_count; | 316 | 0 | return Status::OK(); | 317 | 0 | } | 318 | | | 319 | 508 | size_t read_count = 0; | 320 | 508 | _binary_data.resize(total); | 321 | 2.26k | for (size_t i = 0; i < total; ++i) { | 322 | 1.76k | ordinal_t ord = rowids[i] - page_first_ordinal; | 323 | 1.76k | if (UNLIKELY(ord >= _num_elems)) { | 324 | 0 | break; | 325 | 0 | } | 326 | | | 327 | 1.76k | const uint32_t start_offset = offset(ord); | 328 | 1.76k | _binary_data[read_count].data = _data.mutable_data() + start_offset; | 329 | 1.76k | _binary_data[read_count].size = offset(ord + 1) - start_offset; | 330 | 1.76k | read_count++; | 331 | 1.76k | } | 332 | | | 333 | 508 | if (LIKELY(read_count > 0)) { | 334 | 508 | dst->insert_many_strings(_binary_data.data(), read_count); | 335 | 508 | } | 336 | | | 337 | 508 | *n = read_count; | 338 | 508 | return Status::OK(); | 339 | 508 | } |
_ZN5doris10segment_v222BinaryPlainPageDecoderILNS_9FieldTypeE26EE14read_by_rowidsEPKjmPmRNS_3COWINS_7IColumnEE11mutable_ptrIS8_EE Line | Count | Source | 288 | 1 | MutableColumnPtr& dst) override { | 289 | 1 | DCHECK(_parsed); | 290 | 1 | if (*n == 0) [[unlikely]] { | 291 | 0 | *n = 0; | 292 | 0 | return Status::OK(); | 293 | 0 | } | 294 | | | 295 | 1 | auto total = *n; | 296 | | | 297 | 1 | if (_options.only_read_offsets) { | 298 | | // OFFSET_ONLY mode: read string lengths from page offset trailer | 299 | | // without copying actual char data. This allows length() to work. | 300 | 0 | size_t read_count = 0; | 301 | 0 | _offsets.resize(total); | 302 | 0 | for (size_t i = 0; i < total; ++i) { | 303 | 0 | ordinal_t ord = rowids[i] - page_first_ordinal; | 304 | 0 | if (UNLIKELY(ord >= _num_elems)) { | 305 | 0 | break; | 306 | 0 | } | 307 | 0 | uint32_t str_start = offset(ord); | 308 | 0 | uint32_t str_end = offset(ord + 1); | 309 | 0 | _offsets[read_count] = str_end - str_start; | 310 | 0 | read_count++; | 311 | 0 | } | 312 | 0 | if (read_count > 0) { | 313 | 0 | dst->insert_offsets_from_lengths(_offsets.data(), read_count); | 314 | 0 | } | 315 | 0 | *n = read_count; | 316 | 0 | return Status::OK(); | 317 | 0 | } | 318 | | | 319 | 1 | size_t read_count = 0; | 320 | 1 | _binary_data.resize(total); | 321 | 5 | for (size_t i = 0; i < total; ++i) { | 322 | 4 | ordinal_t ord = rowids[i] - page_first_ordinal; | 323 | 4 | if (UNLIKELY(ord >= _num_elems)) { | 324 | 0 | break; | 325 | 0 | } | 326 | | | 327 | 4 | const uint32_t start_offset = offset(ord); | 328 | 4 | _binary_data[read_count].data = _data.mutable_data() + start_offset; | 329 | 4 | _binary_data[read_count].size = offset(ord + 1) - start_offset; | 330 | 4 | read_count++; | 331 | 4 | } | 332 | | | 333 | 1 | if (LIKELY(read_count > 0)) { | 334 | 1 | dst->insert_many_strings(_binary_data.data(), read_count); | 335 | 1 | } | 336 | | | 337 | 1 | *n = read_count; | 338 | 1 | return Status::OK(); | 339 | 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 |
340 | | |
341 | 5.53k | size_t count() const override { |
342 | 5.53k | DCHECK(_parsed); |
343 | 5.53k | return _num_elems; |
344 | 5.53k | } _ZNK5doris10segment_v222BinaryPlainPageDecoderILNS_9FieldTypeE17EE5countEv Line | Count | Source | 341 | 5.52k | size_t count() const override { | 342 | | DCHECK(_parsed); | 343 | 5.52k | return _num_elems; | 344 | 5.52k | } |
_ZNK5doris10segment_v222BinaryPlainPageDecoderILNS_9FieldTypeE26EE5countEv Line | Count | Source | 341 | 2 | size_t count() const override { | 342 | | DCHECK(_parsed); | 343 | 2 | return _num_elems; | 344 | 2 | } |
_ZNK5doris10segment_v222BinaryPlainPageDecoderILNS_9FieldTypeE13EE5countEv Line | Count | Source | 341 | 1 | size_t count() const override { | 342 | | DCHECK(_parsed); | 343 | 1 | return _num_elems; | 344 | 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 |
345 | | |
346 | 138 | size_t current_index() const override { |
347 | 138 | DCHECK(_parsed); |
348 | 138 | return _cur_idx; |
349 | 138 | } _ZNK5doris10segment_v222BinaryPlainPageDecoderILNS_9FieldTypeE17EE13current_indexEv Line | Count | Source | 346 | 91 | size_t current_index() const override { | 347 | | DCHECK(_parsed); | 348 | 91 | return _cur_idx; | 349 | 91 | } |
_ZNK5doris10segment_v222BinaryPlainPageDecoderILNS_9FieldTypeE26EE13current_indexEv Line | Count | Source | 346 | 4 | size_t current_index() const override { | 347 | | DCHECK(_parsed); | 348 | 4 | return _cur_idx; | 349 | 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 | 346 | 43 | size_t current_index() const override { | 347 | | DCHECK(_parsed); | 348 | 43 | return _cur_idx; | 349 | 43 | } |
Unexecuted instantiation: _ZNK5doris10segment_v222BinaryPlainPageDecoderILNS_9FieldTypeE27EE13current_indexEv Unexecuted instantiation: _ZNK5doris10segment_v222BinaryPlainPageDecoderILNS_9FieldTypeE36EE13current_indexEv |
350 | | |
351 | | Slice string_at_index(size_t idx) const { |
352 | | const uint32_t start_offset = offset(idx); |
353 | | uint32_t len = offset(idx + 1) - start_offset; |
354 | | return Slice(&_data[start_offset], len); |
355 | | } |
356 | | |
357 | 2.75k | Status get_dict_word_info(StringRef* dict_word_info) override { |
358 | 2.75k | if (UNLIKELY(_num_elems <= 0)) { |
359 | 0 | return Status::OK(); |
360 | 0 | } |
361 | | |
362 | 2.75k | char* data_begin = (char*)&_data[0]; |
363 | 2.75k | char* offset_ptr = (char*)&_data[_offsets_pos]; |
364 | | |
365 | 76.4k | for (uint32_t i = 0; i < _num_elems; ++i) { |
366 | 73.7k | uint32_t offset = decode_fixed32_le((uint8_t*)offset_ptr); |
367 | 73.7k | if (offset > _offsets_pos) { |
368 | 0 | return Status::Corruption( |
369 | 0 | "file corruption: offsets pos beyonds data_size: {}, num_element: {}" |
370 | 0 | ", offset_pos: {}, offset: {}", |
371 | 0 | _data.size, _num_elems, _offsets_pos, offset); |
372 | 0 | } |
373 | 73.7k | dict_word_info[i].data = data_begin + offset; |
374 | 73.7k | offset_ptr += sizeof(uint32_t); |
375 | 73.7k | } |
376 | | |
377 | 73.7k | for (int i = 0; i < (int)_num_elems - 1; ++i) { |
378 | 70.9k | dict_word_info[i].size = |
379 | 70.9k | (char*)dict_word_info[i + 1].data - (char*)dict_word_info[i].data; |
380 | 70.9k | } |
381 | | |
382 | 2.75k | dict_word_info[_num_elems - 1].size = |
383 | 2.75k | (data_begin + _offsets_pos) - (char*)dict_word_info[_num_elems - 1].data; |
384 | 2.75k | return Status::OK(); |
385 | 2.75k | } _ZN5doris10segment_v222BinaryPlainPageDecoderILNS_9FieldTypeE17EE18get_dict_word_infoEPNS_9StringRefE Line | Count | Source | 357 | 2.75k | Status get_dict_word_info(StringRef* dict_word_info) override { | 358 | 2.75k | if (UNLIKELY(_num_elems <= 0)) { | 359 | 0 | return Status::OK(); | 360 | 0 | } | 361 | | | 362 | 2.75k | char* data_begin = (char*)&_data[0]; | 363 | 2.75k | char* offset_ptr = (char*)&_data[_offsets_pos]; | 364 | | | 365 | 76.4k | for (uint32_t i = 0; i < _num_elems; ++i) { | 366 | 73.7k | uint32_t offset = decode_fixed32_le((uint8_t*)offset_ptr); | 367 | 73.7k | if (offset > _offsets_pos) { | 368 | 0 | return Status::Corruption( | 369 | 0 | "file corruption: offsets pos beyonds data_size: {}, num_element: {}" | 370 | 0 | ", offset_pos: {}, offset: {}", | 371 | 0 | _data.size, _num_elems, _offsets_pos, offset); | 372 | 0 | } | 373 | 73.7k | dict_word_info[i].data = data_begin + offset; | 374 | 73.7k | offset_ptr += sizeof(uint32_t); | 375 | 73.7k | } | 376 | | | 377 | 73.7k | for (int i = 0; i < (int)_num_elems - 1; ++i) { | 378 | 70.9k | dict_word_info[i].size = | 379 | 70.9k | (char*)dict_word_info[i + 1].data - (char*)dict_word_info[i].data; | 380 | 70.9k | } | 381 | | | 382 | 2.75k | dict_word_info[_num_elems - 1].size = | 383 | 2.75k | (data_begin + _offsets_pos) - (char*)dict_word_info[_num_elems - 1].data; | 384 | 2.75k | return Status::OK(); | 385 | 2.75k | } |
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 |
386 | | |
387 | | private: |
388 | | static constexpr size_t SIZE_OF_INT32 = sizeof(uint32_t); |
389 | | // Return the offset within '_data' where the string value with index 'idx' can be found. |
390 | 5.09k | uint32_t offset(size_t idx) const { |
391 | 5.09k | if (idx >= _num_elems) { |
392 | 1.97k | return _offsets_pos; |
393 | 1.97k | } |
394 | 3.12k | return guarded_offset(idx); |
395 | 5.09k | } _ZNK5doris10segment_v222BinaryPlainPageDecoderILNS_9FieldTypeE17EE6offsetEm Line | Count | Source | 390 | 5.03k | uint32_t offset(size_t idx) const { | 391 | 5.03k | if (idx >= _num_elems) { | 392 | 1.94k | return _offsets_pos; | 393 | 1.94k | } | 394 | 3.09k | return guarded_offset(idx); | 395 | 5.03k | } |
_ZNK5doris10segment_v222BinaryPlainPageDecoderILNS_9FieldTypeE26EE6offsetEm Line | Count | Source | 390 | 13 | uint32_t offset(size_t idx) const { | 391 | 13 | if (idx >= _num_elems) { | 392 | 4 | return _offsets_pos; | 393 | 4 | } | 394 | 9 | return guarded_offset(idx); | 395 | 13 | } |
_ZNK5doris10segment_v222BinaryPlainPageDecoderILNS_9FieldTypeE13EE6offsetEm Line | Count | Source | 390 | 1 | uint32_t offset(size_t idx) const { | 391 | 1 | if (idx >= _num_elems) { | 392 | 1 | return _offsets_pos; | 393 | 1 | } | 394 | 0 | return guarded_offset(idx); | 395 | 1 | } |
Unexecuted instantiation: _ZNK5doris10segment_v222BinaryPlainPageDecoderILNS_9FieldTypeE34EE6offsetEm Unexecuted instantiation: _ZNK5doris10segment_v222BinaryPlainPageDecoderILNS_9FieldTypeE35EE6offsetEm Unexecuted instantiation: _ZNK5doris10segment_v222BinaryPlainPageDecoderILNS_9FieldTypeE23EE6offsetEm _ZNK5doris10segment_v222BinaryPlainPageDecoderILNS_9FieldTypeE25EE6offsetEm Line | Count | Source | 390 | 43 | uint32_t offset(size_t idx) const { | 391 | 43 | if (idx >= _num_elems) { | 392 | 21 | return _offsets_pos; | 393 | 21 | } | 394 | 22 | return guarded_offset(idx); | 395 | 43 | } |
Unexecuted instantiation: _ZNK5doris10segment_v222BinaryPlainPageDecoderILNS_9FieldTypeE27EE6offsetEm Unexecuted instantiation: _ZNK5doris10segment_v222BinaryPlainPageDecoderILNS_9FieldTypeE36EE6offsetEm |
396 | | |
397 | 308k | uint32_t guarded_offset(size_t idx) const { |
398 | 308k | const auto* p = |
399 | 308k | reinterpret_cast<const uint8_t*>(&_data[_offsets_pos + idx * SIZE_OF_INT32]); |
400 | 308k | return decode_fixed32_le(p); |
401 | 308k | } _ZNK5doris10segment_v222BinaryPlainPageDecoderILNS_9FieldTypeE17EE14guarded_offsetEm Line | Count | Source | 397 | 308k | uint32_t guarded_offset(size_t idx) const { | 398 | 308k | const auto* p = | 399 | 308k | reinterpret_cast<const uint8_t*>(&_data[_offsets_pos + idx * SIZE_OF_INT32]); | 400 | 308k | return decode_fixed32_le(p); | 401 | 308k | } |
_ZNK5doris10segment_v222BinaryPlainPageDecoderILNS_9FieldTypeE26EE14guarded_offsetEm Line | Count | Source | 397 | 16 | uint32_t guarded_offset(size_t idx) const { | 398 | 16 | const auto* p = | 399 | 16 | reinterpret_cast<const uint8_t*>(&_data[_offsets_pos + idx * SIZE_OF_INT32]); | 400 | 16 | return decode_fixed32_le(p); | 401 | 16 | } |
_ZNK5doris10segment_v222BinaryPlainPageDecoderILNS_9FieldTypeE13EE14guarded_offsetEm Line | Count | Source | 397 | 3 | uint32_t guarded_offset(size_t idx) const { | 398 | 3 | const auto* p = | 399 | 3 | reinterpret_cast<const uint8_t*>(&_data[_offsets_pos + idx * SIZE_OF_INT32]); | 400 | 3 | return decode_fixed32_le(p); | 401 | 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 | 397 | 65 | uint32_t guarded_offset(size_t idx) const { | 398 | 65 | const auto* p = | 399 | 65 | reinterpret_cast<const uint8_t*>(&_data[_offsets_pos + idx * SIZE_OF_INT32]); | 400 | 65 | return decode_fixed32_le(p); | 401 | 65 | } |
Unexecuted instantiation: _ZNK5doris10segment_v222BinaryPlainPageDecoderILNS_9FieldTypeE27EE14guarded_offsetEm Unexecuted instantiation: _ZNK5doris10segment_v222BinaryPlainPageDecoderILNS_9FieldTypeE36EE14guarded_offsetEm |
402 | | |
403 | | Slice _data; |
404 | | PageDecoderOptions _options; |
405 | | bool _parsed; |
406 | | |
407 | | uint32_t _num_elems; |
408 | | uint32_t _offsets_pos; |
409 | | |
410 | | std::vector<uint32_t> _offsets; |
411 | | std::vector<StringRef> _binary_data; |
412 | | |
413 | | // Index of the currently seeked element in the page. |
414 | | size_t _cur_idx; |
415 | | friend class BinaryDictPageDecoder; |
416 | | friend class FileColumnIterator; |
417 | | }; |
418 | | |
419 | | #include "common/compile_check_end.h" |
420 | | } // namespace segment_v2 |
421 | | } // namespace doris |