Coverage Report

Created: 2026-08-20 05:23

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