Coverage Report

Created: 2026-10-29 19:40

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
25.3k
    Status init() override { return reset(); }
_ZN5doris10segment_v222BinaryPlainPageBuilderILNS_9FieldTypeE17EE4initEv
Line
Count
Source
50
7.11k
    Status init() override { return reset(); }
_ZN5doris10segment_v222BinaryPlainPageBuilderILNS_9FieldTypeE13EE4initEv
Line
Count
Source
50
9
    Status init() override { return reset(); }
_ZN5doris10segment_v222BinaryPlainPageBuilderILNS_9FieldTypeE26EE4initEv
Line
Count
Source
50
106
    Status init() override { return reset(); }
_ZN5doris10segment_v222BinaryPlainPageBuilderILNS_9FieldTypeE36EE4initEv
Line
Count
Source
50
56
    Status init() override { return reset(); }
_ZN5doris10segment_v222BinaryPlainPageBuilderILNS_9FieldTypeE25EE4initEv
Line
Count
Source
50
18.0k
    Status init() override { return reset(); }
_ZN5doris10segment_v222BinaryPlainPageBuilderILNS_9FieldTypeE34EE4initEv
Line
Count
Source
50
3
    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_9FieldTypeE27EE4initEv
Line
Count
Source
50
18
    Status init() override { return reset(); }
51
52
1.81M
    bool is_page_full() override {
53
1.81M
        bool ret = false;
54
1.81M
        if (_options.is_dict_page) {
55
            // dict_page_size is 0, do not limit the page size
56
1.37M
            ret = _options.dict_page_size != 0 && _size_estimate > _options.dict_page_size;
57
1.37M
        } else {
58
439k
            ret = _options.data_page_size != 0 && _size_estimate > _options.data_page_size;
59
439k
        }
60
1.81M
        return ret;
61
1.81M
    }
_ZN5doris10segment_v222BinaryPlainPageBuilderILNS_9FieldTypeE17EE12is_page_fullEv
Line
Count
Source
52
1.72M
    bool is_page_full() override {
53
1.72M
        bool ret = false;
54
1.72M
        if (_options.is_dict_page) {
55
            // dict_page_size is 0, do not limit the page size
56
1.37M
            ret = _options.dict_page_size != 0 && _size_estimate > _options.dict_page_size;
57
1.37M
        } else {
58
353k
            ret = _options.data_page_size != 0 && _size_estimate > _options.data_page_size;
59
353k
        }
60
1.72M
        return ret;
61
1.72M
    }
_ZN5doris10segment_v222BinaryPlainPageBuilderILNS_9FieldTypeE13EE12is_page_fullEv
Line
Count
Source
52
6.97k
    bool is_page_full() override {
53
6.97k
        bool ret = false;
54
6.97k
        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
6.97k
        } else {
58
6.97k
            ret = _options.data_page_size != 0 && _size_estimate > _options.data_page_size;
59
6.97k
        }
60
6.97k
        return ret;
61
6.97k
    }
_ZN5doris10segment_v222BinaryPlainPageBuilderILNS_9FieldTypeE26EE12is_page_fullEv
Line
Count
Source
52
4.06k
    bool is_page_full() override {
53
4.06k
        bool ret = false;
54
4.06k
        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
4.06k
        } else {
58
4.06k
            ret = _options.data_page_size != 0 && _size_estimate > _options.data_page_size;
59
4.06k
        }
60
4.06k
        return ret;
61
4.06k
    }
_ZN5doris10segment_v222BinaryPlainPageBuilderILNS_9FieldTypeE36EE12is_page_fullEv
Line
Count
Source
52
6.71k
    bool is_page_full() override {
53
6.71k
        bool ret = false;
54
6.71k
        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
6.71k
        } else {
58
6.71k
            ret = _options.data_page_size != 0 && _size_estimate > _options.data_page_size;
59
6.71k
        }
60
6.71k
        return ret;
61
6.71k
    }
_ZN5doris10segment_v222BinaryPlainPageBuilderILNS_9FieldTypeE25EE12is_page_fullEv
Line
Count
Source
52
67.2k
    bool is_page_full() override {
53
67.2k
        bool ret = false;
54
67.2k
        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
67.2k
        } else {
58
67.2k
            ret = _options.data_page_size != 0 && _size_estimate > _options.data_page_size;
59
67.2k
        }
60
67.2k
        return ret;
61
67.2k
    }
_ZN5doris10segment_v222BinaryPlainPageBuilderILNS_9FieldTypeE34EE12is_page_fullEv
Line
Count
Source
52
561
    bool is_page_full() override {
53
561
        bool ret = false;
54
561
        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
561
        } else {
58
561
            ret = _options.data_page_size != 0 && _size_estimate > _options.data_page_size;
59
561
        }
60
561
        return ret;
61
561
    }
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_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
    }
62
63
249k
    Status add(const uint8_t* vals, size_t* count) override {
64
249k
        DCHECK(!_finished);
65
249k
        DCHECK_GT(*count, 0);
66
249k
        size_t i = 0;
67
68
        // If the page is full, should stop adding more items.
69
550k
        while (!is_page_full() && i < *count) {
70
300k
            const auto* src = reinterpret_cast<const Slice*>(vals);
71
300k
            if constexpr (Type == FieldType::OLAP_FIELD_TYPE_BITMAP) {
72
22.5k
                if (_options.need_check_bitmap) {
73
265
                    RETURN_IF_ERROR(BitmapTypeCode::validate(*(src->data)));
74
265
                }
75
22.5k
            }
76
22.5k
            size_t offset = _buffer.size();
77
300k
            _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
300k
            RETURN_IF_CATCH_EXCEPTION(_buffer.append(src->data, src->size));
81
82
300k
            _last_value_size = cast_set<uint32_t>(src->size);
83
300k
            _size_estimate += src->size;
84
300k
            _size_estimate += sizeof(uint32_t);
85
300k
            _raw_data_size += src->size;
86
87
300k
            i++;
88
300k
            vals += sizeof(Slice);
89
300k
        }
90
91
249k
        *count = i;
92
249k
        return Status::OK();
93
249k
    }
_ZN5doris10segment_v222BinaryPlainPageBuilderILNS_9FieldTypeE17EE3addEPKhPm
Line
Count
Source
63
224k
    Status add(const uint8_t* vals, size_t* count) override {
64
224k
        DCHECK(!_finished);
65
224k
        DCHECK_GT(*count, 0);
66
224k
        size_t i = 0;
67
68
        // If the page is full, should stop adding more items.
69
489k
        while (!is_page_full() && i < *count) {
70
264k
            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
264k
            size_t offset = _buffer.size();
77
264k
            _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
264k
            RETURN_IF_CATCH_EXCEPTION(_buffer.append(src->data, src->size));
81
82
264k
            _last_value_size = cast_set<uint32_t>(src->size);
83
264k
            _size_estimate += src->size;
84
264k
            _size_estimate += sizeof(uint32_t);
85
264k
            _raw_data_size += src->size;
86
87
264k
            i++;
88
264k
            vals += sizeof(Slice);
89
264k
        }
90
91
224k
        *count = i;
92
224k
        return Status::OK();
93
224k
    }
_ZN5doris10segment_v222BinaryPlainPageBuilderILNS_9FieldTypeE13EE3addEPKhPm
Line
Count
Source
63
712
    Status add(const uint8_t* vals, size_t* count) override {
64
712
        DCHECK(!_finished);
65
712
        DCHECK_GT(*count, 0);
66
712
        size_t i = 0;
67
68
        // If the page is full, should stop adding more items.
69
6.26k
        while (!is_page_full() && i < *count) {
70
5.55k
            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
5.55k
            size_t offset = _buffer.size();
77
5.55k
            _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
5.55k
            RETURN_IF_CATCH_EXCEPTION(_buffer.append(src->data, src->size));
81
82
5.55k
            _last_value_size = cast_set<uint32_t>(src->size);
83
5.55k
            _size_estimate += src->size;
84
5.55k
            _size_estimate += sizeof(uint32_t);
85
5.55k
            _raw_data_size += src->size;
86
87
5.55k
            i++;
88
5.55k
            vals += sizeof(Slice);
89
5.55k
        }
90
91
712
        *count = i;
92
712
        return Status::OK();
93
712
    }
_ZN5doris10segment_v222BinaryPlainPageBuilderILNS_9FieldTypeE26EE3addEPKhPm
Line
Count
Source
63
1.18k
    Status add(const uint8_t* vals, size_t* count) override {
64
1.18k
        DCHECK(!_finished);
65
1.18k
        DCHECK_GT(*count, 0);
66
1.18k
        size_t i = 0;
67
68
        // If the page is full, should stop adding more items.
69
2.87k
        while (!is_page_full() && i < *count) {
70
1.69k
            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
1.69k
            size_t offset = _buffer.size();
77
1.69k
            _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
1.69k
            RETURN_IF_CATCH_EXCEPTION(_buffer.append(src->data, src->size));
81
82
1.69k
            _last_value_size = cast_set<uint32_t>(src->size);
83
1.69k
            _size_estimate += src->size;
84
1.69k
            _size_estimate += sizeof(uint32_t);
85
1.69k
            _raw_data_size += src->size;
86
87
1.69k
            i++;
88
1.69k
            vals += sizeof(Slice);
89
1.69k
        }
90
91
1.18k
        *count = i;
92
1.18k
        return Status::OK();
93
1.18k
    }
_ZN5doris10segment_v222BinaryPlainPageBuilderILNS_9FieldTypeE36EE3addEPKhPm
Line
Count
Source
63
544
    Status add(const uint8_t* vals, size_t* count) override {
64
544
        DCHECK(!_finished);
65
544
        DCHECK_GT(*count, 0);
66
544
        size_t i = 0;
67
68
        // If the page is full, should stop adding more items.
69
6.16k
        while (!is_page_full() && i < *count) {
70
5.62k
            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
5.62k
            size_t offset = _buffer.size();
77
5.62k
            _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
5.62k
            RETURN_IF_CATCH_EXCEPTION(_buffer.append(src->data, src->size));
81
82
5.62k
            _last_value_size = cast_set<uint32_t>(src->size);
83
5.62k
            _size_estimate += src->size;
84
5.62k
            _size_estimate += sizeof(uint32_t);
85
5.62k
            _raw_data_size += src->size;
86
87
5.62k
            i++;
88
5.62k
            vals += sizeof(Slice);
89
5.62k
        }
90
91
544
        *count = i;
92
544
        return Status::OK();
93
544
    }
_ZN5doris10segment_v222BinaryPlainPageBuilderILNS_9FieldTypeE25EE3addEPKhPm
Line
Count
Source
63
22.3k
    Status add(const uint8_t* vals, size_t* count) override {
64
22.3k
        DCHECK(!_finished);
65
22.3k
        DCHECK_GT(*count, 0);
66
22.3k
        size_t i = 0;
67
68
        // If the page is full, should stop adding more items.
69
44.9k
        while (!is_page_full() && i < *count) {
70
22.5k
            const auto* src = reinterpret_cast<const Slice*>(vals);
71
22.5k
            if constexpr (Type == FieldType::OLAP_FIELD_TYPE_BITMAP) {
72
22.5k
                if (_options.need_check_bitmap) {
73
265
                    RETURN_IF_ERROR(BitmapTypeCode::validate(*(src->data)));
74
265
                }
75
22.5k
            }
76
22.5k
            size_t offset = _buffer.size();
77
22.5k
            _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.5k
            RETURN_IF_CATCH_EXCEPTION(_buffer.append(src->data, src->size));
81
82
22.5k
            _last_value_size = cast_set<uint32_t>(src->size);
83
22.5k
            _size_estimate += src->size;
84
22.5k
            _size_estimate += sizeof(uint32_t);
85
22.5k
            _raw_data_size += src->size;
86
87
22.5k
            i++;
88
22.5k
            vals += sizeof(Slice);
89
22.5k
        }
90
91
22.3k
        *count = i;
92
22.3k
        return Status::OK();
93
22.3k
    }
_ZN5doris10segment_v222BinaryPlainPageBuilderILNS_9FieldTypeE34EE3addEPKhPm
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
496
        while (!is_page_full() && i < *count) {
70
431
            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
431
            size_t offset = _buffer.size();
77
431
            _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
431
            RETURN_IF_CATCH_EXCEPTION(_buffer.append(src->data, src->size));
81
82
431
            _last_value_size = cast_set<uint32_t>(src->size);
83
431
            _size_estimate += src->size;
84
431
            _size_estimate += sizeof(uint32_t);
85
431
            _raw_data_size += src->size;
86
87
431
            i++;
88
431
            vals += sizeof(Slice);
89
431
        }
90
91
65
        *count = i;
92
65
        return Status::OK();
93
65
    }
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_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
    }
94
95
28.6k
    Status finish(OwnedSlice* slice) override {
96
28.6k
        DCHECK(!_finished);
97
28.6k
        _finished = true;
98
28.6k
        RETURN_IF_CATCH_EXCEPTION({
99
            // Set up trailer
100
28.6k
            for (uint32_t _offset : _offsets) {
101
28.6k
                put_fixed32_le(&_buffer, _offset);
102
28.6k
            }
103
28.6k
            put_fixed32_le(&_buffer, cast_set<uint32_t>(_offsets.size()));
104
28.6k
            *slice = _buffer.build();
105
28.6k
        });
106
28.6k
        return Status::OK();
107
28.6k
    }
_ZN5doris10segment_v222BinaryPlainPageBuilderILNS_9FieldTypeE17EE6finishEPNS_10OwnedSliceE
Line
Count
Source
95
9.12k
    Status finish(OwnedSlice* slice) override {
96
9.12k
        DCHECK(!_finished);
97
9.12k
        _finished = true;
98
9.12k
        RETURN_IF_CATCH_EXCEPTION({
99
            // Set up trailer
100
9.12k
            for (uint32_t _offset : _offsets) {
101
9.12k
                put_fixed32_le(&_buffer, _offset);
102
9.12k
            }
103
9.12k
            put_fixed32_le(&_buffer, cast_set<uint32_t>(_offsets.size()));
104
9.12k
            *slice = _buffer.build();
105
9.12k
        });
106
9.12k
        return Status::OK();
107
9.12k
    }
_ZN5doris10segment_v222BinaryPlainPageBuilderILNS_9FieldTypeE13EE6finishEPNS_10OwnedSliceE
Line
Count
Source
95
661
    Status finish(OwnedSlice* slice) override {
96
661
        DCHECK(!_finished);
97
661
        _finished = true;
98
661
        RETURN_IF_CATCH_EXCEPTION({
99
            // Set up trailer
100
661
            for (uint32_t _offset : _offsets) {
101
661
                put_fixed32_le(&_buffer, _offset);
102
661
            }
103
661
            put_fixed32_le(&_buffer, cast_set<uint32_t>(_offsets.size()));
104
661
            *slice = _buffer.build();
105
661
        });
106
661
        return Status::OK();
107
661
    }
_ZN5doris10segment_v222BinaryPlainPageBuilderILNS_9FieldTypeE26EE6finishEPNS_10OwnedSliceE
Line
Count
Source
95
229
    Status finish(OwnedSlice* slice) override {
96
229
        DCHECK(!_finished);
97
229
        _finished = true;
98
229
        RETURN_IF_CATCH_EXCEPTION({
99
            // Set up trailer
100
229
            for (uint32_t _offset : _offsets) {
101
229
                put_fixed32_le(&_buffer, _offset);
102
229
            }
103
229
            put_fixed32_le(&_buffer, cast_set<uint32_t>(_offsets.size()));
104
229
            *slice = _buffer.build();
105
229
        });
106
229
        return Status::OK();
107
229
    }
_ZN5doris10segment_v222BinaryPlainPageBuilderILNS_9FieldTypeE36EE6finishEPNS_10OwnedSliceE
Line
Count
Source
95
530
    Status finish(OwnedSlice* slice) override {
96
530
        DCHECK(!_finished);
97
530
        _finished = true;
98
530
        RETURN_IF_CATCH_EXCEPTION({
99
            // Set up trailer
100
530
            for (uint32_t _offset : _offsets) {
101
530
                put_fixed32_le(&_buffer, _offset);
102
530
            }
103
530
            put_fixed32_le(&_buffer, cast_set<uint32_t>(_offsets.size()));
104
530
            *slice = _buffer.build();
105
530
        });
106
530
        return Status::OK();
107
530
    }
_ZN5doris10segment_v222BinaryPlainPageBuilderILNS_9FieldTypeE25EE6finishEPNS_10OwnedSliceE
Line
Count
Source
95
18.0k
    Status finish(OwnedSlice* slice) override {
96
18.0k
        DCHECK(!_finished);
97
18.0k
        _finished = true;
98
18.0k
        RETURN_IF_CATCH_EXCEPTION({
99
            // Set up trailer
100
18.0k
            for (uint32_t _offset : _offsets) {
101
18.0k
                put_fixed32_le(&_buffer, _offset);
102
18.0k
            }
103
18.0k
            put_fixed32_le(&_buffer, cast_set<uint32_t>(_offsets.size()));
104
18.0k
            *slice = _buffer.build();
105
18.0k
        });
106
18.0k
        return Status::OK();
107
18.0k
    }
_ZN5doris10segment_v222BinaryPlainPageBuilderILNS_9FieldTypeE34EE6finishEPNS_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
    }
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_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
    }
108
109
49.1k
    Status reset() override {
110
49.1k
        RETURN_IF_CATCH_EXCEPTION({
111
49.1k
            _offsets.clear();
112
49.1k
            _buffer.clear();
113
49.1k
            _buffer.reserve(_options.data_page_size == 0
114
49.1k
                                    ? 1024
115
49.1k
                                    : std::min(_options.data_page_size, _options.dict_page_size));
116
49.1k
            _size_estimate = sizeof(uint32_t);
117
49.1k
            _finished = false;
118
49.1k
            _last_value_size = 0;
119
49.1k
            _raw_data_size = 0;
120
49.1k
        });
121
49.1k
        return Status::OK();
122
49.1k
    }
_ZN5doris10segment_v222BinaryPlainPageBuilderILNS_9FieldTypeE17EE5resetEv
Line
Count
Source
109
11.3k
    Status reset() override {
110
11.3k
        RETURN_IF_CATCH_EXCEPTION({
111
11.3k
            _offsets.clear();
112
11.3k
            _buffer.clear();
113
11.3k
            _buffer.reserve(_options.data_page_size == 0
114
11.3k
                                    ? 1024
115
11.3k
                                    : std::min(_options.data_page_size, _options.dict_page_size));
116
11.3k
            _size_estimate = sizeof(uint32_t);
117
11.3k
            _finished = false;
118
11.3k
            _last_value_size = 0;
119
11.3k
            _raw_data_size = 0;
120
11.3k
        });
121
11.3k
        return Status::OK();
122
11.3k
    }
_ZN5doris10segment_v222BinaryPlainPageBuilderILNS_9FieldTypeE13EE5resetEv
Line
Count
Source
109
669
    Status reset() override {
110
669
        RETURN_IF_CATCH_EXCEPTION({
111
669
            _offsets.clear();
112
669
            _buffer.clear();
113
669
            _buffer.reserve(_options.data_page_size == 0
114
669
                                    ? 1024
115
669
                                    : std::min(_options.data_page_size, _options.dict_page_size));
116
669
            _size_estimate = sizeof(uint32_t);
117
669
            _finished = false;
118
669
            _last_value_size = 0;
119
669
            _raw_data_size = 0;
120
669
        });
121
669
        return Status::OK();
122
669
    }
_ZN5doris10segment_v222BinaryPlainPageBuilderILNS_9FieldTypeE26EE5resetEv
Line
Count
Source
109
335
    Status reset() override {
110
335
        RETURN_IF_CATCH_EXCEPTION({
111
335
            _offsets.clear();
112
335
            _buffer.clear();
113
335
            _buffer.reserve(_options.data_page_size == 0
114
335
                                    ? 1024
115
335
                                    : std::min(_options.data_page_size, _options.dict_page_size));
116
335
            _size_estimate = sizeof(uint32_t);
117
335
            _finished = false;
118
335
            _last_value_size = 0;
119
335
            _raw_data_size = 0;
120
335
        });
121
335
        return Status::OK();
122
335
    }
_ZN5doris10segment_v222BinaryPlainPageBuilderILNS_9FieldTypeE36EE5resetEv
Line
Count
Source
109
586
    Status reset() override {
110
586
        RETURN_IF_CATCH_EXCEPTION({
111
586
            _offsets.clear();
112
586
            _buffer.clear();
113
586
            _buffer.reserve(_options.data_page_size == 0
114
586
                                    ? 1024
115
586
                                    : std::min(_options.data_page_size, _options.dict_page_size));
116
586
            _size_estimate = sizeof(uint32_t);
117
586
            _finished = false;
118
586
            _last_value_size = 0;
119
586
            _raw_data_size = 0;
120
586
        });
121
586
        return Status::OK();
122
586
    }
_ZN5doris10segment_v222BinaryPlainPageBuilderILNS_9FieldTypeE25EE5resetEv
Line
Count
Source
109
36.1k
    Status reset() override {
110
36.1k
        RETURN_IF_CATCH_EXCEPTION({
111
36.1k
            _offsets.clear();
112
36.1k
            _buffer.clear();
113
36.1k
            _buffer.reserve(_options.data_page_size == 0
114
36.1k
                                    ? 1024
115
36.1k
                                    : std::min(_options.data_page_size, _options.dict_page_size));
116
36.1k
            _size_estimate = sizeof(uint32_t);
117
36.1k
            _finished = false;
118
36.1k
            _last_value_size = 0;
119
36.1k
            _raw_data_size = 0;
120
36.1k
        });
121
36.1k
        return Status::OK();
122
36.1k
    }
_ZN5doris10segment_v222BinaryPlainPageBuilderILNS_9FieldTypeE34EE5resetEv
Line
Count
Source
109
22
    Status reset() override {
110
22
        RETURN_IF_CATCH_EXCEPTION({
111
22
            _offsets.clear();
112
22
            _buffer.clear();
113
22
            _buffer.reserve(_options.data_page_size == 0
114
22
                                    ? 1024
115
22
                                    : std::min(_options.data_page_size, _options.dict_page_size));
116
22
            _size_estimate = sizeof(uint32_t);
117
22
            _finished = false;
118
22
            _last_value_size = 0;
119
22
            _raw_data_size = 0;
120
22
        });
121
22
        return Status::OK();
122
22
    }
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_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
    }
123
124
18.8k
    size_t count() const override { return _offsets.size(); }
_ZNK5doris10segment_v222BinaryPlainPageBuilderILNS_9FieldTypeE17EE5countEv
Line
Count
Source
124
598
    size_t count() const override { return _offsets.size(); }
_ZNK5doris10segment_v222BinaryPlainPageBuilderILNS_9FieldTypeE13EE5countEv
Line
Count
Source
124
9
    size_t count() const override { return _offsets.size(); }
_ZNK5doris10segment_v222BinaryPlainPageBuilderILNS_9FieldTypeE26EE5countEv
Line
Count
Source
124
58
    size_t count() const override { return _offsets.size(); }
_ZNK5doris10segment_v222BinaryPlainPageBuilderILNS_9FieldTypeE36EE5countEv
Line
Count
Source
124
229
    size_t count() const override { return _offsets.size(); }
_ZNK5doris10segment_v222BinaryPlainPageBuilderILNS_9FieldTypeE25EE5countEv
Line
Count
Source
124
18.0k
    size_t count() const override { return _offsets.size(); }
Unexecuted instantiation: _ZNK5doris10segment_v222BinaryPlainPageBuilderILNS_9FieldTypeE34EE5countEv
Unexecuted instantiation: _ZNK5doris10segment_v222BinaryPlainPageBuilderILNS_9FieldTypeE35EE5countEv
Unexecuted instantiation: _ZNK5doris10segment_v222BinaryPlainPageBuilderILNS_9FieldTypeE23EE5countEv
Unexecuted instantiation: _ZNK5doris10segment_v222BinaryPlainPageBuilderILNS_9FieldTypeE27EE5countEv
125
126
1.72k
    uint64_t size() const override { return _size_estimate; }
_ZNK5doris10segment_v222BinaryPlainPageBuilderILNS_9FieldTypeE17EE4sizeEv
Line
Count
Source
126
1.56k
    uint64_t size() const override { return _size_estimate; }
Unexecuted instantiation: _ZNK5doris10segment_v222BinaryPlainPageBuilderILNS_9FieldTypeE13EE4sizeEv
_ZNK5doris10segment_v222BinaryPlainPageBuilderILNS_9FieldTypeE26EE4sizeEv
Line
Count
Source
126
72
    uint64_t size() const override { return _size_estimate; }
_ZNK5doris10segment_v222BinaryPlainPageBuilderILNS_9FieldTypeE36EE4sizeEv
Line
Count
Source
126
24
    uint64_t size() const override { return _size_estimate; }
_ZNK5doris10segment_v222BinaryPlainPageBuilderILNS_9FieldTypeE25EE4sizeEv
Line
Count
Source
126
53
    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_9FieldTypeE27EE4sizeEv
Line
Count
Source
126
8
    uint64_t size() const override { return _size_estimate; }
127
128
1.29k
    uint64_t get_raw_data_size() const override { return _raw_data_size; }
_ZNK5doris10segment_v222BinaryPlainPageBuilderILNS_9FieldTypeE17EE17get_raw_data_sizeEv
Line
Count
Source
128
23
    uint64_t get_raw_data_size() const override { return _raw_data_size; }
_ZNK5doris10segment_v222BinaryPlainPageBuilderILNS_9FieldTypeE13EE17get_raw_data_sizeEv
Line
Count
Source
128
652
    uint64_t get_raw_data_size() const override { return _raw_data_size; }
_ZNK5doris10segment_v222BinaryPlainPageBuilderILNS_9FieldTypeE26EE17get_raw_data_sizeEv
Line
Count
Source
128
172
    uint64_t get_raw_data_size() const override { return _raw_data_size; }
_ZNK5doris10segment_v222BinaryPlainPageBuilderILNS_9FieldTypeE36EE17get_raw_data_sizeEv
Line
Count
Source
128
302
    uint64_t get_raw_data_size() const override { return _raw_data_size; }
_ZNK5doris10segment_v222BinaryPlainPageBuilderILNS_9FieldTypeE25EE17get_raw_data_sizeEv
Line
Count
Source
128
69
    uint64_t get_raw_data_size() const override { return _raw_data_size; }
_ZNK5doris10segment_v222BinaryPlainPageBuilderILNS_9FieldTypeE34EE17get_raw_data_sizeEv
Line
Count
Source
128
19
    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_9FieldTypeE27EE17get_raw_data_sizeEv
Line
Count
Source
128
28
    uint64_t get_raw_data_size() const override { return _raw_data_size; }
129
130
private:
131
    BinaryPlainPageBuilder(const PageBuilderOptions& options)
132
25.3k
            : _size_estimate(0), _options(options) {}
_ZN5doris10segment_v222BinaryPlainPageBuilderILNS_9FieldTypeE17EEC2ERKNS0_18PageBuilderOptionsE
Line
Count
Source
132
7.11k
            : _size_estimate(0), _options(options) {}
_ZN5doris10segment_v222BinaryPlainPageBuilderILNS_9FieldTypeE13EEC2ERKNS0_18PageBuilderOptionsE
Line
Count
Source
132
9
            : _size_estimate(0), _options(options) {}
_ZN5doris10segment_v222BinaryPlainPageBuilderILNS_9FieldTypeE26EEC2ERKNS0_18PageBuilderOptionsE
Line
Count
Source
132
106
            : _size_estimate(0), _options(options) {}
_ZN5doris10segment_v222BinaryPlainPageBuilderILNS_9FieldTypeE36EEC2ERKNS0_18PageBuilderOptionsE
Line
Count
Source
132
56
            : _size_estimate(0), _options(options) {}
_ZN5doris10segment_v222BinaryPlainPageBuilderILNS_9FieldTypeE25EEC2ERKNS0_18PageBuilderOptionsE
Line
Count
Source
132
18.0k
            : _size_estimate(0), _options(options) {}
_ZN5doris10segment_v222BinaryPlainPageBuilderILNS_9FieldTypeE34EEC2ERKNS0_18PageBuilderOptionsE
Line
Count
Source
132
3
            : _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_9FieldTypeE27EEC2ERKNS0_18PageBuilderOptionsE
Line
Count
Source
132
18
            : _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
7.06k
            : _data(data),
152
7.06k
              _options(options),
153
7.06k
              _parsed(false),
154
7.06k
              _num_elems(0),
155
7.06k
              _offsets_pos(0),
156
7.06k
              _cur_idx(0) {}
_ZN5doris10segment_v222BinaryPlainPageDecoderILNS_9FieldTypeE17EEC2ENS_5SliceERKNS0_18PageDecoderOptionsE
Line
Count
Source
151
3.14k
            : _data(data),
152
3.14k
              _options(options),
153
3.14k
              _parsed(false),
154
3.14k
              _num_elems(0),
155
3.14k
              _offsets_pos(0),
156
3.14k
              _cur_idx(0) {}
_ZN5doris10segment_v222BinaryPlainPageDecoderILNS_9FieldTypeE26EEC2ENS_5SliceERKNS0_18PageDecoderOptionsE
Line
Count
Source
151
3.23k
            : _data(data),
152
3.23k
              _options(options),
153
3.23k
              _parsed(false),
154
3.23k
              _num_elems(0),
155
3.23k
              _offsets_pos(0),
156
3.23k
              _cur_idx(0) {}
_ZN5doris10segment_v222BinaryPlainPageDecoderILNS_9FieldTypeE13EEC2ENS_5SliceERKNS0_18PageDecoderOptionsE
Line
Count
Source
151
87
            : _data(data),
152
87
              _options(options),
153
87
              _parsed(false),
154
87
              _num_elems(0),
155
87
              _offsets_pos(0),
156
87
              _cur_idx(0) {}
_ZN5doris10segment_v222BinaryPlainPageDecoderILNS_9FieldTypeE36EEC2ENS_5SliceERKNS0_18PageDecoderOptionsE
Line
Count
Source
151
75
            : _data(data),
152
75
              _options(options),
153
75
              _parsed(false),
154
75
              _num_elems(0),
155
75
              _offsets_pos(0),
156
75
              _cur_idx(0) {}
_ZN5doris10segment_v222BinaryPlainPageDecoderILNS_9FieldTypeE34EEC2ENS_5SliceERKNS0_18PageDecoderOptionsE
Line
Count
Source
151
73
            : _data(data),
152
73
              _options(options),
153
73
              _parsed(false),
154
73
              _num_elems(0),
155
73
              _offsets_pos(0),
156
73
              _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
36
            : _data(data),
152
36
              _options(options),
153
36
              _parsed(false),
154
36
              _num_elems(0),
155
36
              _offsets_pos(0),
156
36
              _cur_idx(0) {}
_ZN5doris10segment_v222BinaryPlainPageDecoderILNS_9FieldTypeE25EEC2ENS_5SliceERKNS0_18PageDecoderOptionsE
Line
Count
Source
151
123
            : _data(data),
152
123
              _options(options),
153
123
              _parsed(false),
154
123
              _num_elems(0),
155
123
              _offsets_pos(0),
156
123
              _cur_idx(0) {}
_ZN5doris10segment_v222BinaryPlainPageDecoderILNS_9FieldTypeE27EEC2ENS_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) {}
157
158
7.06k
    Status init() override {
159
7.06k
        CHECK(!_parsed);
160
161
7.06k
        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
7.06k
        _num_elems = decode_fixed32_le((const uint8_t*)&_data[_data.get_size() - sizeof(uint32_t)]);
170
7.06k
        _offsets_pos = cast_set<uint32_t>(_data.get_size() - ((_num_elems + 1) * sizeof(uint32_t)));
171
172
7.06k
        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
7.06k
        _parsed = true;
179
180
7.06k
        return Status::OK();
181
7.06k
    }
_ZN5doris10segment_v222BinaryPlainPageDecoderILNS_9FieldTypeE17EE4initEv
Line
Count
Source
158
3.14k
    Status init() override {
159
3.14k
        CHECK(!_parsed);
160
161
3.14k
        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.14k
        _num_elems = decode_fixed32_le((const uint8_t*)&_data[_data.get_size() - sizeof(uint32_t)]);
170
3.14k
        _offsets_pos = cast_set<uint32_t>(_data.get_size() - ((_num_elems + 1) * sizeof(uint32_t)));
171
172
3.14k
        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.14k
        _parsed = true;
179
180
3.14k
        return Status::OK();
181
3.14k
    }
_ZN5doris10segment_v222BinaryPlainPageDecoderILNS_9FieldTypeE26EE4initEv
Line
Count
Source
158
3.23k
    Status init() override {
159
3.23k
        CHECK(!_parsed);
160
161
3.23k
        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.23k
        _num_elems = decode_fixed32_le((const uint8_t*)&_data[_data.get_size() - sizeof(uint32_t)]);
170
3.23k
        _offsets_pos = cast_set<uint32_t>(_data.get_size() - ((_num_elems + 1) * sizeof(uint32_t)));
171
172
3.23k
        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.23k
        _parsed = true;
179
180
3.23k
        return Status::OK();
181
3.23k
    }
_ZN5doris10segment_v222BinaryPlainPageDecoderILNS_9FieldTypeE13EE4initEv
Line
Count
Source
158
87
    Status init() override {
159
87
        CHECK(!_parsed);
160
161
87
        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
87
        _num_elems = decode_fixed32_le((const uint8_t*)&_data[_data.get_size() - sizeof(uint32_t)]);
170
87
        _offsets_pos = cast_set<uint32_t>(_data.get_size() - ((_num_elems + 1) * sizeof(uint32_t)));
171
172
87
        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
87
        _parsed = true;
179
180
87
        return Status::OK();
181
87
    }
_ZN5doris10segment_v222BinaryPlainPageDecoderILNS_9FieldTypeE36EE4initEv
Line
Count
Source
158
75
    Status init() override {
159
75
        CHECK(!_parsed);
160
161
75
        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
75
        _num_elems = decode_fixed32_le((const uint8_t*)&_data[_data.get_size() - sizeof(uint32_t)]);
170
75
        _offsets_pos = cast_set<uint32_t>(_data.get_size() - ((_num_elems + 1) * sizeof(uint32_t)));
171
172
75
        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
75
        _parsed = true;
179
180
75
        return Status::OK();
181
75
    }
_ZN5doris10segment_v222BinaryPlainPageDecoderILNS_9FieldTypeE34EE4initEv
Line
Count
Source
158
73
    Status init() override {
159
73
        CHECK(!_parsed);
160
161
73
        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
73
        _num_elems = decode_fixed32_le((const uint8_t*)&_data[_data.get_size() - sizeof(uint32_t)]);
170
73
        _offsets_pos = cast_set<uint32_t>(_data.get_size() - ((_num_elems + 1) * sizeof(uint32_t)));
171
172
73
        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
73
        _parsed = true;
179
180
73
        return Status::OK();
181
73
    }
_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
36
    Status init() override {
159
36
        CHECK(!_parsed);
160
161
36
        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
36
        _num_elems = decode_fixed32_le((const uint8_t*)&_data[_data.get_size() - sizeof(uint32_t)]);
170
36
        _offsets_pos = cast_set<uint32_t>(_data.get_size() - ((_num_elems + 1) * sizeof(uint32_t)));
171
172
36
        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
36
        _parsed = true;
179
180
36
        return Status::OK();
181
36
    }
_ZN5doris10segment_v222BinaryPlainPageDecoderILNS_9FieldTypeE25EE4initEv
Line
Count
Source
158
123
    Status init() override {
159
123
        CHECK(!_parsed);
160
161
123
        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
123
        _num_elems = decode_fixed32_le((const uint8_t*)&_data[_data.get_size() - sizeof(uint32_t)]);
170
123
        _offsets_pos = cast_set<uint32_t>(_data.get_size() - ((_num_elems + 1) * sizeof(uint32_t)));
171
172
123
        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
123
        _parsed = true;
179
180
123
        return Status::OK();
181
123
    }
_ZN5doris10segment_v222BinaryPlainPageDecoderILNS_9FieldTypeE27EE4initEv
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
    }
182
183
1.07k
    Status seek_to_position_in_page(size_t pos) override {
184
1.07k
        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
1.07k
        DCHECK_LE(pos, _num_elems);
191
1.07k
        _cur_idx = pos;
192
1.07k
        return Status::OK();
193
1.07k
    }
_ZN5doris10segment_v222BinaryPlainPageDecoderILNS_9FieldTypeE17EE24seek_to_position_in_pageEm
Line
Count
Source
183
664
    Status seek_to_position_in_page(size_t pos) override {
184
664
        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
664
        DCHECK_LE(pos, _num_elems);
191
664
        _cur_idx = pos;
192
664
        return Status::OK();
193
664
    }
_ZN5doris10segment_v222BinaryPlainPageDecoderILNS_9FieldTypeE26EE24seek_to_position_in_pageEm
Line
Count
Source
183
91
    Status seek_to_position_in_page(size_t pos) override {
184
91
        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
91
        DCHECK_LE(pos, _num_elems);
191
91
        _cur_idx = pos;
192
91
        return Status::OK();
193
91
    }
_ZN5doris10segment_v222BinaryPlainPageDecoderILNS_9FieldTypeE13EE24seek_to_position_in_pageEm
Line
Count
Source
183
81
    Status seek_to_position_in_page(size_t pos) override {
184
81
        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
81
        DCHECK_LE(pos, _num_elems);
191
81
        _cur_idx = pos;
192
81
        return Status::OK();
193
81
    }
_ZN5doris10segment_v222BinaryPlainPageDecoderILNS_9FieldTypeE36EE24seek_to_position_in_pageEm
Line
Count
Source
183
6
    Status seek_to_position_in_page(size_t pos) override {
184
6
        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
6
        DCHECK_LE(pos, _num_elems);
191
6
        _cur_idx = pos;
192
6
        return Status::OK();
193
6
    }
_ZN5doris10segment_v222BinaryPlainPageDecoderILNS_9FieldTypeE34EE24seek_to_position_in_pageEm
Line
Count
Source
183
84
    Status seek_to_position_in_page(size_t pos) override {
184
84
        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
84
        DCHECK_LE(pos, _num_elems);
191
84
        _cur_idx = pos;
192
84
        return Status::OK();
193
84
    }
Unexecuted instantiation: _ZN5doris10segment_v222BinaryPlainPageDecoderILNS_9FieldTypeE35EE24seek_to_position_in_pageEm
_ZN5doris10segment_v222BinaryPlainPageDecoderILNS_9FieldTypeE23EE24seek_to_position_in_pageEm
Line
Count
Source
183
3
    Status seek_to_position_in_page(size_t pos) override {
184
3
        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
3
        DCHECK_LE(pos, _num_elems);
191
3
        _cur_idx = pos;
192
3
        return Status::OK();
193
3
    }
_ZN5doris10segment_v222BinaryPlainPageDecoderILNS_9FieldTypeE25EE24seek_to_position_in_pageEm
Line
Count
Source
183
145
    Status seek_to_position_in_page(size_t pos) override {
184
145
        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
145
        DCHECK_LE(pos, _num_elems);
191
145
        _cur_idx = pos;
192
145
        return Status::OK();
193
145
    }
Unexecuted instantiation: _ZN5doris10segment_v222BinaryPlainPageDecoderILNS_9FieldTypeE27EE24seek_to_position_in_pageEm
194
195
2.55k
    Status next_batch(size_t* n, MutableColumnPtr& dst) override {
196
2.55k
        DCHECK(_parsed);
197
2.55k
        if (*n == 0 || _cur_idx >= _num_elems) [[unlikely]] {
198
3
            *n = 0;
199
3
            return Status::OK();
200
3
        }
201
2.55k
        const size_t max_fetch = std::min(*n, static_cast<size_t>(_num_elems - _cur_idx));
202
203
2.55k
        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.55k
        uint32_t last_offset = guarded_offset(_cur_idx);
219
2.55k
        _offsets.resize(max_fetch + 1);
220
2.55k
        _offsets[0] = last_offset;
221
461k
        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.55k
        _cur_idx++;
232
2.55k
        _offsets[max_fetch] = offset(_cur_idx);
233
2.55k
        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.55k
        *n = max_fetch;
241
2.55k
        return Status::OK();
242
2.55k
    }
_ZN5doris10segment_v222BinaryPlainPageDecoderILNS_9FieldTypeE17EE10next_batchEPmRNS_3COWINS_7IColumnEE11mutable_ptrIS6_EE
Line
Count
Source
195
2.04k
    Status next_batch(size_t* n, MutableColumnPtr& dst) override {
196
2.04k
        DCHECK(_parsed);
197
2.04k
        if (*n == 0 || _cur_idx >= _num_elems) [[unlikely]] {
198
2
            *n = 0;
199
2
            return Status::OK();
200
2
        }
201
2.04k
        const size_t max_fetch = std::min(*n, static_cast<size_t>(_num_elems - _cur_idx));
202
203
2.04k
        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.04k
        uint32_t last_offset = guarded_offset(_cur_idx);
219
2.04k
        _offsets.resize(max_fetch + 1);
220
2.04k
        _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
2.04k
        _cur_idx++;
232
2.04k
        _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
2.04k
        dst->insert_many_continuous_binary_data(_data.data, _offsets.data(), max_fetch);
239
240
2.04k
        *n = max_fetch;
241
2.04k
        return Status::OK();
242
2.04k
    }
_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
1.11k
                          MutableColumnPtr& dst) override {
246
1.11k
        DCHECK(_parsed);
247
1.11k
        if (*n == 0) [[unlikely]] {
248
0
            *n = 0;
249
0
            return Status::OK();
250
0
        }
251
252
1.11k
        auto total = *n;
253
254
1.11k
        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.11k
        size_t read_count = 0;
277
1.11k
        _binary_data.resize(total);
278
6.16k
        for (size_t i = 0; i < total; ++i) {
279
5.13k
            ordinal_t ord = rowids[i] - page_first_ordinal;
280
5.13k
            if (UNLIKELY(ord >= _num_elems)) {
281
89
                break;
282
89
            }
283
284
5.05k
            const uint32_t start_offset = offset(ord);
285
5.05k
            _binary_data[read_count].data = _data.mutable_data() + start_offset;
286
5.05k
            _binary_data[read_count].size = offset(ord + 1) - start_offset;
287
5.05k
            read_count++;
288
5.05k
        }
289
290
1.11k
        if (LIKELY(read_count > 0)) {
291
1.11k
            dst->insert_many_strings(_binary_data.data(), read_count);
292
1.11k
        }
293
294
1.11k
        *n = read_count;
295
1.11k
        return Status::OK();
296
1.11k
    }
_ZN5doris10segment_v222BinaryPlainPageDecoderILNS_9FieldTypeE17EE14read_by_rowidsEPKjmPmRNS_3COWINS_7IColumnEE11mutable_ptrIS8_EE
Line
Count
Source
245
754
                          MutableColumnPtr& dst) override {
246
754
        DCHECK(_parsed);
247
754
        if (*n == 0) [[unlikely]] {
248
0
            *n = 0;
249
0
            return Status::OK();
250
0
        }
251
252
754
        auto total = *n;
253
254
754
        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
754
        size_t read_count = 0;
277
754
        _binary_data.resize(total);
278
3.56k
        for (size_t i = 0; i < total; ++i) {
279
2.82k
            ordinal_t ord = rowids[i] - page_first_ordinal;
280
2.82k
            if (UNLIKELY(ord >= _num_elems)) {
281
10
                break;
282
10
            }
283
284
2.81k
            const uint32_t start_offset = offset(ord);
285
2.81k
            _binary_data[read_count].data = _data.mutable_data() + start_offset;
286
2.81k
            _binary_data[read_count].size = offset(ord + 1) - start_offset;
287
2.81k
            read_count++;
288
2.81k
        }
289
290
754
        if (LIKELY(read_count > 0)) {
291
754
            dst->insert_many_strings(_binary_data.data(), read_count);
292
754
        }
293
294
754
        *n = read_count;
295
754
        return Status::OK();
296
754
    }
_ZN5doris10segment_v222BinaryPlainPageDecoderILNS_9FieldTypeE26EE14read_by_rowidsEPKjmPmRNS_3COWINS_7IColumnEE11mutable_ptrIS8_EE
Line
Count
Source
245
120
                          MutableColumnPtr& dst) override {
246
120
        DCHECK(_parsed);
247
120
        if (*n == 0) [[unlikely]] {
248
0
            *n = 0;
249
0
            return Status::OK();
250
0
        }
251
252
120
        auto total = *n;
253
254
120
        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
120
        size_t read_count = 0;
277
120
        _binary_data.resize(total);
278
604
        for (size_t i = 0; i < total; ++i) {
279
490
            ordinal_t ord = rowids[i] - page_first_ordinal;
280
490
            if (UNLIKELY(ord >= _num_elems)) {
281
6
                break;
282
6
            }
283
284
484
            const uint32_t start_offset = offset(ord);
285
484
            _binary_data[read_count].data = _data.mutable_data() + start_offset;
286
484
            _binary_data[read_count].size = offset(ord + 1) - start_offset;
287
484
            read_count++;
288
484
        }
289
290
120
        if (LIKELY(read_count > 0)) {
291
120
            dst->insert_many_strings(_binary_data.data(), read_count);
292
120
        }
293
294
120
        *n = read_count;
295
120
        return Status::OK();
296
120
    }
_ZN5doris10segment_v222BinaryPlainPageDecoderILNS_9FieldTypeE13EE14read_by_rowidsEPKjmPmRNS_3COWINS_7IColumnEE11mutable_ptrIS8_EE
Line
Count
Source
245
81
                          MutableColumnPtr& dst) override {
246
81
        DCHECK(_parsed);
247
81
        if (*n == 0) [[unlikely]] {
248
0
            *n = 0;
249
0
            return Status::OK();
250
0
        }
251
252
81
        auto total = *n;
253
254
81
        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
81
        size_t read_count = 0;
277
81
        _binary_data.resize(total);
278
514
        for (size_t i = 0; i < total; ++i) {
279
440
            ordinal_t ord = rowids[i] - page_first_ordinal;
280
440
            if (UNLIKELY(ord >= _num_elems)) {
281
7
                break;
282
7
            }
283
284
433
            const uint32_t start_offset = offset(ord);
285
433
            _binary_data[read_count].data = _data.mutable_data() + start_offset;
286
433
            _binary_data[read_count].size = offset(ord + 1) - start_offset;
287
433
            read_count++;
288
433
        }
289
290
81
        if (LIKELY(read_count > 0)) {
291
81
            dst->insert_many_strings(_binary_data.data(), read_count);
292
81
        }
293
294
81
        *n = read_count;
295
81
        return Status::OK();
296
81
    }
_ZN5doris10segment_v222BinaryPlainPageDecoderILNS_9FieldTypeE36EE14read_by_rowidsEPKjmPmRNS_3COWINS_7IColumnEE11mutable_ptrIS8_EE
Line
Count
Source
245
37
                          MutableColumnPtr& dst) override {
246
37
        DCHECK(_parsed);
247
37
        if (*n == 0) [[unlikely]] {
248
0
            *n = 0;
249
0
            return Status::OK();
250
0
        }
251
252
37
        auto total = *n;
253
254
37
        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
37
        size_t read_count = 0;
277
37
        _binary_data.resize(total);
278
520
        for (size_t i = 0; i < total; ++i) {
279
511
            ordinal_t ord = rowids[i] - page_first_ordinal;
280
511
            if (UNLIKELY(ord >= _num_elems)) {
281
28
                break;
282
28
            }
283
284
483
            const uint32_t start_offset = offset(ord);
285
483
            _binary_data[read_count].data = _data.mutable_data() + start_offset;
286
483
            _binary_data[read_count].size = offset(ord + 1) - start_offset;
287
483
            read_count++;
288
483
        }
289
290
37
        if (LIKELY(read_count > 0)) {
291
37
            dst->insert_many_strings(_binary_data.data(), read_count);
292
37
        }
293
294
37
        *n = read_count;
295
37
        return Status::OK();
296
37
    }
_ZN5doris10segment_v222BinaryPlainPageDecoderILNS_9FieldTypeE34EE14read_by_rowidsEPKjmPmRNS_3COWINS_7IColumnEE11mutable_ptrIS8_EE
Line
Count
Source
245
80
                          MutableColumnPtr& dst) override {
246
80
        DCHECK(_parsed);
247
80
        if (*n == 0) [[unlikely]] {
248
0
            *n = 0;
249
0
            return Status::OK();
250
0
        }
251
252
80
        auto total = *n;
253
254
80
        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
80
        size_t read_count = 0;
277
80
        _binary_data.resize(total);
278
509
        for (size_t i = 0; i < total; ++i) {
279
433
            ordinal_t ord = rowids[i] - page_first_ordinal;
280
433
            if (UNLIKELY(ord >= _num_elems)) {
281
4
                break;
282
4
            }
283
284
429
            const uint32_t start_offset = offset(ord);
285
429
            _binary_data[read_count].data = _data.mutable_data() + start_offset;
286
429
            _binary_data[read_count].size = offset(ord + 1) - start_offset;
287
429
            read_count++;
288
429
        }
289
290
80
        if (LIKELY(read_count > 0)) {
291
80
            dst->insert_many_strings(_binary_data.data(), read_count);
292
80
        }
293
294
80
        *n = read_count;
295
80
        return Status::OK();
296
80
    }
Unexecuted instantiation: _ZN5doris10segment_v222BinaryPlainPageDecoderILNS_9FieldTypeE35EE14read_by_rowidsEPKjmPmRNS_3COWINS_7IColumnEE11mutable_ptrIS8_EE
_ZN5doris10segment_v222BinaryPlainPageDecoderILNS_9FieldTypeE23EE14read_by_rowidsEPKjmPmRNS_3COWINS_7IColumnEE11mutable_ptrIS8_EE
Line
Count
Source
245
18
                          MutableColumnPtr& dst) override {
246
18
        DCHECK(_parsed);
247
18
        if (*n == 0) [[unlikely]] {
248
0
            *n = 0;
249
0
            return Status::OK();
250
0
        }
251
252
18
        auto total = *n;
253
254
18
        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
18
        size_t read_count = 0;
277
18
        _binary_data.resize(total);
278
99
        for (size_t i = 0; i < total; ++i) {
279
96
            ordinal_t ord = rowids[i] - page_first_ordinal;
280
96
            if (UNLIKELY(ord >= _num_elems)) {
281
15
                break;
282
15
            }
283
284
81
            const uint32_t start_offset = offset(ord);
285
81
            _binary_data[read_count].data = _data.mutable_data() + start_offset;
286
81
            _binary_data[read_count].size = offset(ord + 1) - start_offset;
287
81
            read_count++;
288
81
        }
289
290
18
        if (LIKELY(read_count > 0)) {
291
18
            dst->insert_many_strings(_binary_data.data(), read_count);
292
18
        }
293
294
18
        *n = read_count;
295
18
        return Status::OK();
296
18
    }
_ZN5doris10segment_v222BinaryPlainPageDecoderILNS_9FieldTypeE25EE14read_by_rowidsEPKjmPmRNS_3COWINS_7IColumnEE11mutable_ptrIS8_EE
Line
Count
Source
245
13
                          MutableColumnPtr& dst) override {
246
13
        DCHECK(_parsed);
247
13
        if (*n == 0) [[unlikely]] {
248
0
            *n = 0;
249
0
            return Status::OK();
250
0
        }
251
252
13
        auto total = *n;
253
254
13
        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
13
        size_t read_count = 0;
277
13
        _binary_data.resize(total);
278
98
        for (size_t i = 0; i < total; ++i) {
279
91
            ordinal_t ord = rowids[i] - page_first_ordinal;
280
91
            if (UNLIKELY(ord >= _num_elems)) {
281
6
                break;
282
6
            }
283
284
85
            const uint32_t start_offset = offset(ord);
285
85
            _binary_data[read_count].data = _data.mutable_data() + start_offset;
286
85
            _binary_data[read_count].size = offset(ord + 1) - start_offset;
287
85
            read_count++;
288
85
        }
289
290
13
        if (LIKELY(read_count > 0)) {
291
13
            dst->insert_many_strings(_binary_data.data(), read_count);
292
13
        }
293
294
13
        *n = read_count;
295
13
        return Status::OK();
296
13
    }
_ZN5doris10segment_v222BinaryPlainPageDecoderILNS_9FieldTypeE27EE14read_by_rowidsEPKjmPmRNS_3COWINS_7IColumnEE11mutable_ptrIS8_EE
Line
Count
Source
245
16
                          MutableColumnPtr& dst) override {
246
16
        DCHECK(_parsed);
247
16
        if (*n == 0) [[unlikely]] {
248
0
            *n = 0;
249
0
            return Status::OK();
250
0
        }
251
252
16
        auto total = *n;
253
254
16
        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
16
        size_t read_count = 0;
277
16
        _binary_data.resize(total);
278
256
        for (size_t i = 0; i < total; ++i) {
279
253
            ordinal_t ord = rowids[i] - page_first_ordinal;
280
253
            if (UNLIKELY(ord >= _num_elems)) {
281
13
                break;
282
13
            }
283
284
240
            const uint32_t start_offset = offset(ord);
285
240
            _binary_data[read_count].data = _data.mutable_data() + start_offset;
286
240
            _binary_data[read_count].size = offset(ord + 1) - start_offset;
287
240
            read_count++;
288
240
        }
289
290
16
        if (LIKELY(read_count > 0)) {
291
16
            dst->insert_many_strings(_binary_data.data(), read_count);
292
16
        }
293
294
16
        *n = read_count;
295
16
        return Status::OK();
296
16
    }
297
298
8.30k
    size_t count() const override {
299
8.30k
        DCHECK(_parsed);
300
8.30k
        return _num_elems;
301
8.30k
    }
_ZNK5doris10segment_v222BinaryPlainPageDecoderILNS_9FieldTypeE17EE5countEv
Line
Count
Source
298
1.33k
    size_t count() const override {
299
        DCHECK(_parsed);
300
1.33k
        return _num_elems;
301
1.33k
    }
_ZNK5doris10segment_v222BinaryPlainPageDecoderILNS_9FieldTypeE26EE5countEv
Line
Count
Source
298
6.29k
    size_t count() const override {
299
        DCHECK(_parsed);
300
6.29k
        return _num_elems;
301
6.29k
    }
_ZNK5doris10segment_v222BinaryPlainPageDecoderILNS_9FieldTypeE13EE5countEv
Line
Count
Source
298
75
    size_t count() const override {
299
        DCHECK(_parsed);
300
75
        return _num_elems;
301
75
    }
_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
58
    size_t count() const override {
299
        DCHECK(_parsed);
300
58
        return _num_elems;
301
58
    }
_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
1.19k
    size_t current_index() const override {
304
1.19k
        DCHECK(_parsed);
305
1.19k
        return _cur_idx;
306
1.19k
    }
_ZNK5doris10segment_v222BinaryPlainPageDecoderILNS_9FieldTypeE17EE13current_indexEv
Line
Count
Source
303
639
    size_t current_index() const override {
304
        DCHECK(_parsed);
305
639
        return _cur_idx;
306
639
    }
_ZNK5doris10segment_v222BinaryPlainPageDecoderILNS_9FieldTypeE26EE13current_indexEv
Line
Count
Source
303
132
    size_t current_index() const override {
304
        DCHECK(_parsed);
305
132
        return _cur_idx;
306
132
    }
_ZNK5doris10segment_v222BinaryPlainPageDecoderILNS_9FieldTypeE13EE13current_indexEv
Line
Count
Source
303
137
    size_t current_index() const override {
304
        DCHECK(_parsed);
305
137
        return _cur_idx;
306
137
    }
Unexecuted instantiation: _ZNK5doris10segment_v222BinaryPlainPageDecoderILNS_9FieldTypeE36EE13current_indexEv
_ZNK5doris10segment_v222BinaryPlainPageDecoderILNS_9FieldTypeE34EE13current_indexEv
Line
Count
Source
303
140
    size_t current_index() const override {
304
        DCHECK(_parsed);
305
140
        return _cur_idx;
306
140
    }
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.08k
    Status get_dict_word_info(StringRef* dict_word_info) override {
309
4.08k
        if (UNLIKELY(_num_elems <= 0)) {
310
3
            return Status::OK();
311
3
        }
312
313
4.08k
        char* data_begin = (char*)&_data[0];
314
4.08k
        char* offset_ptr = (char*)&_data[_offsets_pos];
315
316
94.8k
        for (uint32_t i = 0; i < _num_elems; ++i) {
317
90.7k
            uint32_t offset = decode_fixed32_le((uint8_t*)offset_ptr);
318
90.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
90.7k
            dict_word_info[i].data = data_begin + offset;
325
90.7k
            offset_ptr += sizeof(uint32_t);
326
90.7k
        }
327
328
90.7k
        for (int i = 0; i < (int)_num_elems - 1; ++i) {
329
86.7k
            dict_word_info[i].size =
330
86.7k
                    (char*)dict_word_info[i + 1].data - (char*)dict_word_info[i].data;
331
86.7k
        }
332
333
4.08k
        dict_word_info[_num_elems - 1].size =
334
4.08k
                (data_begin + _offsets_pos) - (char*)dict_word_info[_num_elems - 1].data;
335
4.08k
        return Status::OK();
336
4.08k
    }
_ZN5doris10segment_v222BinaryPlainPageDecoderILNS_9FieldTypeE17EE18get_dict_word_infoEPNS_9StringRefE
Line
Count
Source
308
648
    Status get_dict_word_info(StringRef* dict_word_info) override {
309
648
        if (UNLIKELY(_num_elems <= 0)) {
310
0
            return Status::OK();
311
0
        }
312
313
648
        char* data_begin = (char*)&_data[0];
314
648
        char* offset_ptr = (char*)&_data[_offsets_pos];
315
316
4.70k
        for (uint32_t i = 0; i < _num_elems; ++i) {
317
4.05k
            uint32_t offset = decode_fixed32_le((uint8_t*)offset_ptr);
318
4.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
4.05k
            dict_word_info[i].data = data_begin + offset;
325
4.05k
            offset_ptr += sizeof(uint32_t);
326
4.05k
        }
327
328
4.05k
        for (int i = 0; i < (int)_num_elems - 1; ++i) {
329
3.41k
            dict_word_info[i].size =
330
3.41k
                    (char*)dict_word_info[i + 1].data - (char*)dict_word_info[i].data;
331
3.41k
        }
332
333
648
        dict_word_info[_num_elems - 1].size =
334
648
                (data_begin + _offsets_pos) - (char*)dict_word_info[_num_elems - 1].data;
335
648
        return Status::OK();
336
648
    }
_ZN5doris10segment_v222BinaryPlainPageDecoderILNS_9FieldTypeE26EE18get_dict_word_infoEPNS_9StringRefE
Line
Count
Source
308
3.12k
    Status get_dict_word_info(StringRef* dict_word_info) override {
309
3.12k
        if (UNLIKELY(_num_elems <= 0)) {
310
2
            return Status::OK();
311
2
        }
312
313
3.11k
        char* data_begin = (char*)&_data[0];
314
3.11k
        char* offset_ptr = (char*)&_data[_offsets_pos];
315
316
77.9k
        for (uint32_t i = 0; i < _num_elems; ++i) {
317
74.8k
            uint32_t offset = decode_fixed32_le((uint8_t*)offset_ptr);
318
74.8k
            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.8k
            dict_word_info[i].data = data_begin + offset;
325
74.8k
            offset_ptr += sizeof(uint32_t);
326
74.8k
        }
327
328
74.8k
        for (int i = 0; i < (int)_num_elems - 1; ++i) {
329
71.7k
            dict_word_info[i].size =
330
71.7k
                    (char*)dict_word_info[i + 1].data - (char*)dict_word_info[i].data;
331
71.7k
        }
332
333
3.11k
        dict_word_info[_num_elems - 1].size =
334
3.11k
                (data_begin + _offsets_pos) - (char*)dict_word_info[_num_elems - 1].data;
335
3.11k
        return Status::OK();
336
3.11k
    }
_ZN5doris10segment_v222BinaryPlainPageDecoderILNS_9FieldTypeE13EE18get_dict_word_infoEPNS_9StringRefE
Line
Count
Source
308
28
    Status get_dict_word_info(StringRef* dict_word_info) override {
309
28
        if (UNLIKELY(_num_elems <= 0)) {
310
0
            return Status::OK();
311
0
        }
312
313
28
        char* data_begin = (char*)&_data[0];
314
28
        char* offset_ptr = (char*)&_data[_offsets_pos];
315
316
1.51k
        for (uint32_t i = 0; i < _num_elems; ++i) {
317
1.48k
            uint32_t offset = decode_fixed32_le((uint8_t*)offset_ptr);
318
1.48k
            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
1.48k
            dict_word_info[i].data = data_begin + offset;
325
1.48k
            offset_ptr += sizeof(uint32_t);
326
1.48k
        }
327
328
1.48k
        for (int i = 0; i < (int)_num_elems - 1; ++i) {
329
1.46k
            dict_word_info[i].size =
330
1.46k
                    (char*)dict_word_info[i + 1].data - (char*)dict_word_info[i].data;
331
1.46k
        }
332
333
28
        dict_word_info[_num_elems - 1].size =
334
28
                (data_begin + _offsets_pos) - (char*)dict_word_info[_num_elems - 1].data;
335
28
        return Status::OK();
336
28
    }
Unexecuted instantiation: _ZN5doris10segment_v222BinaryPlainPageDecoderILNS_9FieldTypeE36EE18get_dict_word_infoEPNS_9StringRefE
_ZN5doris10segment_v222BinaryPlainPageDecoderILNS_9FieldTypeE34EE18get_dict_word_infoEPNS_9StringRefE
Line
Count
Source
308
23
    Status get_dict_word_info(StringRef* dict_word_info) override {
309
23
        if (UNLIKELY(_num_elems <= 0)) {
310
0
            return Status::OK();
311
0
        }
312
313
23
        char* data_begin = (char*)&_data[0];
314
23
        char* offset_ptr = (char*)&_data[_offsets_pos];
315
316
10.1k
        for (uint32_t i = 0; i < _num_elems; ++i) {
317
10.1k
            uint32_t offset = decode_fixed32_le((uint8_t*)offset_ptr);
318
10.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
10.1k
            dict_word_info[i].data = data_begin + offset;
325
10.1k
            offset_ptr += sizeof(uint32_t);
326
10.1k
        }
327
328
10.1k
        for (int i = 0; i < (int)_num_elems - 1; ++i) {
329
10.1k
            dict_word_info[i].size =
330
10.1k
                    (char*)dict_word_info[i + 1].data - (char*)dict_word_info[i].data;
331
10.1k
        }
332
333
23
        dict_word_info[_num_elems - 1].size =
334
23
                (data_begin + _offsets_pos) - (char*)dict_word_info[_num_elems - 1].data;
335
23
        return Status::OK();
336
23
    }
_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
12.6k
    uint32_t offset(size_t idx) const {
342
12.6k
        if (idx >= _num_elems) {
343
2.81k
            return _offsets_pos;
344
2.81k
        }
345
9.84k
        return guarded_offset(idx);
346
12.6k
    }
_ZNK5doris10segment_v222BinaryPlainPageDecoderILNS_9FieldTypeE17EE6offsetEm
Line
Count
Source
341
7.67k
    uint32_t offset(size_t idx) const {
342
7.67k
        if (idx >= _num_elems) {
343
2.40k
            return _offsets_pos;
344
2.40k
        }
345
5.27k
        return guarded_offset(idx);
346
7.67k
    }
_ZNK5doris10segment_v222BinaryPlainPageDecoderILNS_9FieldTypeE26EE6offsetEm
Line
Count
Source
341
1.07k
    uint32_t offset(size_t idx) const {
342
1.07k
        if (idx >= _num_elems) {
343
81
            return _offsets_pos;
344
81
        }
345
989
        return guarded_offset(idx);
346
1.07k
    }
_ZNK5doris10segment_v222BinaryPlainPageDecoderILNS_9FieldTypeE13EE6offsetEm
Line
Count
Source
341
959
    uint32_t offset(size_t idx) const {
342
959
        if (idx >= _num_elems) {
343
48
            return _offsets_pos;
344
48
        }
345
911
        return guarded_offset(idx);
346
959
    }
_ZNK5doris10segment_v222BinaryPlainPageDecoderILNS_9FieldTypeE36EE6offsetEm
Line
Count
Source
341
1.00k
    uint32_t offset(size_t idx) const {
342
1.00k
        if (idx >= _num_elems) {
343
65
            return _offsets_pos;
344
65
        }
345
939
        return guarded_offset(idx);
346
1.00k
    }
_ZNK5doris10segment_v222BinaryPlainPageDecoderILNS_9FieldTypeE34EE6offsetEm
Line
Count
Source
341
940
    uint32_t offset(size_t idx) const {
342
940
        if (idx >= _num_elems) {
343
38
            return _offsets_pos;
344
38
        }
345
902
        return guarded_offset(idx);
346
940
    }
Unexecuted instantiation: _ZNK5doris10segment_v222BinaryPlainPageDecoderILNS_9FieldTypeE35EE6offsetEm
_ZNK5doris10segment_v222BinaryPlainPageDecoderILNS_9FieldTypeE23EE6offsetEm
Line
Count
Source
341
180
    uint32_t offset(size_t idx) const {
342
180
        if (idx >= _num_elems) {
343
30
            return _offsets_pos;
344
30
        }
345
150
        return guarded_offset(idx);
346
180
    }
_ZNK5doris10segment_v222BinaryPlainPageDecoderILNS_9FieldTypeE25EE6offsetEm
Line
Count
Source
341
332
    uint32_t offset(size_t idx) const {
342
332
        if (idx >= _num_elems) {
343
120
            return _offsets_pos;
344
120
        }
345
212
        return guarded_offset(idx);
346
332
    }
_ZNK5doris10segment_v222BinaryPlainPageDecoderILNS_9FieldTypeE27EE6offsetEm
Line
Count
Source
341
496
    uint32_t offset(size_t idx) const {
342
496
        if (idx >= _num_elems) {
343
28
            return _offsets_pos;
344
28
        }
345
468
        return guarded_offset(idx);
346
496
    }
347
348
470k
    uint32_t guarded_offset(size_t idx) const {
349
470k
        const auto* p =
350
470k
                reinterpret_cast<const uint8_t*>(&_data[_offsets_pos + idx * SIZE_OF_INT32]);
351
470k
        return decode_fixed32_le(p);
352
470k
    }
_ZNK5doris10segment_v222BinaryPlainPageDecoderILNS_9FieldTypeE17EE14guarded_offsetEm
Line
Count
Source
348
462k
    uint32_t guarded_offset(size_t idx) const {
349
462k
        const auto* p =
350
462k
                reinterpret_cast<const uint8_t*>(&_data[_offsets_pos + idx * SIZE_OF_INT32]);
351
462k
        return decode_fixed32_le(p);
352
462k
    }
_ZNK5doris10segment_v222BinaryPlainPageDecoderILNS_9FieldTypeE26EE14guarded_offsetEm
Line
Count
Source
348
1.70k
    uint32_t guarded_offset(size_t idx) const {
349
1.70k
        const auto* p =
350
1.70k
                reinterpret_cast<const uint8_t*>(&_data[_offsets_pos + idx * SIZE_OF_INT32]);
351
1.70k
        return decode_fixed32_le(p);
352
1.70k
    }
_ZNK5doris10segment_v222BinaryPlainPageDecoderILNS_9FieldTypeE13EE14guarded_offsetEm
Line
Count
Source
348
1.59k
    uint32_t guarded_offset(size_t idx) const {
349
1.59k
        const auto* p =
350
1.59k
                reinterpret_cast<const uint8_t*>(&_data[_offsets_pos + idx * SIZE_OF_INT32]);
351
1.59k
        return decode_fixed32_le(p);
352
1.59k
    }
_ZNK5doris10segment_v222BinaryPlainPageDecoderILNS_9FieldTypeE36EE14guarded_offsetEm
Line
Count
Source
348
1.66k
    uint32_t guarded_offset(size_t idx) const {
349
1.66k
        const auto* p =
350
1.66k
                reinterpret_cast<const uint8_t*>(&_data[_offsets_pos + idx * SIZE_OF_INT32]);
351
1.66k
        return decode_fixed32_le(p);
352
1.66k
    }
_ZNK5doris10segment_v222BinaryPlainPageDecoderILNS_9FieldTypeE34EE14guarded_offsetEm
Line
Count
Source
348
1.54k
    uint32_t guarded_offset(size_t idx) const {
349
1.54k
        const auto* p =
350
1.54k
                reinterpret_cast<const uint8_t*>(&_data[_offsets_pos + idx * SIZE_OF_INT32]);
351
1.54k
        return decode_fixed32_le(p);
352
1.54k
    }
Unexecuted instantiation: _ZNK5doris10segment_v222BinaryPlainPageDecoderILNS_9FieldTypeE35EE14guarded_offsetEm
_ZNK5doris10segment_v222BinaryPlainPageDecoderILNS_9FieldTypeE23EE14guarded_offsetEm
Line
Count
Source
348
270
    uint32_t guarded_offset(size_t idx) const {
349
270
        const auto* p =
350
270
                reinterpret_cast<const uint8_t*>(&_data[_offsets_pos + idx * SIZE_OF_INT32]);
351
270
        return decode_fixed32_le(p);
352
270
    }
_ZNK5doris10segment_v222BinaryPlainPageDecoderILNS_9FieldTypeE25EE14guarded_offsetEm
Line
Count
Source
348
504
    uint32_t guarded_offset(size_t idx) const {
349
504
        const auto* p =
350
504
                reinterpret_cast<const uint8_t*>(&_data[_offsets_pos + idx * SIZE_OF_INT32]);
351
504
        return decode_fixed32_le(p);
352
504
    }
_ZNK5doris10segment_v222BinaryPlainPageDecoderILNS_9FieldTypeE27EE14guarded_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
    }
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