Coverage Report

Created: 2026-10-01 20:46

next uncovered line (L), next uncovered region (R), next uncovered branch (B)
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
24.8k
    Status init() override { return reset(); }
_ZN5doris10segment_v222BinaryPlainPageBuilderILNS_9FieldTypeE13EE4initEv
Line
Count
Source
50
3
    Status init() override { return reset(); }
_ZN5doris10segment_v222BinaryPlainPageBuilderILNS_9FieldTypeE17EE4initEv
Line
Count
Source
50
6.98k
    Status init() override { return reset(); }
_ZN5doris10segment_v222BinaryPlainPageBuilderILNS_9FieldTypeE26EE4initEv
Line
Count
Source
50
83
    Status init() override { return reset(); }
_ZN5doris10segment_v222BinaryPlainPageBuilderILNS_9FieldTypeE34EE4initEv
Line
Count
Source
50
2
    Status init() override { return reset(); }
Unexecuted instantiation: _ZN5doris10segment_v222BinaryPlainPageBuilderILNS_9FieldTypeE35EE4initEv
_ZN5doris10segment_v222BinaryPlainPageBuilderILNS_9FieldTypeE23EE4initEv
Line
Count
Source
50
18
    Status init() override { return reset(); }
_ZN5doris10segment_v222BinaryPlainPageBuilderILNS_9FieldTypeE25EE4initEv
Line
Count
Source
50
17.6k
    Status init() override { return reset(); }
_ZN5doris10segment_v222BinaryPlainPageBuilderILNS_9FieldTypeE27EE4initEv
Line
Count
Source
50
18
    Status init() override { return reset(); }
_ZN5doris10segment_v222BinaryPlainPageBuilderILNS_9FieldTypeE36EE4initEv
Line
Count
Source
50
54
    Status init() override { return reset(); }
51
52
1.73M
    bool is_page_full() override {
53
1.73M
        bool ret = false;
54
1.73M
        if (_options.is_dict_page) {
55
            // dict_page_size is 0, do not limit the page size
56
1.31M
            ret = _options.dict_page_size != 0 && _size_estimate > _options.dict_page_size;
57
1.31M
        } else {
58
422k
            ret = _options.data_page_size != 0 && _size_estimate > _options.data_page_size;
59
422k
        }
60
1.73M
        return ret;
61
1.73M
    }
_ZN5doris10segment_v222BinaryPlainPageBuilderILNS_9FieldTypeE13EE12is_page_fullEv
Line
Count
Source
52
564
    bool is_page_full() override {
53
564
        bool ret = false;
54
564
        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
564
        } else {
58
564
            ret = _options.data_page_size != 0 && _size_estimate > _options.data_page_size;
59
564
        }
60
564
        return ret;
61
564
    }
_ZN5doris10segment_v222BinaryPlainPageBuilderILNS_9FieldTypeE17EE12is_page_fullEv
Line
Count
Source
52
1.67M
    bool is_page_full() override {
53
1.67M
        bool ret = false;
54
1.67M
        if (_options.is_dict_page) {
55
            // dict_page_size is 0, do not limit the page size
56
1.31M
            ret = _options.dict_page_size != 0 && _size_estimate > _options.dict_page_size;
57
1.31M
        } else {
58
352k
            ret = _options.data_page_size != 0 && _size_estimate > _options.data_page_size;
59
352k
        }
60
1.67M
        return ret;
61
1.67M
    }
_ZN5doris10segment_v222BinaryPlainPageBuilderILNS_9FieldTypeE26EE12is_page_fullEv
Line
Count
Source
52
925
    bool is_page_full() override {
53
925
        bool ret = false;
54
925
        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
925
        } else {
58
925
            ret = _options.data_page_size != 0 && _size_estimate > _options.data_page_size;
59
925
        }
60
925
        return ret;
61
925
    }
_ZN5doris10segment_v222BinaryPlainPageBuilderILNS_9FieldTypeE34EE12is_page_fullEv
Line
Count
Source
52
558
    bool is_page_full() override {
53
558
        bool ret = false;
54
558
        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
558
        } else {
58
558
            ret = _options.data_page_size != 0 && _size_estimate > _options.data_page_size;
59
558
        }
60
558
        return ret;
61
558
    }
Unexecuted instantiation: _ZN5doris10segment_v222BinaryPlainPageBuilderILNS_9FieldTypeE35EE12is_page_fullEv
_ZN5doris10segment_v222BinaryPlainPageBuilderILNS_9FieldTypeE23EE12is_page_fullEv
Line
Count
Source
52
192
    bool is_page_full() override {
53
192
        bool ret = false;
54
192
        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
192
        } else {
58
192
            ret = _options.data_page_size != 0 && _size_estimate > _options.data_page_size;
59
192
        }
60
192
        return ret;
61
192
    }
_ZN5doris10segment_v222BinaryPlainPageBuilderILNS_9FieldTypeE25EE12is_page_fullEv
Line
Count
Source
52
66.0k
    bool is_page_full() override {
53
66.0k
        bool ret = false;
54
66.0k
        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
66.0k
        } else {
58
66.0k
            ret = _options.data_page_size != 0 && _size_estimate > _options.data_page_size;
59
66.0k
        }
60
66.0k
        return ret;
61
66.0k
    }
_ZN5doris10segment_v222BinaryPlainPageBuilderILNS_9FieldTypeE27EE12is_page_fullEv
Line
Count
Source
52
356
    bool is_page_full() override {
53
356
        bool ret = false;
54
356
        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
356
        } else {
58
356
            ret = _options.data_page_size != 0 && _size_estimate > _options.data_page_size;
59
356
        }
60
356
        return ret;
61
356
    }
_ZN5doris10segment_v222BinaryPlainPageBuilderILNS_9FieldTypeE36EE12is_page_fullEv
Line
Count
Source
52
800
    bool is_page_full() override {
53
800
        bool ret = false;
54
800
        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
800
        } else {
58
800
            ret = _options.data_page_size != 0 && _size_estimate > _options.data_page_size;
59
800
        }
60
800
        return ret;
61
800
    }
62
63
236k
    Status add(const uint8_t* vals, size_t* count) override {
64
236k
        DCHECK(!_finished);
65
236k
        DCHECK_GT(*count, 0);
66
236k
        size_t i = 0;
67
68
        // If the page is full, should stop adding more items.
69
515k
        while (!is_page_full() && i < *count) {
70
278k
            const auto* src = reinterpret_cast<const Slice*>(vals);
71
278k
            if constexpr (Type == FieldType::OLAP_FIELD_TYPE_BITMAP) {
72
22.1k
                if (_options.need_check_bitmap) {
73
205
                    RETURN_IF_ERROR(BitmapTypeCode::validate(*(src->data)));
74
205
                }
75
22.1k
            }
76
22.1k
            size_t offset = _buffer.size();
77
278k
            _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
278k
            RETURN_IF_CATCH_EXCEPTION(_buffer.append(src->data, src->size));
81
82
278k
            _last_value_size = cast_set<uint32_t>(src->size);
83
278k
            _size_estimate += src->size;
84
278k
            _size_estimate += sizeof(uint32_t);
85
278k
            _raw_data_size += src->size;
86
87
278k
            i++;
88
278k
            vals += sizeof(Slice);
89
278k
        }
90
91
236k
        *count = i;
92
236k
        return Status::OK();
93
236k
    }
_ZN5doris10segment_v222BinaryPlainPageBuilderILNS_9FieldTypeE13EE3addEPKhPm
Line
Count
Source
63
65
    Status add(const uint8_t* vals, size_t* count) override {
64
65
        DCHECK(!_finished);
65
65
        DCHECK_GT(*count, 0);
66
65
        size_t i = 0;
67
68
        // If the page is full, should stop adding more items.
69
500
        while (!is_page_full() && i < *count) {
70
435
            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
435
            size_t offset = _buffer.size();
77
435
            _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
435
            RETURN_IF_CATCH_EXCEPTION(_buffer.append(src->data, src->size));
81
82
435
            _last_value_size = cast_set<uint32_t>(src->size);
83
435
            _size_estimate += src->size;
84
435
            _size_estimate += sizeof(uint32_t);
85
435
            _raw_data_size += src->size;
86
87
435
            i++;
88
435
            vals += sizeof(Slice);
89
435
        }
90
91
65
        *count = i;
92
65
        return Status::OK();
93
65
    }
_ZN5doris10segment_v222BinaryPlainPageBuilderILNS_9FieldTypeE17EE3addEPKhPm
Line
Count
Source
63
214k
    Status add(const uint8_t* vals, size_t* count) override {
64
214k
        DCHECK(!_finished);
65
214k
        DCHECK_GT(*count, 0);
66
214k
        size_t i = 0;
67
68
        // If the page is full, should stop adding more items.
69
468k
        while (!is_page_full() && i < *count) {
70
253k
            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
253k
            size_t offset = _buffer.size();
77
253k
            _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
253k
            RETURN_IF_CATCH_EXCEPTION(_buffer.append(src->data, src->size));
81
82
253k
            _last_value_size = cast_set<uint32_t>(src->size);
83
253k
            _size_estimate += src->size;
84
253k
            _size_estimate += sizeof(uint32_t);
85
253k
            _raw_data_size += src->size;
86
87
253k
            i++;
88
253k
            vals += sizeof(Slice);
89
253k
        }
90
91
214k
        *count = i;
92
214k
        return Status::OK();
93
214k
    }
_ZN5doris10segment_v222BinaryPlainPageBuilderILNS_9FieldTypeE26EE3addEPKhPm
Line
Count
Source
63
141
    Status add(const uint8_t* vals, size_t* count) override {
64
141
        DCHECK(!_finished);
65
141
        DCHECK_GT(*count, 0);
66
141
        size_t i = 0;
67
68
        // If the page is full, should stop adding more items.
69
784
        while (!is_page_full() && i < *count) {
70
643
            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
643
            size_t offset = _buffer.size();
77
643
            _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
643
            RETURN_IF_CATCH_EXCEPTION(_buffer.append(src->data, src->size));
81
82
643
            _last_value_size = cast_set<uint32_t>(src->size);
83
643
            _size_estimate += src->size;
84
643
            _size_estimate += sizeof(uint32_t);
85
643
            _raw_data_size += src->size;
86
87
643
            i++;
88
643
            vals += sizeof(Slice);
89
643
        }
90
91
141
        *count = i;
92
141
        return Status::OK();
93
141
    }
_ZN5doris10segment_v222BinaryPlainPageBuilderILNS_9FieldTypeE34EE3addEPKhPm
Line
Count
Source
63
64
    Status add(const uint8_t* vals, size_t* count) override {
64
64
        DCHECK(!_finished);
65
64
        DCHECK_GT(*count, 0);
66
64
        size_t i = 0;
67
68
        // If the page is full, should stop adding more items.
69
494
        while (!is_page_full() && i < *count) {
70
430
            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
430
            size_t offset = _buffer.size();
77
430
            _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
430
            RETURN_IF_CATCH_EXCEPTION(_buffer.append(src->data, src->size));
81
82
430
            _last_value_size = cast_set<uint32_t>(src->size);
83
430
            _size_estimate += src->size;
84
430
            _size_estimate += sizeof(uint32_t);
85
430
            _raw_data_size += src->size;
86
87
430
            i++;
88
430
            vals += sizeof(Slice);
89
430
        }
90
91
64
        *count = i;
92
64
        return Status::OK();
93
64
    }
Unexecuted instantiation: _ZN5doris10segment_v222BinaryPlainPageBuilderILNS_9FieldTypeE35EE3addEPKhPm
_ZN5doris10segment_v222BinaryPlainPageBuilderILNS_9FieldTypeE23EE3addEPKhPm
Line
Count
Source
63
32
    Status add(const uint8_t* vals, size_t* count) override {
64
32
        DCHECK(!_finished);
65
32
        DCHECK_GT(*count, 0);
66
32
        size_t i = 0;
67
68
        // If the page is full, should stop adding more items.
69
160
        while (!is_page_full() && i < *count) {
70
128
            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
128
            size_t offset = _buffer.size();
77
128
            _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
128
            RETURN_IF_CATCH_EXCEPTION(_buffer.append(src->data, src->size));
81
82
128
            _last_value_size = cast_set<uint32_t>(src->size);
83
128
            _size_estimate += src->size;
84
128
            _size_estimate += sizeof(uint32_t);
85
128
            _raw_data_size += src->size;
86
87
128
            i++;
88
128
            vals += sizeof(Slice);
89
128
        }
90
91
32
        *count = i;
92
32
        return Status::OK();
93
32
    }
_ZN5doris10segment_v222BinaryPlainPageBuilderILNS_9FieldTypeE25EE3addEPKhPm
Line
Count
Source
63
21.9k
    Status add(const uint8_t* vals, size_t* count) override {
64
21.9k
        DCHECK(!_finished);
65
21.9k
        DCHECK_GT(*count, 0);
66
21.9k
        size_t i = 0;
67
68
        // If the page is full, should stop adding more items.
69
44.0k
        while (!is_page_full() && i < *count) {
70
22.1k
            const auto* src = reinterpret_cast<const Slice*>(vals);
71
22.1k
            if constexpr (Type == FieldType::OLAP_FIELD_TYPE_BITMAP) {
72
22.1k
                if (_options.need_check_bitmap) {
73
205
                    RETURN_IF_ERROR(BitmapTypeCode::validate(*(src->data)));
74
205
                }
75
22.1k
            }
76
22.1k
            size_t offset = _buffer.size();
77
22.1k
            _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
22.1k
            RETURN_IF_CATCH_EXCEPTION(_buffer.append(src->data, src->size));
81
82
22.1k
            _last_value_size = cast_set<uint32_t>(src->size);
83
22.1k
            _size_estimate += src->size;
84
22.1k
            _size_estimate += sizeof(uint32_t);
85
22.1k
            _raw_data_size += src->size;
86
87
22.1k
            i++;
88
22.1k
            vals += sizeof(Slice);
89
22.1k
        }
90
91
21.9k
        *count = i;
92
21.9k
        return Status::OK();
93
21.9k
    }
_ZN5doris10segment_v222BinaryPlainPageBuilderILNS_9FieldTypeE27EE3addEPKhPm
Line
Count
Source
63
34
    Status add(const uint8_t* vals, size_t* count) override {
64
34
        DCHECK(!_finished);
65
34
        DCHECK_GT(*count, 0);
66
34
        size_t i = 0;
67
68
        // If the page is full, should stop adding more items.
69
322
        while (!is_page_full() && i < *count) {
70
288
            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
288
            size_t offset = _buffer.size();
77
288
            _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
288
            RETURN_IF_CATCH_EXCEPTION(_buffer.append(src->data, src->size));
81
82
288
            _last_value_size = cast_set<uint32_t>(src->size);
83
288
            _size_estimate += src->size;
84
288
            _size_estimate += sizeof(uint32_t);
85
288
            _raw_data_size += src->size;
86
87
288
            i++;
88
288
            vals += sizeof(Slice);
89
288
        }
90
91
34
        *count = i;
92
34
        return Status::OK();
93
34
    }
_ZN5doris10segment_v222BinaryPlainPageBuilderILNS_9FieldTypeE36EE3addEPKhPm
Line
Count
Source
63
88
    Status add(const uint8_t* vals, size_t* count) override {
64
88
        DCHECK(!_finished);
65
88
        DCHECK_GT(*count, 0);
66
88
        size_t i = 0;
67
68
        // If the page is full, should stop adding more items.
69
712
        while (!is_page_full() && i < *count) {
70
624
            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
624
            size_t offset = _buffer.size();
77
624
            _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
624
            RETURN_IF_CATCH_EXCEPTION(_buffer.append(src->data, src->size));
81
82
624
            _last_value_size = cast_set<uint32_t>(src->size);
83
624
            _size_estimate += src->size;
84
624
            _size_estimate += sizeof(uint32_t);
85
624
            _raw_data_size += src->size;
86
87
624
            i++;
88
624
            vals += sizeof(Slice);
89
624
        }
90
91
88
        *count = i;
92
88
        return Status::OK();
93
88
    }
94
95
26.9k
    Status finish(OwnedSlice* slice) override {
96
26.9k
        DCHECK(!_finished);
97
26.9k
        _finished = true;
98
26.9k
        RETURN_IF_CATCH_EXCEPTION({
99
            // Set up trailer
100
26.9k
            for (uint32_t _offset : _offsets) {
101
26.9k
                put_fixed32_le(&_buffer, _offset);
102
26.9k
            }
103
26.9k
            put_fixed32_le(&_buffer, cast_set<uint32_t>(_offsets.size()));
104
26.9k
            *slice = _buffer.build();
105
26.9k
        });
106
26.9k
        return Status::OK();
107
26.9k
    }
_ZN5doris10segment_v222BinaryPlainPageBuilderILNS_9FieldTypeE13EE6finishEPNS_10OwnedSliceE
Line
Count
Source
95
19
    Status finish(OwnedSlice* slice) override {
96
19
        DCHECK(!_finished);
97
19
        _finished = true;
98
19
        RETURN_IF_CATCH_EXCEPTION({
99
            // Set up trailer
100
19
            for (uint32_t _offset : _offsets) {
101
19
                put_fixed32_le(&_buffer, _offset);
102
19
            }
103
19
            put_fixed32_le(&_buffer, cast_set<uint32_t>(_offsets.size()));
104
19
            *slice = _buffer.build();
105
19
        });
106
19
        return Status::OK();
107
19
    }
_ZN5doris10segment_v222BinaryPlainPageBuilderILNS_9FieldTypeE17EE6finishEPNS_10OwnedSliceE
Line
Count
Source
95
8.99k
    Status finish(OwnedSlice* slice) override {
96
8.99k
        DCHECK(!_finished);
97
8.99k
        _finished = true;
98
8.99k
        RETURN_IF_CATCH_EXCEPTION({
99
            // Set up trailer
100
8.99k
            for (uint32_t _offset : _offsets) {
101
8.99k
                put_fixed32_le(&_buffer, _offset);
102
8.99k
            }
103
8.99k
            put_fixed32_le(&_buffer, cast_set<uint32_t>(_offsets.size()));
104
8.99k
            *slice = _buffer.build();
105
8.99k
        });
106
8.99k
        return Status::OK();
107
8.99k
    }
_ZN5doris10segment_v222BinaryPlainPageBuilderILNS_9FieldTypeE26EE6finishEPNS_10OwnedSliceE
Line
Count
Source
95
97
    Status finish(OwnedSlice* slice) override {
96
97
        DCHECK(!_finished);
97
97
        _finished = true;
98
97
        RETURN_IF_CATCH_EXCEPTION({
99
            // Set up trailer
100
97
            for (uint32_t _offset : _offsets) {
101
97
                put_fixed32_le(&_buffer, _offset);
102
97
            }
103
97
            put_fixed32_le(&_buffer, cast_set<uint32_t>(_offsets.size()));
104
97
            *slice = _buffer.build();
105
97
        });
106
97
        return Status::OK();
107
97
    }
_ZN5doris10segment_v222BinaryPlainPageBuilderILNS_9FieldTypeE34EE6finishEPNS_10OwnedSliceE
Line
Count
Source
95
18
    Status finish(OwnedSlice* slice) override {
96
18
        DCHECK(!_finished);
97
18
        _finished = true;
98
18
        RETURN_IF_CATCH_EXCEPTION({
99
            // Set up trailer
100
18
            for (uint32_t _offset : _offsets) {
101
18
                put_fixed32_le(&_buffer, _offset);
102
18
            }
103
18
            put_fixed32_le(&_buffer, cast_set<uint32_t>(_offsets.size()));
104
18
            *slice = _buffer.build();
105
18
        });
106
18
        return Status::OK();
107
18
    }
Unexecuted instantiation: _ZN5doris10segment_v222BinaryPlainPageBuilderILNS_9FieldTypeE35EE6finishEPNS_10OwnedSliceE
_ZN5doris10segment_v222BinaryPlainPageBuilderILNS_9FieldTypeE23EE6finishEPNS_10OwnedSliceE
Line
Count
Source
95
28
    Status finish(OwnedSlice* slice) override {
96
28
        DCHECK(!_finished);
97
28
        _finished = true;
98
28
        RETURN_IF_CATCH_EXCEPTION({
99
            // Set up trailer
100
28
            for (uint32_t _offset : _offsets) {
101
28
                put_fixed32_le(&_buffer, _offset);
102
28
            }
103
28
            put_fixed32_le(&_buffer, cast_set<uint32_t>(_offsets.size()));
104
28
            *slice = _buffer.build();
105
28
        });
106
28
        return Status::OK();
107
28
    }
_ZN5doris10segment_v222BinaryPlainPageBuilderILNS_9FieldTypeE25EE6finishEPNS_10OwnedSliceE
Line
Count
Source
95
17.6k
    Status finish(OwnedSlice* slice) override {
96
17.6k
        DCHECK(!_finished);
97
17.6k
        _finished = true;
98
17.6k
        RETURN_IF_CATCH_EXCEPTION({
99
            // Set up trailer
100
17.6k
            for (uint32_t _offset : _offsets) {
101
17.6k
                put_fixed32_le(&_buffer, _offset);
102
17.6k
            }
103
17.6k
            put_fixed32_le(&_buffer, cast_set<uint32_t>(_offsets.size()));
104
17.6k
            *slice = _buffer.build();
105
17.6k
        });
106
17.6k
        return Status::OK();
107
17.6k
    }
_ZN5doris10segment_v222BinaryPlainPageBuilderILNS_9FieldTypeE27EE6finishEPNS_10OwnedSliceE
Line
Count
Source
95
28
    Status finish(OwnedSlice* slice) override {
96
28
        DCHECK(!_finished);
97
28
        _finished = true;
98
28
        RETURN_IF_CATCH_EXCEPTION({
99
            // Set up trailer
100
28
            for (uint32_t _offset : _offsets) {
101
28
                put_fixed32_le(&_buffer, _offset);
102
28
            }
103
28
            put_fixed32_le(&_buffer, cast_set<uint32_t>(_offsets.size()));
104
28
            *slice = _buffer.build();
105
28
        });
106
28
        return Status::OK();
107
28
    }
_ZN5doris10segment_v222BinaryPlainPageBuilderILNS_9FieldTypeE36EE6finishEPNS_10OwnedSliceE
Line
Count
Source
95
74
    Status finish(OwnedSlice* slice) override {
96
74
        DCHECK(!_finished);
97
74
        _finished = true;
98
74
        RETURN_IF_CATCH_EXCEPTION({
99
            // Set up trailer
100
74
            for (uint32_t _offset : _offsets) {
101
74
                put_fixed32_le(&_buffer, _offset);
102
74
            }
103
74
            put_fixed32_le(&_buffer, cast_set<uint32_t>(_offsets.size()));
104
74
            *slice = _buffer.build();
105
74
        });
106
74
        return Status::OK();
107
74
    }
108
109
46.9k
    Status reset() override {
110
46.9k
        RETURN_IF_CATCH_EXCEPTION({
111
46.9k
            _offsets.clear();
112
46.9k
            _buffer.clear();
113
46.9k
            _buffer.reserve(_options.data_page_size == 0
114
46.9k
                                    ? 1024
115
46.9k
                                    : std::min(_options.data_page_size, _options.dict_page_size));
116
46.9k
            _size_estimate = sizeof(uint32_t);
117
46.9k
            _finished = false;
118
46.9k
            _last_value_size = 0;
119
46.9k
            _raw_data_size = 0;
120
46.9k
        });
121
46.9k
        return Status::OK();
122
46.9k
    }
_ZN5doris10segment_v222BinaryPlainPageBuilderILNS_9FieldTypeE13EE5resetEv
Line
Count
Source
109
21
    Status reset() override {
110
21
        RETURN_IF_CATCH_EXCEPTION({
111
21
            _offsets.clear();
112
21
            _buffer.clear();
113
21
            _buffer.reserve(_options.data_page_size == 0
114
21
                                    ? 1024
115
21
                                    : std::min(_options.data_page_size, _options.dict_page_size));
116
21
            _size_estimate = sizeof(uint32_t);
117
21
            _finished = false;
118
21
            _last_value_size = 0;
119
21
            _raw_data_size = 0;
120
21
        });
121
21
        return Status::OK();
122
21
    }
_ZN5doris10segment_v222BinaryPlainPageBuilderILNS_9FieldTypeE17EE5resetEv
Line
Count
Source
109
11.1k
    Status reset() override {
110
11.1k
        RETURN_IF_CATCH_EXCEPTION({
111
11.1k
            _offsets.clear();
112
11.1k
            _buffer.clear();
113
11.1k
            _buffer.reserve(_options.data_page_size == 0
114
11.1k
                                    ? 1024
115
11.1k
                                    : std::min(_options.data_page_size, _options.dict_page_size));
116
11.1k
            _size_estimate = sizeof(uint32_t);
117
11.1k
            _finished = false;
118
11.1k
            _last_value_size = 0;
119
11.1k
            _raw_data_size = 0;
120
11.1k
        });
121
11.1k
        return Status::OK();
122
11.1k
    }
_ZN5doris10segment_v222BinaryPlainPageBuilderILNS_9FieldTypeE26EE5resetEv
Line
Count
Source
109
180
    Status reset() override {
110
180
        RETURN_IF_CATCH_EXCEPTION({
111
180
            _offsets.clear();
112
180
            _buffer.clear();
113
180
            _buffer.reserve(_options.data_page_size == 0
114
180
                                    ? 1024
115
180
                                    : std::min(_options.data_page_size, _options.dict_page_size));
116
180
            _size_estimate = sizeof(uint32_t);
117
180
            _finished = false;
118
180
            _last_value_size = 0;
119
180
            _raw_data_size = 0;
120
180
        });
121
180
        return Status::OK();
122
180
    }
_ZN5doris10segment_v222BinaryPlainPageBuilderILNS_9FieldTypeE34EE5resetEv
Line
Count
Source
109
20
    Status reset() override {
110
20
        RETURN_IF_CATCH_EXCEPTION({
111
20
            _offsets.clear();
112
20
            _buffer.clear();
113
20
            _buffer.reserve(_options.data_page_size == 0
114
20
                                    ? 1024
115
20
                                    : std::min(_options.data_page_size, _options.dict_page_size));
116
20
            _size_estimate = sizeof(uint32_t);
117
20
            _finished = false;
118
20
            _last_value_size = 0;
119
20
            _raw_data_size = 0;
120
20
        });
121
20
        return Status::OK();
122
20
    }
Unexecuted instantiation: _ZN5doris10segment_v222BinaryPlainPageBuilderILNS_9FieldTypeE35EE5resetEv
_ZN5doris10segment_v222BinaryPlainPageBuilderILNS_9FieldTypeE23EE5resetEv
Line
Count
Source
109
46
    Status reset() override {
110
46
        RETURN_IF_CATCH_EXCEPTION({
111
46
            _offsets.clear();
112
46
            _buffer.clear();
113
46
            _buffer.reserve(_options.data_page_size == 0
114
46
                                    ? 1024
115
46
                                    : std::min(_options.data_page_size, _options.dict_page_size));
116
46
            _size_estimate = sizeof(uint32_t);
117
46
            _finished = false;
118
46
            _last_value_size = 0;
119
46
            _raw_data_size = 0;
120
46
        });
121
46
        return Status::OK();
122
46
    }
_ZN5doris10segment_v222BinaryPlainPageBuilderILNS_9FieldTypeE25EE5resetEv
Line
Count
Source
109
35.3k
    Status reset() override {
110
35.3k
        RETURN_IF_CATCH_EXCEPTION({
111
35.3k
            _offsets.clear();
112
35.3k
            _buffer.clear();
113
35.3k
            _buffer.reserve(_options.data_page_size == 0
114
35.3k
                                    ? 1024
115
35.3k
                                    : std::min(_options.data_page_size, _options.dict_page_size));
116
35.3k
            _size_estimate = sizeof(uint32_t);
117
35.3k
            _finished = false;
118
35.3k
            _last_value_size = 0;
119
35.3k
            _raw_data_size = 0;
120
35.3k
        });
121
35.3k
        return Status::OK();
122
35.3k
    }
_ZN5doris10segment_v222BinaryPlainPageBuilderILNS_9FieldTypeE27EE5resetEv
Line
Count
Source
109
46
    Status reset() override {
110
46
        RETURN_IF_CATCH_EXCEPTION({
111
46
            _offsets.clear();
112
46
            _buffer.clear();
113
46
            _buffer.reserve(_options.data_page_size == 0
114
46
                                    ? 1024
115
46
                                    : std::min(_options.data_page_size, _options.dict_page_size));
116
46
            _size_estimate = sizeof(uint32_t);
117
46
            _finished = false;
118
46
            _last_value_size = 0;
119
46
            _raw_data_size = 0;
120
46
        });
121
46
        return Status::OK();
122
46
    }
_ZN5doris10segment_v222BinaryPlainPageBuilderILNS_9FieldTypeE36EE5resetEv
Line
Count
Source
109
128
    Status reset() override {
110
128
        RETURN_IF_CATCH_EXCEPTION({
111
128
            _offsets.clear();
112
128
            _buffer.clear();
113
128
            _buffer.reserve(_options.data_page_size == 0
114
128
                                    ? 1024
115
128
                                    : std::min(_options.data_page_size, _options.dict_page_size));
116
128
            _size_estimate = sizeof(uint32_t);
117
128
            _finished = false;
118
128
            _last_value_size = 0;
119
128
            _raw_data_size = 0;
120
128
        });
121
128
        return Status::OK();
122
128
    }
123
124
18.1k
    size_t count() const override { return _offsets.size(); }
Unexecuted instantiation: _ZNK5doris10segment_v222BinaryPlainPageBuilderILNS_9FieldTypeE13EE5countEv
_ZNK5doris10segment_v222BinaryPlainPageBuilderILNS_9FieldTypeE17EE5countEv
Line
Count
Source
124
527
    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
17.6k
    size_t count() const override { return _offsets.size(); }
Unexecuted instantiation: _ZNK5doris10segment_v222BinaryPlainPageBuilderILNS_9FieldTypeE27EE5countEv
Unexecuted instantiation: _ZNK5doris10segment_v222BinaryPlainPageBuilderILNS_9FieldTypeE36EE5countEv
125
126
1.72k
    uint64_t size() const override { return _size_estimate; }
Unexecuted instantiation: _ZNK5doris10segment_v222BinaryPlainPageBuilderILNS_9FieldTypeE13EE4sizeEv
_ZNK5doris10segment_v222BinaryPlainPageBuilderILNS_9FieldTypeE17EE4sizeEv
Line
Count
Source
126
1.56k
    uint64_t size() const override { return _size_estimate; }
_ZNK5doris10segment_v222BinaryPlainPageBuilderILNS_9FieldTypeE26EE4sizeEv
Line
Count
Source
126
71
    uint64_t size() const override { return _size_estimate; }
Unexecuted instantiation: _ZNK5doris10segment_v222BinaryPlainPageBuilderILNS_9FieldTypeE34EE4sizeEv
Unexecuted instantiation: _ZNK5doris10segment_v222BinaryPlainPageBuilderILNS_9FieldTypeE35EE4sizeEv
_ZNK5doris10segment_v222BinaryPlainPageBuilderILNS_9FieldTypeE23EE4sizeEv
Line
Count
Source
126
8
    uint64_t size() const override { return _size_estimate; }
_ZNK5doris10segment_v222BinaryPlainPageBuilderILNS_9FieldTypeE25EE4sizeEv
Line
Count
Source
126
53
    uint64_t size() const override { return _size_estimate; }
_ZNK5doris10segment_v222BinaryPlainPageBuilderILNS_9FieldTypeE27EE4sizeEv
Line
Count
Source
126
8
    uint64_t size() const override { return _size_estimate; }
_ZNK5doris10segment_v222BinaryPlainPageBuilderILNS_9FieldTypeE36EE4sizeEv
Line
Count
Source
126
24
    uint64_t size() const override { return _size_estimate; }
127
128
342
    uint64_t get_raw_data_size() const override { return _raw_data_size; }
_ZNK5doris10segment_v222BinaryPlainPageBuilderILNS_9FieldTypeE13EE17get_raw_data_sizeEv
Line
Count
Source
128
18
    uint64_t get_raw_data_size() const override { return _raw_data_size; }
_ZNK5doris10segment_v222BinaryPlainPageBuilderILNS_9FieldTypeE17EE17get_raw_data_sizeEv
Line
Count
Source
128
16
    uint64_t get_raw_data_size() const override { return _raw_data_size; }
_ZNK5doris10segment_v222BinaryPlainPageBuilderILNS_9FieldTypeE26EE17get_raw_data_sizeEv
Line
Count
Source
128
97
    uint64_t get_raw_data_size() const override { return _raw_data_size; }
_ZNK5doris10segment_v222BinaryPlainPageBuilderILNS_9FieldTypeE34EE17get_raw_data_sizeEv
Line
Count
Source
128
18
    uint64_t get_raw_data_size() const override { return _raw_data_size; }
Unexecuted instantiation: _ZNK5doris10segment_v222BinaryPlainPageBuilderILNS_9FieldTypeE35EE17get_raw_data_sizeEv
_ZNK5doris10segment_v222BinaryPlainPageBuilderILNS_9FieldTypeE23EE17get_raw_data_sizeEv
Line
Count
Source
128
28
    uint64_t get_raw_data_size() const override { return _raw_data_size; }
_ZNK5doris10segment_v222BinaryPlainPageBuilderILNS_9FieldTypeE25EE17get_raw_data_sizeEv
Line
Count
Source
128
63
    uint64_t get_raw_data_size() const override { return _raw_data_size; }
_ZNK5doris10segment_v222BinaryPlainPageBuilderILNS_9FieldTypeE27EE17get_raw_data_sizeEv
Line
Count
Source
128
28
    uint64_t get_raw_data_size() const override { return _raw_data_size; }
_ZNK5doris10segment_v222BinaryPlainPageBuilderILNS_9FieldTypeE36EE17get_raw_data_sizeEv
Line
Count
Source
128
74
    uint64_t get_raw_data_size() const override { return _raw_data_size; }
129
130
private:
131
    BinaryPlainPageBuilder(const PageBuilderOptions& options)
132
24.8k
            : _size_estimate(0), _options(options) {}
_ZN5doris10segment_v222BinaryPlainPageBuilderILNS_9FieldTypeE13EEC2ERKNS0_18PageBuilderOptionsE
Line
Count
Source
132
3
            : _size_estimate(0), _options(options) {}
_ZN5doris10segment_v222BinaryPlainPageBuilderILNS_9FieldTypeE17EEC2ERKNS0_18PageBuilderOptionsE
Line
Count
Source
132
6.98k
            : _size_estimate(0), _options(options) {}
_ZN5doris10segment_v222BinaryPlainPageBuilderILNS_9FieldTypeE26EEC2ERKNS0_18PageBuilderOptionsE
Line
Count
Source
132
83
            : _size_estimate(0), _options(options) {}
_ZN5doris10segment_v222BinaryPlainPageBuilderILNS_9FieldTypeE34EEC2ERKNS0_18PageBuilderOptionsE
Line
Count
Source
132
2
            : _size_estimate(0), _options(options) {}
Unexecuted instantiation: _ZN5doris10segment_v222BinaryPlainPageBuilderILNS_9FieldTypeE35EEC2ERKNS0_18PageBuilderOptionsE
_ZN5doris10segment_v222BinaryPlainPageBuilderILNS_9FieldTypeE23EEC2ERKNS0_18PageBuilderOptionsE
Line
Count
Source
132
18
            : _size_estimate(0), _options(options) {}
_ZN5doris10segment_v222BinaryPlainPageBuilderILNS_9FieldTypeE25EEC2ERKNS0_18PageBuilderOptionsE
Line
Count
Source
132
17.6k
            : _size_estimate(0), _options(options) {}
_ZN5doris10segment_v222BinaryPlainPageBuilderILNS_9FieldTypeE27EEC2ERKNS0_18PageBuilderOptionsE
Line
Count
Source
132
18
            : _size_estimate(0), _options(options) {}
_ZN5doris10segment_v222BinaryPlainPageBuilderILNS_9FieldTypeE36EEC2ERKNS0_18PageBuilderOptionsE
Line
Count
Source
132
54
            : _size_estimate(0), _options(options) {}
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
6.69k
            : _data(data),
152
6.69k
              _options(options),
153
6.69k
              _parsed(false),
154
6.69k
              _num_elems(0),
155
6.69k
              _offsets_pos(0),
156
6.69k
              _cur_idx(0) {}
_ZN5doris10segment_v222BinaryPlainPageDecoderILNS_9FieldTypeE17EEC2ENS_5SliceERKNS0_18PageDecoderOptionsE
Line
Count
Source
151
2.99k
            : _data(data),
152
2.99k
              _options(options),
153
2.99k
              _parsed(false),
154
2.99k
              _num_elems(0),
155
2.99k
              _offsets_pos(0),
156
2.99k
              _cur_idx(0) {}
_ZN5doris10segment_v222BinaryPlainPageDecoderILNS_9FieldTypeE26EEC2ENS_5SliceERKNS0_18PageDecoderOptionsE
Line
Count
Source
151
3.16k
            : _data(data),
152
3.16k
              _options(options),
153
3.16k
              _parsed(false),
154
3.16k
              _num_elems(0),
155
3.16k
              _offsets_pos(0),
156
3.16k
              _cur_idx(0) {}
_ZN5doris10segment_v222BinaryPlainPageDecoderILNS_9FieldTypeE13EEC2ENS_5SliceERKNS0_18PageDecoderOptionsE
Line
Count
Source
151
56
            : _data(data),
152
56
              _options(options),
153
56
              _parsed(false),
154
56
              _num_elems(0),
155
56
              _offsets_pos(0),
156
56
              _cur_idx(0) {}
_ZN5doris10segment_v222BinaryPlainPageDecoderILNS_9FieldTypeE36EEC2ENS_5SliceERKNS0_18PageDecoderOptionsE
Line
Count
Source
151
38
            : _data(data),
152
38
              _options(options),
153
38
              _parsed(false),
154
38
              _num_elems(0),
155
38
              _offsets_pos(0),
156
38
              _cur_idx(0) {}
_ZN5doris10segment_v222BinaryPlainPageDecoderILNS_9FieldTypeE34EEC2ENS_5SliceERKNS0_18PageDecoderOptionsE
Line
Count
Source
151
32
            : _data(data),
152
32
              _options(options),
153
32
              _parsed(false),
154
32
              _num_elems(0),
155
32
              _offsets_pos(0),
156
32
              _cur_idx(0) {}
_ZN5doris10segment_v222BinaryPlainPageDecoderILNS_9FieldTypeE35EEC2ENS_5SliceERKNS0_18PageDecoderOptionsE
Line
Count
Source
151
263
            : _data(data),
152
263
              _options(options),
153
263
              _parsed(false),
154
263
              _num_elems(0),
155
263
              _offsets_pos(0),
156
263
              _cur_idx(0) {}
_ZN5doris10segment_v222BinaryPlainPageDecoderILNS_9FieldTypeE23EEC2ENS_5SliceERKNS0_18PageDecoderOptionsE
Line
Count
Source
151
18
            : _data(data),
152
18
              _options(options),
153
18
              _parsed(false),
154
18
              _num_elems(0),
155
18
              _offsets_pos(0),
156
18
              _cur_idx(0) {}
_ZN5doris10segment_v222BinaryPlainPageDecoderILNS_9FieldTypeE25EEC2ENS_5SliceERKNS0_18PageDecoderOptionsE
Line
Count
Source
151
114
            : _data(data),
152
114
              _options(options),
153
114
              _parsed(false),
154
114
              _num_elems(0),
155
114
              _offsets_pos(0),
156
114
              _cur_idx(0) {}
_ZN5doris10segment_v222BinaryPlainPageDecoderILNS_9FieldTypeE27EEC2ENS_5SliceERKNS0_18PageDecoderOptionsE
Line
Count
Source
151
16
            : _data(data),
152
16
              _options(options),
153
16
              _parsed(false),
154
16
              _num_elems(0),
155
16
              _offsets_pos(0),
156
16
              _cur_idx(0) {}
157
158
6.69k
    Status init() override {
159
6.69k
        CHECK(!_parsed);
160
161
6.69k
        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
6.69k
        _num_elems = decode_fixed32_le((const uint8_t*)&_data[_data.get_size() - sizeof(uint32_t)]);
170
6.69k
        _offsets_pos = cast_set<uint32_t>(_data.get_size() - ((_num_elems + 1) * sizeof(uint32_t)));
171
172
6.69k
        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
6.69k
        _parsed = true;
179
180
6.69k
        return Status::OK();
181
6.69k
    }
_ZN5doris10segment_v222BinaryPlainPageDecoderILNS_9FieldTypeE17EE4initEv
Line
Count
Source
158
2.99k
    Status init() override {
159
2.99k
        CHECK(!_parsed);
160
161
2.99k
        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
2.99k
        _num_elems = decode_fixed32_le((const uint8_t*)&_data[_data.get_size() - sizeof(uint32_t)]);
170
2.99k
        _offsets_pos = cast_set<uint32_t>(_data.get_size() - ((_num_elems + 1) * sizeof(uint32_t)));
171
172
2.99k
        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
2.99k
        _parsed = true;
179
180
2.99k
        return Status::OK();
181
2.99k
    }
_ZN5doris10segment_v222BinaryPlainPageDecoderILNS_9FieldTypeE26EE4initEv
Line
Count
Source
158
3.16k
    Status init() override {
159
3.16k
        CHECK(!_parsed);
160
161
3.16k
        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
3.16k
        _num_elems = decode_fixed32_le((const uint8_t*)&_data[_data.get_size() - sizeof(uint32_t)]);
170
3.16k
        _offsets_pos = cast_set<uint32_t>(_data.get_size() - ((_num_elems + 1) * sizeof(uint32_t)));
171
172
3.16k
        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
3.16k
        _parsed = true;
179
180
3.16k
        return Status::OK();
181
3.16k
    }
_ZN5doris10segment_v222BinaryPlainPageDecoderILNS_9FieldTypeE13EE4initEv
Line
Count
Source
158
56
    Status init() override {
159
56
        CHECK(!_parsed);
160
161
56
        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
56
        _num_elems = decode_fixed32_le((const uint8_t*)&_data[_data.get_size() - sizeof(uint32_t)]);
170
56
        _offsets_pos = cast_set<uint32_t>(_data.get_size() - ((_num_elems + 1) * sizeof(uint32_t)));
171
172
56
        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
56
        _parsed = true;
179
180
56
        return Status::OK();
181
56
    }
_ZN5doris10segment_v222BinaryPlainPageDecoderILNS_9FieldTypeE36EE4initEv
Line
Count
Source
158
38
    Status init() override {
159
38
        CHECK(!_parsed);
160
161
38
        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
38
        _num_elems = decode_fixed32_le((const uint8_t*)&_data[_data.get_size() - sizeof(uint32_t)]);
170
38
        _offsets_pos = cast_set<uint32_t>(_data.get_size() - ((_num_elems + 1) * sizeof(uint32_t)));
171
172
38
        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
38
        _parsed = true;
179
180
38
        return Status::OK();
181
38
    }
_ZN5doris10segment_v222BinaryPlainPageDecoderILNS_9FieldTypeE34EE4initEv
Line
Count
Source
158
32
    Status init() override {
159
32
        CHECK(!_parsed);
160
161
32
        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
32
        _num_elems = decode_fixed32_le((const uint8_t*)&_data[_data.get_size() - sizeof(uint32_t)]);
170
32
        _offsets_pos = cast_set<uint32_t>(_data.get_size() - ((_num_elems + 1) * sizeof(uint32_t)));
171
172
32
        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
32
        _parsed = true;
179
180
32
        return Status::OK();
181
32
    }
_ZN5doris10segment_v222BinaryPlainPageDecoderILNS_9FieldTypeE35EE4initEv
Line
Count
Source
158
263
    Status init() override {
159
263
        CHECK(!_parsed);
160
161
263
        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
263
        _num_elems = decode_fixed32_le((const uint8_t*)&_data[_data.get_size() - sizeof(uint32_t)]);
170
263
        _offsets_pos = cast_set<uint32_t>(_data.get_size() - ((_num_elems + 1) * sizeof(uint32_t)));
171
172
263
        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
263
        _parsed = true;
179
180
263
        return Status::OK();
181
263
    }
_ZN5doris10segment_v222BinaryPlainPageDecoderILNS_9FieldTypeE23EE4initEv
Line
Count
Source
158
18
    Status init() override {
159
18
        CHECK(!_parsed);
160
161
18
        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
18
        _num_elems = decode_fixed32_le((const uint8_t*)&_data[_data.get_size() - sizeof(uint32_t)]);
170
18
        _offsets_pos = cast_set<uint32_t>(_data.get_size() - ((_num_elems + 1) * sizeof(uint32_t)));
171
172
18
        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
18
        _parsed = true;
179
180
18
        return Status::OK();
181
18
    }
_ZN5doris10segment_v222BinaryPlainPageDecoderILNS_9FieldTypeE25EE4initEv
Line
Count
Source
158
114
    Status init() override {
159
114
        CHECK(!_parsed);
160
161
114
        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
114
        _num_elems = decode_fixed32_le((const uint8_t*)&_data[_data.get_size() - sizeof(uint32_t)]);
170
114
        _offsets_pos = cast_set<uint32_t>(_data.get_size() - ((_num_elems + 1) * sizeof(uint32_t)));
171
172
114
        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
114
        _parsed = true;
179
180
114
        return Status::OK();
181
114
    }
_ZN5doris10segment_v222BinaryPlainPageDecoderILNS_9FieldTypeE27EE4initEv
Line
Count
Source
158
16
    Status init() override {
159
16
        CHECK(!_parsed);
160
161
16
        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
16
        _num_elems = decode_fixed32_le((const uint8_t*)&_data[_data.get_size() - sizeof(uint32_t)]);
170
16
        _offsets_pos = cast_set<uint32_t>(_data.get_size() - ((_num_elems + 1) * sizeof(uint32_t)));
171
172
16
        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
16
        _parsed = true;
179
180
16
        return Status::OK();
181
16
    }
182
183
581
    Status seek_to_position_in_page(size_t pos) override {
184
581
        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
581
        DCHECK_LE(pos, _num_elems);
191
581
        _cur_idx = pos;
192
581
        return Status::OK();
193
581
    }
_ZN5doris10segment_v222BinaryPlainPageDecoderILNS_9FieldTypeE17EE24seek_to_position_in_pageEm
Line
Count
Source
183
420
    Status seek_to_position_in_page(size_t pos) override {
184
420
        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
420
        DCHECK_LE(pos, _num_elems);
191
420
        _cur_idx = pos;
192
420
        return Status::OK();
193
420
    }
_ZN5doris10segment_v222BinaryPlainPageDecoderILNS_9FieldTypeE26EE24seek_to_position_in_pageEm
Line
Count
Source
183
14
    Status seek_to_position_in_page(size_t pos) override {
184
14
        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
14
        DCHECK_LE(pos, _num_elems);
191
14
        _cur_idx = pos;
192
14
        return Status::OK();
193
14
    }
_ZN5doris10segment_v222BinaryPlainPageDecoderILNS_9FieldTypeE13EE24seek_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_9FieldTypeE36EE24seek_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
143
    Status seek_to_position_in_page(size_t pos) override {
184
143
        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
143
        DCHECK_LE(pos, _num_elems);
191
143
        _cur_idx = pos;
192
143
        return Status::OK();
193
143
    }
Unexecuted instantiation: _ZN5doris10segment_v222BinaryPlainPageDecoderILNS_9FieldTypeE27EE24seek_to_position_in_pageEm
194
195
2.45k
    Status next_batch(size_t* n, MutableColumnPtr& dst) override {
196
2.45k
        DCHECK(_parsed);
197
2.45k
        if (*n == 0 || _cur_idx >= _num_elems) [[unlikely]] {
198
3
            *n = 0;
199
3
            return Status::OK();
200
3
        }
201
2.45k
        const size_t max_fetch = std::min(*n, static_cast<size_t>(_num_elems - _cur_idx));
202
203
2.45k
        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
2.45k
        uint32_t last_offset = guarded_offset(_cur_idx);
219
2.45k
        _offsets.resize(max_fetch + 1);
220
2.45k
        _offsets[0] = last_offset;
221
460k
        for (int i = 0; i < max_fetch - 1; i++, _cur_idx++) {
222
458k
            const uint32_t start_offset = last_offset;
223
458k
            last_offset = guarded_offset(_cur_idx + 1);
224
458k
            _offsets[i + 1] = last_offset;
225
458k
            if constexpr (Type == FieldType::OLAP_FIELD_TYPE_BITMAP) {
226
130
                if (_options.need_check_bitmap) {
227
130
                    RETURN_IF_ERROR(BitmapTypeCode::validate(*(_data.data + start_offset)));
228
130
                }
229
130
            }
230
458k
        }
231
2.45k
        _cur_idx++;
232
2.45k
        _offsets[max_fetch] = offset(_cur_idx);
233
2.45k
        if constexpr (Type == FieldType::OLAP_FIELD_TYPE_BITMAP) {
234
162
            if (_options.need_check_bitmap) {
235
19
                RETURN_IF_ERROR(BitmapTypeCode::validate(*(_data.data + last_offset)));
236
19
            }
237
162
        }
238
162
        dst->insert_many_continuous_binary_data(_data.data, _offsets.data(), max_fetch);
239
240
2.45k
        *n = max_fetch;
241
2.45k
        return Status::OK();
242
2.45k
    }
_ZN5doris10segment_v222BinaryPlainPageDecoderILNS_9FieldTypeE17EE10next_batchEPmRNS_3COWINS_7IColumnEE11mutable_ptrIS6_EE
Line
Count
Source
195
1.94k
    Status next_batch(size_t* n, MutableColumnPtr& dst) override {
196
1.94k
        DCHECK(_parsed);
197
1.94k
        if (*n == 0 || _cur_idx >= _num_elems) [[unlikely]] {
198
2
            *n = 0;
199
2
            return Status::OK();
200
2
        }
201
1.94k
        const size_t max_fetch = std::min(*n, static_cast<size_t>(_num_elems - _cur_idx));
202
203
1.94k
        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.94k
        uint32_t last_offset = guarded_offset(_cur_idx);
219
1.94k
        _offsets.resize(max_fetch + 1);
220
1.94k
        _offsets[0] = last_offset;
221
457k
        for (int i = 0; i < max_fetch - 1; i++, _cur_idx++) {
222
455k
            const uint32_t start_offset = last_offset;
223
455k
            last_offset = guarded_offset(_cur_idx + 1);
224
455k
            _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
455k
        }
231
1.94k
        _cur_idx++;
232
1.94k
        _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.94k
        dst->insert_many_continuous_binary_data(_data.data, _offsets.data(), max_fetch);
239
240
1.94k
        *n = max_fetch;
241
1.94k
        return Status::OK();
242
1.94k
    }
_ZN5doris10segment_v222BinaryPlainPageDecoderILNS_9FieldTypeE26EE10next_batchEPmRNS_3COWINS_7IColumnEE11mutable_ptrIS6_EE
Line
Count
Source
195
103
    Status next_batch(size_t* n, MutableColumnPtr& dst) override {
196
103
        DCHECK(_parsed);
197
103
        if (*n == 0 || _cur_idx >= _num_elems) [[unlikely]] {
198
1
            *n = 0;
199
1
            return Status::OK();
200
1
        }
201
102
        const size_t max_fetch = std::min(*n, static_cast<size_t>(_num_elems - _cur_idx));
202
203
102
        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
102
        uint32_t last_offset = guarded_offset(_cur_idx);
219
102
        _offsets.resize(max_fetch + 1);
220
102
        _offsets[0] = last_offset;
221
715
        for (int i = 0; i < max_fetch - 1; i++, _cur_idx++) {
222
613
            const uint32_t start_offset = last_offset;
223
613
            last_offset = guarded_offset(_cur_idx + 1);
224
613
            _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
613
        }
231
102
        _cur_idx++;
232
102
        _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
102
        dst->insert_many_continuous_binary_data(_data.data, _offsets.data(), max_fetch);
239
240
102
        *n = max_fetch;
241
102
        return Status::OK();
242
102
    }
_ZN5doris10segment_v222BinaryPlainPageDecoderILNS_9FieldTypeE13EE10next_batchEPmRNS_3COWINS_7IColumnEE11mutable_ptrIS6_EE
Line
Count
Source
195
93
    Status next_batch(size_t* n, MutableColumnPtr& dst) override {
196
93
        DCHECK(_parsed);
197
93
        if (*n == 0 || _cur_idx >= _num_elems) [[unlikely]] {
198
0
            *n = 0;
199
0
            return Status::OK();
200
0
        }
201
93
        const size_t max_fetch = std::min(*n, static_cast<size_t>(_num_elems - _cur_idx));
202
203
93
        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
93
        uint32_t last_offset = guarded_offset(_cur_idx);
219
93
        _offsets.resize(max_fetch + 1);
220
93
        _offsets[0] = last_offset;
221
681
        for (int i = 0; i < max_fetch - 1; i++, _cur_idx++) {
222
588
            const uint32_t start_offset = last_offset;
223
588
            last_offset = guarded_offset(_cur_idx + 1);
224
588
            _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
588
        }
231
93
        _cur_idx++;
232
93
        _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
93
        dst->insert_many_continuous_binary_data(_data.data, _offsets.data(), max_fetch);
239
240
93
        *n = max_fetch;
241
93
        return Status::OK();
242
93
    }
_ZN5doris10segment_v222BinaryPlainPageDecoderILNS_9FieldTypeE36EE10next_batchEPmRNS_3COWINS_7IColumnEE11mutable_ptrIS6_EE
Line
Count
Source
195
38
    Status next_batch(size_t* n, MutableColumnPtr& dst) override {
196
38
        DCHECK(_parsed);
197
38
        if (*n == 0 || _cur_idx >= _num_elems) [[unlikely]] {
198
0
            *n = 0;
199
0
            return Status::OK();
200
0
        }
201
38
        const size_t max_fetch = std::min(*n, static_cast<size_t>(_num_elems - _cur_idx));
202
203
38
        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
38
        uint32_t last_offset = guarded_offset(_cur_idx);
219
38
        _offsets.resize(max_fetch + 1);
220
38
        _offsets[0] = last_offset;
221
724
        for (int i = 0; i < max_fetch - 1; i++, _cur_idx++) {
222
686
            const uint32_t start_offset = last_offset;
223
686
            last_offset = guarded_offset(_cur_idx + 1);
224
686
            _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
686
        }
231
38
        _cur_idx++;
232
38
        _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
38
        dst->insert_many_continuous_binary_data(_data.data, _offsets.data(), max_fetch);
239
240
38
        *n = max_fetch;
241
38
        return Status::OK();
242
38
    }
_ZN5doris10segment_v222BinaryPlainPageDecoderILNS_9FieldTypeE34EE10next_batchEPmRNS_3COWINS_7IColumnEE11mutable_ptrIS6_EE
Line
Count
Source
195
82
    Status next_batch(size_t* n, MutableColumnPtr& dst) override {
196
82
        DCHECK(_parsed);
197
82
        if (*n == 0 || _cur_idx >= _num_elems) [[unlikely]] {
198
0
            *n = 0;
199
0
            return Status::OK();
200
0
        }
201
82
        const size_t max_fetch = std::min(*n, static_cast<size_t>(_num_elems - _cur_idx));
202
203
82
        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
82
        uint32_t last_offset = guarded_offset(_cur_idx);
219
82
        _offsets.resize(max_fetch + 1);
220
82
        _offsets[0] = last_offset;
221
645
        for (int i = 0; i < max_fetch - 1; i++, _cur_idx++) {
222
563
            const uint32_t start_offset = last_offset;
223
563
            last_offset = guarded_offset(_cur_idx + 1);
224
563
            _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
563
        }
231
82
        _cur_idx++;
232
82
        _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
82
        dst->insert_many_continuous_binary_data(_data.data, _offsets.data(), max_fetch);
239
240
82
        *n = max_fetch;
241
82
        return Status::OK();
242
82
    }
Unexecuted instantiation: _ZN5doris10segment_v222BinaryPlainPageDecoderILNS_9FieldTypeE35EE10next_batchEPmRNS_3COWINS_7IColumnEE11mutable_ptrIS6_EE
_ZN5doris10segment_v222BinaryPlainPageDecoderILNS_9FieldTypeE23EE10next_batchEPmRNS_3COWINS_7IColumnEE11mutable_ptrIS6_EE
Line
Count
Source
195
18
    Status next_batch(size_t* n, MutableColumnPtr& dst) override {
196
18
        DCHECK(_parsed);
197
18
        if (*n == 0 || _cur_idx >= _num_elems) [[unlikely]] {
198
0
            *n = 0;
199
0
            return Status::OK();
200
0
        }
201
18
        const size_t max_fetch = std::min(*n, static_cast<size_t>(_num_elems - _cur_idx));
202
203
18
        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
18
        uint32_t last_offset = guarded_offset(_cur_idx);
219
18
        _offsets.resize(max_fetch + 1);
220
18
        _offsets[0] = last_offset;
221
120
        for (int i = 0; i < max_fetch - 1; i++, _cur_idx++) {
222
102
            const uint32_t start_offset = last_offset;
223
102
            last_offset = guarded_offset(_cur_idx + 1);
224
102
            _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
102
        }
231
18
        _cur_idx++;
232
18
        _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
18
        dst->insert_many_continuous_binary_data(_data.data, _offsets.data(), max_fetch);
239
240
18
        *n = max_fetch;
241
18
        return Status::OK();
242
18
    }
_ZN5doris10segment_v222BinaryPlainPageDecoderILNS_9FieldTypeE25EE10next_batchEPmRNS_3COWINS_7IColumnEE11mutable_ptrIS6_EE
Line
Count
Source
195
162
    Status next_batch(size_t* n, MutableColumnPtr& dst) override {
196
162
        DCHECK(_parsed);
197
162
        if (*n == 0 || _cur_idx >= _num_elems) [[unlikely]] {
198
0
            *n = 0;
199
0
            return Status::OK();
200
0
        }
201
162
        const size_t max_fetch = std::min(*n, static_cast<size_t>(_num_elems - _cur_idx));
202
203
162
        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
162
        uint32_t last_offset = guarded_offset(_cur_idx);
219
162
        _offsets.resize(max_fetch + 1);
220
162
        _offsets[0] = last_offset;
221
292
        for (int i = 0; i < max_fetch - 1; i++, _cur_idx++) {
222
130
            const uint32_t start_offset = last_offset;
223
130
            last_offset = guarded_offset(_cur_idx + 1);
224
130
            _offsets[i + 1] = last_offset;
225
130
            if constexpr (Type == FieldType::OLAP_FIELD_TYPE_BITMAP) {
226
130
                if (_options.need_check_bitmap) {
227
130
                    RETURN_IF_ERROR(BitmapTypeCode::validate(*(_data.data + start_offset)));
228
130
                }
229
130
            }
230
130
        }
231
162
        _cur_idx++;
232
162
        _offsets[max_fetch] = offset(_cur_idx);
233
162
        if constexpr (Type == FieldType::OLAP_FIELD_TYPE_BITMAP) {
234
162
            if (_options.need_check_bitmap) {
235
19
                RETURN_IF_ERROR(BitmapTypeCode::validate(*(_data.data + last_offset)));
236
19
            }
237
162
        }
238
162
        dst->insert_many_continuous_binary_data(_data.data, _offsets.data(), max_fetch);
239
240
162
        *n = max_fetch;
241
162
        return Status::OK();
242
162
    }
_ZN5doris10segment_v222BinaryPlainPageDecoderILNS_9FieldTypeE27EE10next_batchEPmRNS_3COWINS_7IColumnEE11mutable_ptrIS6_EE
Line
Count
Source
195
16
    Status next_batch(size_t* n, MutableColumnPtr& dst) override {
196
16
        DCHECK(_parsed);
197
16
        if (*n == 0 || _cur_idx >= _num_elems) [[unlikely]] {
198
0
            *n = 0;
199
0
            return Status::OK();
200
0
        }
201
16
        const size_t max_fetch = std::min(*n, static_cast<size_t>(_num_elems - _cur_idx));
202
203
16
        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
16
        uint32_t last_offset = guarded_offset(_cur_idx);
219
16
        _offsets.resize(max_fetch + 1);
220
16
        _offsets[0] = last_offset;
221
360
        for (int i = 0; i < max_fetch - 1; i++, _cur_idx++) {
222
344
            const uint32_t start_offset = last_offset;
223
344
            last_offset = guarded_offset(_cur_idx + 1);
224
344
            _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
344
        }
231
16
        _cur_idx++;
232
16
        _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
16
        dst->insert_many_continuous_binary_data(_data.data, _offsets.data(), max_fetch);
239
240
16
        *n = max_fetch;
241
16
        return Status::OK();
242
16
    }
243
244
    Status read_by_rowids(const rowid_t* rowids, ordinal_t page_first_ordinal, size_t* n,
245
586
                          MutableColumnPtr& dst) override {
246
586
        DCHECK(_parsed);
247
586
        if (*n == 0) [[unlikely]] {
248
0
            *n = 0;
249
0
            return Status::OK();
250
0
        }
251
252
586
        auto total = *n;
253
254
586
        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
586
        size_t read_count = 0;
277
586
        _binary_data.resize(total);
278
2.58k
        for (size_t i = 0; i < total; ++i) {
279
1.99k
            ordinal_t ord = rowids[i] - page_first_ordinal;
280
1.99k
            if (UNLIKELY(ord >= _num_elems)) {
281
0
                break;
282
0
            }
283
284
1.99k
            const uint32_t start_offset = offset(ord);
285
1.99k
            _binary_data[read_count].data = _data.mutable_data() + start_offset;
286
1.99k
            _binary_data[read_count].size = offset(ord + 1) - start_offset;
287
1.99k
            read_count++;
288
1.99k
        }
289
290
586
        if (LIKELY(read_count > 0)) {
291
586
            dst->insert_many_strings(_binary_data.data(), read_count);
292
586
        }
293
294
586
        *n = read_count;
295
586
        return Status::OK();
296
586
    }
_ZN5doris10segment_v222BinaryPlainPageDecoderILNS_9FieldTypeE17EE14read_by_rowidsEPKjmPmRNS_3COWINS_7IColumnEE11mutable_ptrIS8_EE
Line
Count
Source
245
556
                          MutableColumnPtr& dst) override {
246
556
        DCHECK(_parsed);
247
556
        if (*n == 0) [[unlikely]] {
248
0
            *n = 0;
249
0
            return Status::OK();
250
0
        }
251
252
556
        auto total = *n;
253
254
556
        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
556
        size_t read_count = 0;
277
556
        _binary_data.resize(total);
278
2.50k
        for (size_t i = 0; i < total; ++i) {
279
1.95k
            ordinal_t ord = rowids[i] - page_first_ordinal;
280
1.95k
            if (UNLIKELY(ord >= _num_elems)) {
281
0
                break;
282
0
            }
283
284
1.95k
            const uint32_t start_offset = offset(ord);
285
1.95k
            _binary_data[read_count].data = _data.mutable_data() + start_offset;
286
1.95k
            _binary_data[read_count].size = offset(ord + 1) - start_offset;
287
1.95k
            read_count++;
288
1.95k
        }
289
290
556
        if (LIKELY(read_count > 0)) {
291
556
            dst->insert_many_strings(_binary_data.data(), read_count);
292
556
        }
293
294
556
        *n = read_count;
295
556
        return Status::OK();
296
556
    }
_ZN5doris10segment_v222BinaryPlainPageDecoderILNS_9FieldTypeE26EE14read_by_rowidsEPKjmPmRNS_3COWINS_7IColumnEE11mutable_ptrIS8_EE
Line
Count
Source
245
25
                          MutableColumnPtr& dst) override {
246
25
        DCHECK(_parsed);
247
25
        if (*n == 0) [[unlikely]] {
248
0
            *n = 0;
249
0
            return Status::OK();
250
0
        }
251
252
25
        auto total = *n;
253
254
25
        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
25
        size_t read_count = 0;
277
25
        _binary_data.resize(total);
278
61
        for (size_t i = 0; i < total; ++i) {
279
36
            ordinal_t ord = rowids[i] - page_first_ordinal;
280
36
            if (UNLIKELY(ord >= _num_elems)) {
281
0
                break;
282
0
            }
283
284
36
            const uint32_t start_offset = offset(ord);
285
36
            _binary_data[read_count].data = _data.mutable_data() + start_offset;
286
36
            _binary_data[read_count].size = offset(ord + 1) - start_offset;
287
36
            read_count++;
288
36
        }
289
290
25
        if (LIKELY(read_count > 0)) {
291
25
            dst->insert_many_strings(_binary_data.data(), read_count);
292
25
        }
293
294
25
        *n = read_count;
295
25
        return Status::OK();
296
25
    }
_ZN5doris10segment_v222BinaryPlainPageDecoderILNS_9FieldTypeE13EE14read_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_9FieldTypeE36EE14read_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
_ZN5doris10segment_v222BinaryPlainPageDecoderILNS_9FieldTypeE25EE14read_by_rowidsEPKjmPmRNS_3COWINS_7IColumnEE11mutable_ptrIS8_EE
Line
Count
Source
245
4
                          MutableColumnPtr& dst) override {
246
4
        DCHECK(_parsed);
247
4
        if (*n == 0) [[unlikely]] {
248
0
            *n = 0;
249
0
            return Status::OK();
250
0
        }
251
252
4
        auto total = *n;
253
254
4
        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
4
        size_t read_count = 0;
277
4
        _binary_data.resize(total);
278
8
        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
4
        if (LIKELY(read_count > 0)) {
291
4
            dst->insert_many_strings(_binary_data.data(), read_count);
292
4
        }
293
294
4
        *n = read_count;
295
4
        return Status::OK();
296
4
    }
Unexecuted instantiation: _ZN5doris10segment_v222BinaryPlainPageDecoderILNS_9FieldTypeE27EE14read_by_rowidsEPKjmPmRNS_3COWINS_7IColumnEE11mutable_ptrIS8_EE
297
298
8.16k
    size_t count() const override {
299
8.16k
        DCHECK(_parsed);
300
8.16k
        return _num_elems;
301
8.16k
    }
_ZNK5doris10segment_v222BinaryPlainPageDecoderILNS_9FieldTypeE17EE5countEv
Line
Count
Source
298
1.31k
    size_t count() const override {
299
        DCHECK(_parsed);
300
1.31k
        return _num_elems;
301
1.31k
    }
_ZNK5doris10segment_v222BinaryPlainPageDecoderILNS_9FieldTypeE26EE5countEv
Line
Count
Source
298
6.23k
    size_t count() const override {
299
        DCHECK(_parsed);
300
6.23k
        return _num_elems;
301
6.23k
    }
_ZNK5doris10segment_v222BinaryPlainPageDecoderILNS_9FieldTypeE13EE5countEv
Line
Count
Source
298
53
    size_t count() const override {
299
        DCHECK(_parsed);
300
53
        return _num_elems;
301
53
    }
_ZNK5doris10segment_v222BinaryPlainPageDecoderILNS_9FieldTypeE36EE5countEv
Line
Count
Source
298
1
    size_t count() const override {
299
        DCHECK(_parsed);
300
1
        return _num_elems;
301
1
    }
_ZNK5doris10segment_v222BinaryPlainPageDecoderILNS_9FieldTypeE34EE5countEv
Line
Count
Source
298
16
    size_t count() const override {
299
        DCHECK(_parsed);
300
16
        return _num_elems;
301
16
    }
_ZNK5doris10segment_v222BinaryPlainPageDecoderILNS_9FieldTypeE35EE5countEv
Line
Count
Source
298
538
    size_t count() const override {
299
        DCHECK(_parsed);
300
538
        return _num_elems;
301
538
    }
Unexecuted instantiation: _ZNK5doris10segment_v222BinaryPlainPageDecoderILNS_9FieldTypeE23EE5countEv
Unexecuted instantiation: _ZNK5doris10segment_v222BinaryPlainPageDecoderILNS_9FieldTypeE25EE5countEv
Unexecuted instantiation: _ZNK5doris10segment_v222BinaryPlainPageDecoderILNS_9FieldTypeE27EE5countEv
302
303
424
    size_t current_index() const override {
304
424
        DCHECK(_parsed);
305
424
        return _cur_idx;
306
424
    }
_ZNK5doris10segment_v222BinaryPlainPageDecoderILNS_9FieldTypeE17EE13current_indexEv
Line
Count
Source
303
273
    size_t current_index() const override {
304
        DCHECK(_parsed);
305
273
        return _cur_idx;
306
273
    }
_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
    }
_ZNK5doris10segment_v222BinaryPlainPageDecoderILNS_9FieldTypeE13EE13current_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_9FieldTypeE36EE13current_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
143
    size_t current_index() const override {
304
        DCHECK(_parsed);
305
143
        return _cur_idx;
306
143
    }
Unexecuted instantiation: _ZNK5doris10segment_v222BinaryPlainPageDecoderILNS_9FieldTypeE27EE13current_indexEv
307
308
4.03k
    Status get_dict_word_info(StringRef* dict_word_info) override {
309
4.03k
        if (UNLIKELY(_num_elems <= 0)) {
310
3
            return Status::OK();
311
3
        }
312
313
4.03k
        char* data_begin = (char*)&_data[0];
314
4.03k
        char* offset_ptr = (char*)&_data[_offsets_pos];
315
316
85.2k
        for (uint32_t i = 0; i < _num_elems; ++i) {
317
81.1k
            uint32_t offset = decode_fixed32_le((uint8_t*)offset_ptr);
318
81.1k
            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
81.1k
            dict_word_info[i].data = data_begin + offset;
325
81.1k
            offset_ptr += sizeof(uint32_t);
326
81.1k
        }
327
328
81.1k
        for (int i = 0; i < (int)_num_elems - 1; ++i) {
329
77.1k
            dict_word_info[i].size =
330
77.1k
                    (char*)dict_word_info[i + 1].data - (char*)dict_word_info[i].data;
331
77.1k
        }
332
333
4.03k
        dict_word_info[_num_elems - 1].size =
334
4.03k
                (data_begin + _offsets_pos) - (char*)dict_word_info[_num_elems - 1].data;
335
4.03k
        return Status::OK();
336
4.03k
    }
_ZN5doris10segment_v222BinaryPlainPageDecoderILNS_9FieldTypeE17EE18get_dict_word_infoEPNS_9StringRefE
Line
Count
Source
308
644
    Status get_dict_word_info(StringRef* dict_word_info) override {
309
644
        if (UNLIKELY(_num_elems <= 0)) {
310
0
            return Status::OK();
311
0
        }
312
313
644
        char* data_begin = (char*)&_data[0];
314
644
        char* offset_ptr = (char*)&_data[_offsets_pos];
315
316
4.64k
        for (uint32_t i = 0; i < _num_elems; ++i) {
317
4.00k
            uint32_t offset = decode_fixed32_le((uint8_t*)offset_ptr);
318
4.00k
            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
4.00k
            dict_word_info[i].data = data_begin + offset;
325
4.00k
            offset_ptr += sizeof(uint32_t);
326
4.00k
        }
327
328
4.00k
        for (int i = 0; i < (int)_num_elems - 1; ++i) {
329
3.36k
            dict_word_info[i].size =
330
3.36k
                    (char*)dict_word_info[i + 1].data - (char*)dict_word_info[i].data;
331
3.36k
        }
332
333
644
        dict_word_info[_num_elems - 1].size =
334
644
                (data_begin + _offsets_pos) - (char*)dict_word_info[_num_elems - 1].data;
335
644
        return Status::OK();
336
644
    }
_ZN5doris10segment_v222BinaryPlainPageDecoderILNS_9FieldTypeE26EE18get_dict_word_infoEPNS_9StringRefE
Line
Count
Source
308
3.09k
    Status get_dict_word_info(StringRef* dict_word_info) override {
309
3.09k
        if (UNLIKELY(_num_elems <= 0)) {
310
2
            return Status::OK();
311
2
        }
312
313
3.09k
        char* data_begin = (char*)&_data[0];
314
3.09k
        char* offset_ptr = (char*)&_data[_offsets_pos];
315
316
77.8k
        for (uint32_t i = 0; i < _num_elems; ++i) {
317
74.7k
            uint32_t offset = decode_fixed32_le((uint8_t*)offset_ptr);
318
74.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
74.7k
            dict_word_info[i].data = data_begin + offset;
325
74.7k
            offset_ptr += sizeof(uint32_t);
326
74.7k
        }
327
328
74.7k
        for (int i = 0; i < (int)_num_elems - 1; ++i) {
329
71.6k
            dict_word_info[i].size =
330
71.6k
                    (char*)dict_word_info[i + 1].data - (char*)dict_word_info[i].data;
331
71.6k
        }
332
333
3.09k
        dict_word_info[_num_elems - 1].size =
334
3.09k
                (data_begin + _offsets_pos) - (char*)dict_word_info[_num_elems - 1].data;
335
3.09k
        return Status::OK();
336
3.09k
    }
_ZN5doris10segment_v222BinaryPlainPageDecoderILNS_9FieldTypeE13EE18get_dict_word_infoEPNS_9StringRefE
Line
Count
Source
308
22
    Status get_dict_word_info(StringRef* dict_word_info) override {
309
22
        if (UNLIKELY(_num_elems <= 0)) {
310
0
            return Status::OK();
311
0
        }
312
313
22
        char* data_begin = (char*)&_data[0];
314
22
        char* offset_ptr = (char*)&_data[_offsets_pos];
315
316
138
        for (uint32_t i = 0; i < _num_elems; ++i) {
317
116
            uint32_t offset = decode_fixed32_le((uint8_t*)offset_ptr);
318
116
            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
116
            dict_word_info[i].data = data_begin + offset;
325
116
            offset_ptr += sizeof(uint32_t);
326
116
        }
327
328
116
        for (int i = 0; i < (int)_num_elems - 1; ++i) {
329
94
            dict_word_info[i].size =
330
94
                    (char*)dict_word_info[i + 1].data - (char*)dict_word_info[i].data;
331
94
        }
332
333
22
        dict_word_info[_num_elems - 1].size =
334
22
                (data_begin + _offsets_pos) - (char*)dict_word_info[_num_elems - 1].data;
335
22
        return Status::OK();
336
22
    }
Unexecuted instantiation: _ZN5doris10segment_v222BinaryPlainPageDecoderILNS_9FieldTypeE36EE18get_dict_word_infoEPNS_9StringRefE
_ZN5doris10segment_v222BinaryPlainPageDecoderILNS_9FieldTypeE34EE18get_dict_word_infoEPNS_9StringRefE
Line
Count
Source
308
7
    Status get_dict_word_info(StringRef* dict_word_info) override {
309
7
        if (UNLIKELY(_num_elems <= 0)) {
310
0
            return Status::OK();
311
0
        }
312
313
7
        char* data_begin = (char*)&_data[0];
314
7
        char* offset_ptr = (char*)&_data[_offsets_pos];
315
316
2.05k
        for (uint32_t i = 0; i < _num_elems; ++i) {
317
2.05k
            uint32_t offset = decode_fixed32_le((uint8_t*)offset_ptr);
318
2.05k
            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
2.05k
            dict_word_info[i].data = data_begin + offset;
325
2.05k
            offset_ptr += sizeof(uint32_t);
326
2.05k
        }
327
328
2.05k
        for (int i = 0; i < (int)_num_elems - 1; ++i) {
329
2.04k
            dict_word_info[i].size =
330
2.04k
                    (char*)dict_word_info[i + 1].data - (char*)dict_word_info[i].data;
331
2.04k
        }
332
333
7
        dict_word_info[_num_elems - 1].size =
334
7
                (data_begin + _offsets_pos) - (char*)dict_word_info[_num_elems - 1].data;
335
7
        return Status::OK();
336
7
    }
_ZN5doris10segment_v222BinaryPlainPageDecoderILNS_9FieldTypeE35EE18get_dict_word_infoEPNS_9StringRefE
Line
Count
Source
308
263
    Status get_dict_word_info(StringRef* dict_word_info) override {
309
263
        if (UNLIKELY(_num_elems <= 0)) {
310
1
            return Status::OK();
311
1
        }
312
313
262
        char* data_begin = (char*)&_data[0];
314
262
        char* offset_ptr = (char*)&_data[_offsets_pos];
315
316
550
        for (uint32_t i = 0; i < _num_elems; ++i) {
317
288
            uint32_t offset = decode_fixed32_le((uint8_t*)offset_ptr);
318
288
            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
288
            dict_word_info[i].data = data_begin + offset;
325
288
            offset_ptr += sizeof(uint32_t);
326
288
        }
327
328
288
        for (int i = 0; i < (int)_num_elems - 1; ++i) {
329
26
            dict_word_info[i].size =
330
26
                    (char*)dict_word_info[i + 1].data - (char*)dict_word_info[i].data;
331
26
        }
332
333
262
        dict_word_info[_num_elems - 1].size =
334
262
                (data_begin + _offsets_pos) - (char*)dict_word_info[_num_elems - 1].data;
335
262
        return Status::OK();
336
262
    }
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
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
6.44k
    uint32_t offset(size_t idx) const {
342
6.44k
        if (idx >= _num_elems) {
343
2.62k
            return _offsets_pos;
344
2.62k
        }
345
3.82k
        return guarded_offset(idx);
346
6.44k
    }
_ZNK5doris10segment_v222BinaryPlainPageDecoderILNS_9FieldTypeE17EE6offsetEm
Line
Count
Source
341
5.84k
    uint32_t offset(size_t idx) const {
342
5.84k
        if (idx >= _num_elems) {
343
2.31k
            return _offsets_pos;
344
2.31k
        }
345
3.53k
        return guarded_offset(idx);
346
5.84k
    }
_ZNK5doris10segment_v222BinaryPlainPageDecoderILNS_9FieldTypeE26EE6offsetEm
Line
Count
Source
341
174
    uint32_t offset(size_t idx) const {
342
174
        if (idx >= _num_elems) {
343
61
            return _offsets_pos;
344
61
        }
345
113
        return guarded_offset(idx);
346
174
    }
_ZNK5doris10segment_v222BinaryPlainPageDecoderILNS_9FieldTypeE13EE6offsetEm
Line
Count
Source
341
101
    uint32_t offset(size_t idx) const {
342
101
        if (idx >= _num_elems) {
343
34
            return _offsets_pos;
344
34
        }
345
67
        return guarded_offset(idx);
346
101
    }
_ZNK5doris10segment_v222BinaryPlainPageDecoderILNS_9FieldTypeE36EE6offsetEm
Line
Count
Source
341
38
    uint32_t offset(size_t idx) const {
342
38
        if (idx >= _num_elems) {
343
38
            return _offsets_pos;
344
38
        }
345
0
        return guarded_offset(idx);
346
38
    }
_ZNK5doris10segment_v222BinaryPlainPageDecoderILNS_9FieldTypeE34EE6offsetEm
Line
Count
Source
341
82
    uint32_t offset(size_t idx) const {
342
82
        if (idx >= _num_elems) {
343
25
            return _offsets_pos;
344
25
        }
345
57
        return guarded_offset(idx);
346
82
    }
Unexecuted instantiation: _ZNK5doris10segment_v222BinaryPlainPageDecoderILNS_9FieldTypeE35EE6offsetEm
_ZNK5doris10segment_v222BinaryPlainPageDecoderILNS_9FieldTypeE23EE6offsetEm
Line
Count
Source
341
18
    uint32_t offset(size_t idx) const {
342
18
        if (idx >= _num_elems) {
343
18
            return _offsets_pos;
344
18
        }
345
0
        return guarded_offset(idx);
346
18
    }
_ZNK5doris10segment_v222BinaryPlainPageDecoderILNS_9FieldTypeE25EE6offsetEm
Line
Count
Source
341
170
    uint32_t offset(size_t idx) const {
342
170
        if (idx >= _num_elems) {
343
114
            return _offsets_pos;
344
114
        }
345
56
        return guarded_offset(idx);
346
170
    }
_ZNK5doris10segment_v222BinaryPlainPageDecoderILNS_9FieldTypeE27EE6offsetEm
Line
Count
Source
341
16
    uint32_t offset(size_t idx) const {
342
16
        if (idx >= _num_elems) {
343
16
            return _offsets_pos;
344
16
        }
345
0
        return guarded_offset(idx);
346
16
    }
347
348
464k
    uint32_t guarded_offset(size_t idx) const {
349
464k
        const auto* p =
350
464k
                reinterpret_cast<const uint8_t*>(&_data[_offsets_pos + idx * SIZE_OF_INT32]);
351
464k
        return decode_fixed32_le(p);
352
464k
    }
_ZNK5doris10segment_v222BinaryPlainPageDecoderILNS_9FieldTypeE17EE14guarded_offsetEm
Line
Count
Source
348
460k
    uint32_t guarded_offset(size_t idx) const {
349
460k
        const auto* p =
350
460k
                reinterpret_cast<const uint8_t*>(&_data[_offsets_pos + idx * SIZE_OF_INT32]);
351
460k
        return decode_fixed32_le(p);
352
460k
    }
_ZNK5doris10segment_v222BinaryPlainPageDecoderILNS_9FieldTypeE26EE14guarded_offsetEm
Line
Count
Source
348
828
    uint32_t guarded_offset(size_t idx) const {
349
828
        const auto* p =
350
828
                reinterpret_cast<const uint8_t*>(&_data[_offsets_pos + idx * SIZE_OF_INT32]);
351
828
        return decode_fixed32_le(p);
352
828
    }
_ZNK5doris10segment_v222BinaryPlainPageDecoderILNS_9FieldTypeE13EE14guarded_offsetEm
Line
Count
Source
348
748
    uint32_t guarded_offset(size_t idx) const {
349
748
        const auto* p =
350
748
                reinterpret_cast<const uint8_t*>(&_data[_offsets_pos + idx * SIZE_OF_INT32]);
351
748
        return decode_fixed32_le(p);
352
748
    }
_ZNK5doris10segment_v222BinaryPlainPageDecoderILNS_9FieldTypeE36EE14guarded_offsetEm
Line
Count
Source
348
724
    uint32_t guarded_offset(size_t idx) const {
349
724
        const auto* p =
350
724
                reinterpret_cast<const uint8_t*>(&_data[_offsets_pos + idx * SIZE_OF_INT32]);
351
724
        return decode_fixed32_le(p);
352
724
    }
_ZNK5doris10segment_v222BinaryPlainPageDecoderILNS_9FieldTypeE34EE14guarded_offsetEm
Line
Count
Source
348
702
    uint32_t guarded_offset(size_t idx) const {
349
702
        const auto* p =
350
702
                reinterpret_cast<const uint8_t*>(&_data[_offsets_pos + idx * SIZE_OF_INT32]);
351
702
        return decode_fixed32_le(p);
352
702
    }
Unexecuted instantiation: _ZNK5doris10segment_v222BinaryPlainPageDecoderILNS_9FieldTypeE35EE14guarded_offsetEm
_ZNK5doris10segment_v222BinaryPlainPageDecoderILNS_9FieldTypeE23EE14guarded_offsetEm
Line
Count
Source
348
120
    uint32_t guarded_offset(size_t idx) const {
349
120
        const auto* p =
350
120
                reinterpret_cast<const uint8_t*>(&_data[_offsets_pos + idx * SIZE_OF_INT32]);
351
120
        return decode_fixed32_le(p);
352
120
    }
_ZNK5doris10segment_v222BinaryPlainPageDecoderILNS_9FieldTypeE25EE14guarded_offsetEm
Line
Count
Source
348
348
    uint32_t guarded_offset(size_t idx) const {
349
348
        const auto* p =
350
348
                reinterpret_cast<const uint8_t*>(&_data[_offsets_pos + idx * SIZE_OF_INT32]);
351
348
        return decode_fixed32_le(p);
352
348
    }
_ZNK5doris10segment_v222BinaryPlainPageDecoderILNS_9FieldTypeE27EE14guarded_offsetEm
Line
Count
Source
348
360
    uint32_t guarded_offset(size_t idx) const {
349
360
        const auto* p =
350
360
                reinterpret_cast<const uint8_t*>(&_data[_offsets_pos + idx * SIZE_OF_INT32]);
351
360
        return decode_fixed32_le(p);
352
360
    }
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