Coverage Report

Created: 2026-09-14 18:17

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.5k
    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.90k
    Status init() override { return reset(); }
_ZN5doris10segment_v222BinaryPlainPageBuilderILNS_9FieldTypeE26EE4initEv
Line
Count
Source
50
75
    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
417k
            ret = _options.data_page_size != 0 && _size_estimate > _options.data_page_size;
59
417k
        }
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
356
    bool is_page_full() override {
53
356
        bool ret = false;
54
356
        if (_options.is_dict_page) {
55
            // dict_page_size is 0, do not limit the page size
56
0
            ret = _options.dict_page_size != 0 && _size_estimate > _options.dict_page_size;
57
356
        } else {
58
356
            ret = _options.data_page_size != 0 && _size_estimate > _options.data_page_size;
59
356
        }
60
356
        return ret;
61
356
    }
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.3k
    bool is_page_full() override {
53
65.3k
        bool ret = false;
54
65.3k
        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.3k
        } else {
58
65.3k
            ret = _options.data_page_size != 0 && _size_estimate > _options.data_page_size;
59
65.3k
        }
60
65.3k
        return ret;
61
65.3k
    }
_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
229k
    Status add(const uint8_t* vals, size_t* count) override {
64
229k
        DCHECK(!_finished);
65
229k
        DCHECK_GT(*count, 0);
66
229k
        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.8k
                if (_options.need_check_bitmap) {
73
125
                    RETURN_IF_ERROR(BitmapTypeCode::validate(*(src->data)));
74
125
                }
75
21.8k
            }
76
21.8k
            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
229k
        *count = i;
92
229k
        return Status::OK();
93
229k
    }
_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
246k
            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
246k
            size_t offset = _buffer.size();
77
246k
            _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
246k
            RETURN_IF_CATCH_EXCEPTION(_buffer.append(src->data, src->size));
81
82
246k
            _last_value_size = cast_set<uint32_t>(src->size);
83
246k
            _size_estimate += src->size;
84
246k
            _size_estimate += sizeof(uint32_t);
85
246k
            _raw_data_size += src->size;
86
87
246k
            i++;
88
246k
            vals += sizeof(Slice);
89
246k
        }
90
91
208k
        *count = i;
92
208k
        return Status::OK();
93
208k
    }
_ZN5doris10segment_v222BinaryPlainPageBuilderILNS_9FieldTypeE26EE3addEPKhPm
Line
Count
Source
63
75
    Status add(const uint8_t* vals, size_t* count) override {
64
75
        DCHECK(!_finished);
65
75
        DCHECK_GT(*count, 0);
66
75
        size_t i = 0;
67
68
        // If the page is full, should stop adding more items.
69
281
        while (!is_page_full() && i < *count) {
70
206
            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
206
            size_t offset = _buffer.size();
77
206
            _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
206
            RETURN_IF_CATCH_EXCEPTION(_buffer.append(src->data, src->size));
81
82
206
            _last_value_size = cast_set<uint32_t>(src->size);
83
206
            _size_estimate += src->size;
84
206
            _size_estimate += sizeof(uint32_t);
85
206
            _raw_data_size += src->size;
86
87
206
            i++;
88
206
            vals += sizeof(Slice);
89
206
        }
90
91
75
        *count = i;
92
75
        return Status::OK();
93
75
    }
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.7k
    Status add(const uint8_t* vals, size_t* count) override {
64
21.7k
        DCHECK(!_finished);
65
21.7k
        DCHECK_GT(*count, 0);
66
21.7k
        size_t i = 0;
67
68
        // If the page is full, should stop adding more items.
69
43.5k
        while (!is_page_full() && i < *count) {
70
21.8k
            const auto* src = reinterpret_cast<const Slice*>(vals);
71
21.8k
            if constexpr (Type == FieldType::OLAP_FIELD_TYPE_BITMAP) {
72
21.8k
                if (_options.need_check_bitmap) {
73
125
                    RETURN_IF_ERROR(BitmapTypeCode::validate(*(src->data)));
74
125
                }
75
21.8k
            }
76
21.8k
            size_t offset = _buffer.size();
77
21.8k
            _offsets.push_back(cast_set<uint32_t>(offset));
78
            // This may need a large memory, should return error if could not allocated
79
            // successfully, to avoid BE OOM.
80
21.8k
            RETURN_IF_CATCH_EXCEPTION(_buffer.append(src->data, src->size));
81
82
21.8k
            _last_value_size = cast_set<uint32_t>(src->size);
83
21.8k
            _size_estimate += src->size;
84
21.8k
            _size_estimate += sizeof(uint32_t);
85
21.8k
            _raw_data_size += src->size;
86
87
21.8k
            i++;
88
21.8k
            vals += sizeof(Slice);
89
21.8k
        }
90
91
21.7k
        *count = i;
92
21.7k
        return Status::OK();
93
21.7k
    }
_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.5k
    Status finish(OwnedSlice* slice) override {
96
26.5k
        DCHECK(!_finished);
97
26.5k
        _finished = true;
98
26.5k
        RETURN_IF_CATCH_EXCEPTION({
99
            // Set up trailer
100
26.5k
            for (uint32_t _offset : _offsets) {
101
26.5k
                put_fixed32_le(&_buffer, _offset);
102
26.5k
            }
103
26.5k
            put_fixed32_le(&_buffer, cast_set<uint32_t>(_offsets.size()));
104
26.5k
            *slice = _buffer.build();
105
26.5k
        });
106
26.5k
        return Status::OK();
107
26.5k
    }
_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.87k
    Status finish(OwnedSlice* slice) override {
96
8.87k
        DCHECK(!_finished);
97
8.87k
        _finished = true;
98
8.87k
        RETURN_IF_CATCH_EXCEPTION({
99
            // Set up trailer
100
8.87k
            for (uint32_t _offset : _offsets) {
101
8.87k
                put_fixed32_le(&_buffer, _offset);
102
8.87k
            }
103
8.87k
            put_fixed32_le(&_buffer, cast_set<uint32_t>(_offsets.size()));
104
8.87k
            *slice = _buffer.build();
105
8.87k
        });
106
8.87k
        return Status::OK();
107
8.87k
    }
_ZN5doris10segment_v222BinaryPlainPageBuilderILNS_9FieldTypeE26EE6finishEPNS_10OwnedSliceE
Line
Count
Source
95
75
    Status finish(OwnedSlice* slice) override {
96
75
        DCHECK(!_finished);
97
75
        _finished = true;
98
75
        RETURN_IF_CATCH_EXCEPTION({
99
            // Set up trailer
100
75
            for (uint32_t _offset : _offsets) {
101
75
                put_fixed32_le(&_buffer, _offset);
102
75
            }
103
75
            put_fixed32_le(&_buffer, cast_set<uint32_t>(_offsets.size()));
104
75
            *slice = _buffer.build();
105
75
        });
106
75
        return Status::OK();
107
75
    }
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.3k
    Status reset() override {
110
46.3k
        RETURN_IF_CATCH_EXCEPTION({
111
46.3k
            _offsets.clear();
112
46.3k
            _buffer.clear();
113
46.3k
            _buffer.reserve(_options.data_page_size == 0
114
46.3k
                                    ? 1024
115
46.3k
                                    : std::min(_options.data_page_size, _options.dict_page_size));
116
46.3k
            _size_estimate = sizeof(uint32_t);
117
46.3k
            _finished = false;
118
46.3k
            _last_value_size = 0;
119
46.3k
            _raw_data_size = 0;
120
46.3k
        });
121
46.3k
        return Status::OK();
122
46.3k
    }
_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
150
    Status reset() override {
110
150
        RETURN_IF_CATCH_EXCEPTION({
111
150
            _offsets.clear();
112
150
            _buffer.clear();
113
150
            _buffer.reserve(_options.data_page_size == 0
114
150
                                    ? 1024
115
150
                                    : std::min(_options.data_page_size, _options.dict_page_size));
116
150
            _size_estimate = sizeof(uint32_t);
117
150
            _finished = false;
118
150
            _last_value_size = 0;
119
150
            _raw_data_size = 0;
120
150
        });
121
150
        return Status::OK();
122
150
    }
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.0k
    Status reset() override {
110
35.0k
        RETURN_IF_CATCH_EXCEPTION({
111
35.0k
            _offsets.clear();
112
35.0k
            _buffer.clear();
113
35.0k
            _buffer.reserve(_options.data_page_size == 0
114
35.0k
                                    ? 1024
115
35.0k
                                    : std::min(_options.data_page_size, _options.dict_page_size));
116
35.0k
            _size_estimate = sizeof(uint32_t);
117
35.0k
            _finished = false;
118
35.0k
            _last_value_size = 0;
119
35.0k
            _raw_data_size = 0;
120
35.0k
        });
121
35.0k
        return Status::OK();
122
35.0k
    }
_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
17.9k
    size_t count() const override { return _offsets.size(); }
Unexecuted instantiation: _ZNK5doris10segment_v222BinaryPlainPageBuilderILNS_9FieldTypeE13EE5countEv
_ZNK5doris10segment_v222BinaryPlainPageBuilderILNS_9FieldTypeE17EE5countEv
Line
Count
Source
124
521
    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.4k
    size_t count() const override { return _offsets.size(); }
Unexecuted instantiation: _ZNK5doris10segment_v222BinaryPlainPageBuilderILNS_9FieldTypeE27EE5countEv
Unexecuted instantiation: _ZNK5doris10segment_v222BinaryPlainPageBuilderILNS_9FieldTypeE36EE5countEv
125
126
1.72k
    uint64_t size() const override { return _size_estimate; }
Unexecuted instantiation: _ZNK5doris10segment_v222BinaryPlainPageBuilderILNS_9FieldTypeE13EE4sizeEv
_ZNK5doris10segment_v222BinaryPlainPageBuilderILNS_9FieldTypeE17EE4sizeEv
Line
Count
Source
126
1.56k
    uint64_t size() const override { return _size_estimate; }
_ZNK5doris10segment_v222BinaryPlainPageBuilderILNS_9FieldTypeE26EE4sizeEv
Line
Count
Source
126
65
    uint64_t size() const override { return _size_estimate; }
Unexecuted instantiation: _ZNK5doris10segment_v222BinaryPlainPageBuilderILNS_9FieldTypeE34EE4sizeEv
Unexecuted instantiation: _ZNK5doris10segment_v222BinaryPlainPageBuilderILNS_9FieldTypeE35EE4sizeEv
_ZNK5doris10segment_v222BinaryPlainPageBuilderILNS_9FieldTypeE23EE4sizeEv
Line
Count
Source
126
8
    uint64_t size() const override { return _size_estimate; }
_ZNK5doris10segment_v222BinaryPlainPageBuilderILNS_9FieldTypeE25EE4sizeEv
Line
Count
Source
126
53
    uint64_t size() const override { return _size_estimate; }
_ZNK5doris10segment_v222BinaryPlainPageBuilderILNS_9FieldTypeE27EE4sizeEv
Line
Count
Source
126
8
    uint64_t size() const override { return _size_estimate; }
_ZNK5doris10segment_v222BinaryPlainPageBuilderILNS_9FieldTypeE36EE4sizeEv
Line
Count
Source
126
24
    uint64_t size() const override { return _size_estimate; }
127
128
212
    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
75
    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
57
    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.5k
            : _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.90k
            : _size_estimate(0), _options(options) {}
_ZN5doris10segment_v222BinaryPlainPageBuilderILNS_9FieldTypeE26EEC2ERKNS0_18PageBuilderOptionsE
Line
Count
Source
132
75
            : _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.51k
            : _data(data),
152
6.51k
              _options(options),
153
6.51k
              _parsed(false),
154
6.51k
              _num_elems(0),
155
6.51k
              _offsets_pos(0),
156
6.51k
              _cur_idx(0) {}
_ZN5doris10segment_v222BinaryPlainPageDecoderILNS_9FieldTypeE17EEC2ENS_5SliceERKNS0_18PageDecoderOptionsE
Line
Count
Source
151
2.94k
            : _data(data),
152
2.94k
              _options(options),
153
2.94k
              _parsed(false),
154
2.94k
              _num_elems(0),
155
2.94k
              _offsets_pos(0),
156
2.94k
              _cur_idx(0) {}
_ZN5doris10segment_v222BinaryPlainPageDecoderILNS_9FieldTypeE26EEC2ENS_5SliceERKNS0_18PageDecoderOptionsE
Line
Count
Source
151
3.18k
            : _data(data),
152
3.18k
              _options(options),
153
3.18k
              _parsed(false),
154
3.18k
              _num_elems(0),
155
3.18k
              _offsets_pos(0),
156
3.18k
              _cur_idx(0) {}
_ZN5doris10segment_v222BinaryPlainPageDecoderILNS_9FieldTypeE13EEC2ENS_5SliceERKNS0_18PageDecoderOptionsE
Line
Count
Source
151
29
            : _data(data),
152
29
              _options(options),
153
29
              _parsed(false),
154
29
              _num_elems(0),
155
29
              _offsets_pos(0),
156
29
              _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
247
            : _data(data),
152
247
              _options(options),
153
247
              _parsed(false),
154
247
              _num_elems(0),
155
247
              _offsets_pos(0),
156
247
              _cur_idx(0) {}
Unexecuted instantiation: _ZN5doris10segment_v222BinaryPlainPageDecoderILNS_9FieldTypeE23EEC2ENS_5SliceERKNS0_18PageDecoderOptionsE
_ZN5doris10segment_v222BinaryPlainPageDecoderILNS_9FieldTypeE25EEC2ENS_5SliceERKNS0_18PageDecoderOptionsE
Line
Count
Source
151
110
            : _data(data),
152
110
              _options(options),
153
110
              _parsed(false),
154
110
              _num_elems(0),
155
110
              _offsets_pos(0),
156
110
              _cur_idx(0) {}
Unexecuted instantiation: _ZN5doris10segment_v222BinaryPlainPageDecoderILNS_9FieldTypeE27EEC2ENS_5SliceERKNS0_18PageDecoderOptionsE
157
158
6.51k
    Status init() override {
159
6.51k
        CHECK(!_parsed);
160
161
6.51k
        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.51k
        _num_elems = decode_fixed32_le((const uint8_t*)&_data[_data.get_size() - sizeof(uint32_t)]);
170
6.51k
        _offsets_pos = cast_set<uint32_t>(_data.get_size() - ((_num_elems + 1) * sizeof(uint32_t)));
171
172
6.51k
        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.51k
        _parsed = true;
179
180
6.51k
        return Status::OK();
181
6.51k
    }
_ZN5doris10segment_v222BinaryPlainPageDecoderILNS_9FieldTypeE17EE4initEv
Line
Count
Source
158
2.94k
    Status init() override {
159
2.94k
        CHECK(!_parsed);
160
161
2.94k
        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.94k
        _num_elems = decode_fixed32_le((const uint8_t*)&_data[_data.get_size() - sizeof(uint32_t)]);
170
2.94k
        _offsets_pos = cast_set<uint32_t>(_data.get_size() - ((_num_elems + 1) * sizeof(uint32_t)));
171
172
2.94k
        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.94k
        _parsed = true;
179
180
2.94k
        return Status::OK();
181
2.94k
    }
_ZN5doris10segment_v222BinaryPlainPageDecoderILNS_9FieldTypeE26EE4initEv
Line
Count
Source
158
3.18k
    Status init() override {
159
3.18k
        CHECK(!_parsed);
160
161
3.18k
        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.18k
        _num_elems = decode_fixed32_le((const uint8_t*)&_data[_data.get_size() - sizeof(uint32_t)]);
170
3.18k
        _offsets_pos = cast_set<uint32_t>(_data.get_size() - ((_num_elems + 1) * sizeof(uint32_t)));
171
172
3.18k
        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.18k
        _parsed = true;
179
180
3.18k
        return Status::OK();
181
3.18k
    }
_ZN5doris10segment_v222BinaryPlainPageDecoderILNS_9FieldTypeE13EE4initEv
Line
Count
Source
158
29
    Status init() override {
159
29
        CHECK(!_parsed);
160
161
29
        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
29
        _num_elems = decode_fixed32_le((const uint8_t*)&_data[_data.get_size() - sizeof(uint32_t)]);
170
29
        _offsets_pos = cast_set<uint32_t>(_data.get_size() - ((_num_elems + 1) * sizeof(uint32_t)));
171
172
29
        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
29
        _parsed = true;
179
180
29
        return Status::OK();
181
29
    }
_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
247
    Status init() override {
159
247
        CHECK(!_parsed);
160
161
247
        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
247
        _num_elems = decode_fixed32_le((const uint8_t*)&_data[_data.get_size() - sizeof(uint32_t)]);
170
247
        _offsets_pos = cast_set<uint32_t>(_data.get_size() - ((_num_elems + 1) * sizeof(uint32_t)));
171
172
247
        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
247
        _parsed = true;
179
180
247
        return Status::OK();
181
247
    }
Unexecuted instantiation: _ZN5doris10segment_v222BinaryPlainPageDecoderILNS_9FieldTypeE23EE4initEv
_ZN5doris10segment_v222BinaryPlainPageDecoderILNS_9FieldTypeE25EE4initEv
Line
Count
Source
158
110
    Status init() override {
159
110
        CHECK(!_parsed);
160
161
110
        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
110
        _num_elems = decode_fixed32_le((const uint8_t*)&_data[_data.get_size() - sizeof(uint32_t)]);
170
110
        _offsets_pos = cast_set<uint32_t>(_data.get_size() - ((_num_elems + 1) * sizeof(uint32_t)));
171
172
110
        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
110
        _parsed = true;
179
180
110
        return Status::OK();
181
110
    }
Unexecuted instantiation: _ZN5doris10segment_v222BinaryPlainPageDecoderILNS_9FieldTypeE27EE4initEv
182
183
554
    Status seek_to_position_in_page(size_t pos) override {
184
554
        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
554
        DCHECK_LE(pos, _num_elems);
191
554
        _cur_idx = pos;
192
554
        return Status::OK();
193
554
    }
_ZN5doris10segment_v222BinaryPlainPageDecoderILNS_9FieldTypeE17EE24seek_to_position_in_pageEm
Line
Count
Source
183
410
    Status seek_to_position_in_page(size_t pos) override {
184
410
        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
410
        DCHECK_LE(pos, _num_elems);
191
410
        _cur_idx = pos;
192
410
        return Status::OK();
193
410
    }
_ZN5doris10segment_v222BinaryPlainPageDecoderILNS_9FieldTypeE26EE24seek_to_position_in_pageEm
Line
Count
Source
183
12
    Status seek_to_position_in_page(size_t pos) override {
184
12
        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
12
        DCHECK_LE(pos, _num_elems);
191
12
        _cur_idx = pos;
192
12
        return Status::OK();
193
12
    }
_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
128
    Status seek_to_position_in_page(size_t pos) override {
184
128
        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
128
        DCHECK_LE(pos, _num_elems);
191
128
        _cur_idx = pos;
192
128
        return Status::OK();
193
128
    }
Unexecuted instantiation: _ZN5doris10segment_v222BinaryPlainPageDecoderILNS_9FieldTypeE27EE24seek_to_position_in_pageEm
194
195
1.97k
    Status next_batch(size_t* n, MutableColumnPtr& dst) override {
196
1.97k
        DCHECK(_parsed);
197
1.97k
        if (*n == 0 || _cur_idx >= _num_elems) [[unlikely]] {
198
3
            *n = 0;
199
3
            return Status::OK();
200
3
        }
201
1.96k
        const size_t max_fetch = std::min(*n, static_cast<size_t>(_num_elems - _cur_idx));
202
203
1.96k
        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.96k
        uint32_t last_offset = guarded_offset(_cur_idx);
219
1.96k
        _offsets.resize(max_fetch + 1);
220
1.96k
        _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
19
                if (_options.need_check_bitmap) {
227
19
                    RETURN_IF_ERROR(BitmapTypeCode::validate(*(_data.data + start_offset)));
228
19
                }
229
19
            }
230
454k
        }
231
1.96k
        _cur_idx++;
232
1.96k
        _offsets[max_fetch] = offset(_cur_idx);
233
1.96k
        if constexpr (Type == FieldType::OLAP_FIELD_TYPE_BITMAP) {
234
138
            if (_options.need_check_bitmap) {
235
10
                RETURN_IF_ERROR(BitmapTypeCode::validate(*(_data.data + last_offset)));
236
10
            }
237
138
        }
238
138
        dst->insert_many_continuous_binary_data(_data.data, _offsets.data(), max_fetch);
239
240
1.96k
        *n = max_fetch;
241
1.96k
        return Status::OK();
242
1.96k
    }
_ZN5doris10segment_v222BinaryPlainPageDecoderILNS_9FieldTypeE17EE10next_batchEPmRNS_3COWINS_7IColumnEE11mutable_ptrIS6_EE
Line
Count
Source
195
1.79k
    Status next_batch(size_t* n, MutableColumnPtr& dst) override {
196
1.79k
        DCHECK(_parsed);
197
1.79k
        if (*n == 0 || _cur_idx >= _num_elems) [[unlikely]] {
198
2
            *n = 0;
199
2
            return Status::OK();
200
2
        }
201
1.79k
        const size_t max_fetch = std::min(*n, static_cast<size_t>(_num_elems - _cur_idx));
202
203
1.79k
        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.79k
        uint32_t last_offset = guarded_offset(_cur_idx);
219
1.79k
        _offsets.resize(max_fetch + 1);
220
1.79k
        _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.79k
        _cur_idx++;
232
1.79k
        _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.79k
        dst->insert_many_continuous_binary_data(_data.data, _offsets.data(), max_fetch);
239
240
1.79k
        *n = max_fetch;
241
1.79k
        return Status::OK();
242
1.79k
    }
_ZN5doris10segment_v222BinaryPlainPageDecoderILNS_9FieldTypeE26EE10next_batchEPmRNS_3COWINS_7IColumnEE11mutable_ptrIS6_EE
Line
Count
Source
195
26
    Status next_batch(size_t* n, MutableColumnPtr& dst) override {
196
26
        DCHECK(_parsed);
197
26
        if (*n == 0 || _cur_idx >= _num_elems) [[unlikely]] {
198
1
            *n = 0;
199
1
            return Status::OK();
200
1
        }
201
25
        const size_t max_fetch = std::min(*n, static_cast<size_t>(_num_elems - _cur_idx));
202
203
25
        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
25
        uint32_t last_offset = guarded_offset(_cur_idx);
219
25
        _offsets.resize(max_fetch + 1);
220
25
        _offsets[0] = last_offset;
221
70
        for (int i = 0; i < max_fetch - 1; i++, _cur_idx++) {
222
45
            const uint32_t start_offset = last_offset;
223
45
            last_offset = guarded_offset(_cur_idx + 1);
224
45
            _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
45
        }
231
25
        _cur_idx++;
232
25
        _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
25
        dst->insert_many_continuous_binary_data(_data.data, _offsets.data(), max_fetch);
239
240
25
        *n = max_fetch;
241
25
        return Status::OK();
242
25
    }
_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
138
    Status next_batch(size_t* n, MutableColumnPtr& dst) override {
196
138
        DCHECK(_parsed);
197
138
        if (*n == 0 || _cur_idx >= _num_elems) [[unlikely]] {
198
0
            *n = 0;
199
0
            return Status::OK();
200
0
        }
201
138
        const size_t max_fetch = std::min(*n, static_cast<size_t>(_num_elems - _cur_idx));
202
203
138
        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
138
        uint32_t last_offset = guarded_offset(_cur_idx);
219
138
        _offsets.resize(max_fetch + 1);
220
138
        _offsets[0] = last_offset;
221
157
        for (int i = 0; i < max_fetch - 1; i++, _cur_idx++) {
222
19
            const uint32_t start_offset = last_offset;
223
19
            last_offset = guarded_offset(_cur_idx + 1);
224
19
            _offsets[i + 1] = last_offset;
225
19
            if constexpr (Type == FieldType::OLAP_FIELD_TYPE_BITMAP) {
226
19
                if (_options.need_check_bitmap) {
227
19
                    RETURN_IF_ERROR(BitmapTypeCode::validate(*(_data.data + start_offset)));
228
19
                }
229
19
            }
230
19
        }
231
138
        _cur_idx++;
232
138
        _offsets[max_fetch] = offset(_cur_idx);
233
138
        if constexpr (Type == FieldType::OLAP_FIELD_TYPE_BITMAP) {
234
138
            if (_options.need_check_bitmap) {
235
10
                RETURN_IF_ERROR(BitmapTypeCode::validate(*(_data.data + last_offset)));
236
10
            }
237
138
        }
238
138
        dst->insert_many_continuous_binary_data(_data.data, _offsets.data(), max_fetch);
239
240
138
        *n = max_fetch;
241
138
        return Status::OK();
242
138
    }
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
578
                          MutableColumnPtr& dst) override {
246
578
        DCHECK(_parsed);
247
578
        if (*n == 0) [[unlikely]] {
248
0
            *n = 0;
249
0
            return Status::OK();
250
0
        }
251
252
578
        auto total = *n;
253
254
578
        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
578
        size_t read_count = 0;
277
578
        _binary_data.resize(total);
278
2.56k
        for (size_t i = 0; i < total; ++i) {
279
1.98k
            ordinal_t ord = rowids[i] - page_first_ordinal;
280
1.98k
            if (UNLIKELY(ord >= _num_elems)) {
281
0
                break;
282
0
            }
283
284
1.98k
            const uint32_t start_offset = offset(ord);
285
1.98k
            _binary_data[read_count].data = _data.mutable_data() + start_offset;
286
1.98k
            _binary_data[read_count].size = offset(ord + 1) - start_offset;
287
1.98k
            read_count++;
288
1.98k
        }
289
290
578
        if (LIKELY(read_count > 0)) {
291
578
            dst->insert_many_strings(_binary_data.data(), read_count);
292
578
        }
293
294
578
        *n = read_count;
295
578
        return Status::OK();
296
578
    }
_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
17
                          MutableColumnPtr& dst) override {
246
17
        DCHECK(_parsed);
247
17
        if (*n == 0) [[unlikely]] {
248
0
            *n = 0;
249
0
            return Status::OK();
250
0
        }
251
252
17
        auto total = *n;
253
254
17
        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
17
        size_t read_count = 0;
277
17
        _binary_data.resize(total);
278
45
        for (size_t i = 0; i < total; ++i) {
279
28
            ordinal_t ord = rowids[i] - page_first_ordinal;
280
28
            if (UNLIKELY(ord >= _num_elems)) {
281
0
                break;
282
0
            }
283
284
28
            const uint32_t start_offset = offset(ord);
285
28
            _binary_data[read_count].data = _data.mutable_data() + start_offset;
286
28
            _binary_data[read_count].size = offset(ord + 1) - start_offset;
287
28
            read_count++;
288
28
        }
289
290
17
        if (LIKELY(read_count > 0)) {
291
17
            dst->insert_many_strings(_binary_data.data(), read_count);
292
17
        }
293
294
17
        *n = read_count;
295
17
        return Status::OK();
296
17
    }
_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.19k
    size_t count() const override {
299
8.19k
        DCHECK(_parsed);
300
8.19k
        return _num_elems;
301
8.19k
    }
_ZNK5doris10segment_v222BinaryPlainPageDecoderILNS_9FieldTypeE17EE5countEv
Line
Count
Source
298
1.31k
    size_t count() const override {
299
        DCHECK(_parsed);
300
1.31k
        return _num_elems;
301
1.31k
    }
_ZNK5doris10segment_v222BinaryPlainPageDecoderILNS_9FieldTypeE26EE5countEv
Line
Count
Source
298
6.32k
    size_t count() const override {
299
        DCHECK(_parsed);
300
6.32k
        return _num_elems;
301
6.32k
    }
_ZNK5doris10segment_v222BinaryPlainPageDecoderILNS_9FieldTypeE13EE5countEv
Line
Count
Source
298
47
    size_t count() const override {
299
        DCHECK(_parsed);
300
47
        return _num_elems;
301
47
    }
_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
494
    size_t count() const override {
299
        DCHECK(_parsed);
300
494
        return _num_elems;
301
494
    }
Unexecuted instantiation: _ZNK5doris10segment_v222BinaryPlainPageDecoderILNS_9FieldTypeE23EE5countEv
Unexecuted instantiation: _ZNK5doris10segment_v222BinaryPlainPageDecoderILNS_9FieldTypeE25EE5countEv
Unexecuted instantiation: _ZNK5doris10segment_v222BinaryPlainPageDecoderILNS_9FieldTypeE27EE5countEv
302
303
399
    size_t current_index() const override {
304
399
        DCHECK(_parsed);
305
399
        return _cur_idx;
306
399
    }
_ZNK5doris10segment_v222BinaryPlainPageDecoderILNS_9FieldTypeE17EE13current_indexEv
Line
Count
Source
303
263
    size_t current_index() const override {
304
        DCHECK(_parsed);
305
263
        return _cur_idx;
306
263
    }
_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
128
    size_t current_index() const override {
304
        DCHECK(_parsed);
305
128
        return _cur_idx;
306
128
    }
Unexecuted instantiation: _ZNK5doris10segment_v222BinaryPlainPageDecoderILNS_9FieldTypeE27EE13current_indexEv
307
308
4.05k
    Status get_dict_word_info(StringRef* dict_word_info) override {
309
4.05k
        if (UNLIKELY(_num_elems <= 0)) {
310
2
            return Status::OK();
311
2
        }
312
313
4.05k
        char* data_begin = (char*)&_data[0];
314
4.05k
        char* offset_ptr = (char*)&_data[_offsets_pos];
315
316
80.8k
        for (uint32_t i = 0; i < _num_elems; ++i) {
317
76.8k
            uint32_t offset = decode_fixed32_le((uint8_t*)offset_ptr);
318
76.8k
            if (offset > _offsets_pos) {
319
0
                return Status::Corruption(
320
0
                        "file corruption: offsets pos beyonds data_size: {}, num_element: {}"
321
0
                        ", offset_pos: {}, offset: {}",
322
0
                        _data.size, _num_elems, _offsets_pos, offset);
323
0
            }
324
76.8k
            dict_word_info[i].data = data_begin + offset;
325
76.8k
            offset_ptr += sizeof(uint32_t);
326
76.8k
        }
327
328
76.8k
        for (int i = 0; i < (int)_num_elems - 1; ++i) {
329
72.7k
            dict_word_info[i].size =
330
72.7k
                    (char*)dict_word_info[i + 1].data - (char*)dict_word_info[i].data;
331
72.7k
        }
332
333
4.05k
        dict_word_info[_num_elems - 1].size =
334
4.05k
                (data_begin + _offsets_pos) - (char*)dict_word_info[_num_elems - 1].data;
335
4.05k
        return Status::OK();
336
4.05k
    }
_ZN5doris10segment_v222BinaryPlainPageDecoderILNS_9FieldTypeE17EE18get_dict_word_infoEPNS_9StringRefE
Line
Count
Source
308
642
    Status get_dict_word_info(StringRef* dict_word_info) override {
309
642
        if (UNLIKELY(_num_elems <= 0)) {
310
0
            return Status::OK();
311
0
        }
312
313
642
        char* data_begin = (char*)&_data[0];
314
642
        char* offset_ptr = (char*)&_data[_offsets_pos];
315
316
4.59k
        for (uint32_t i = 0; i < _num_elems; ++i) {
317
3.95k
            uint32_t offset = decode_fixed32_le((uint8_t*)offset_ptr);
318
3.95k
            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
3.95k
            dict_word_info[i].data = data_begin + offset;
325
3.95k
            offset_ptr += sizeof(uint32_t);
326
3.95k
        }
327
328
3.95k
        for (int i = 0; i < (int)_num_elems - 1; ++i) {
329
3.31k
            dict_word_info[i].size =
330
3.31k
                    (char*)dict_word_info[i + 1].data - (char*)dict_word_info[i].data;
331
3.31k
        }
332
333
642
        dict_word_info[_num_elems - 1].size =
334
642
                (data_begin + _offsets_pos) - (char*)dict_word_info[_num_elems - 1].data;
335
642
        return Status::OK();
336
642
    }
_ZN5doris10segment_v222BinaryPlainPageDecoderILNS_9FieldTypeE26EE18get_dict_word_infoEPNS_9StringRefE
Line
Count
Source
308
3.14k
    Status get_dict_word_info(StringRef* dict_word_info) override {
309
3.14k
        if (UNLIKELY(_num_elems <= 0)) {
310
1
            return Status::OK();
311
1
        }
312
313
3.14k
        char* data_begin = (char*)&_data[0];
314
3.14k
        char* offset_ptr = (char*)&_data[_offsets_pos];
315
316
75.6k
        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.14k
        dict_word_info[_num_elems - 1].size =
334
3.14k
                (data_begin + _offsets_pos) - (char*)dict_word_info[_num_elems - 1].data;
335
3.14k
        return Status::OK();
336
3.14k
    }
_ZN5doris10segment_v222BinaryPlainPageDecoderILNS_9FieldTypeE13EE18get_dict_word_infoEPNS_9StringRefE
Line
Count
Source
308
20
    Status get_dict_word_info(StringRef* dict_word_info) override {
309
20
        if (UNLIKELY(_num_elems <= 0)) {
310
0
            return Status::OK();
311
0
        }
312
313
20
        char* data_begin = (char*)&_data[0];
314
20
        char* offset_ptr = (char*)&_data[_offsets_pos];
315
316
80
        for (uint32_t i = 0; i < _num_elems; ++i) {
317
60
            uint32_t offset = decode_fixed32_le((uint8_t*)offset_ptr);
318
60
            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
60
            dict_word_info[i].data = data_begin + offset;
325
60
            offset_ptr += sizeof(uint32_t);
326
60
        }
327
328
60
        for (int i = 0; i < (int)_num_elems - 1; ++i) {
329
40
            dict_word_info[i].size =
330
40
                    (char*)dict_word_info[i + 1].data - (char*)dict_word_info[i].data;
331
40
        }
332
333
20
        dict_word_info[_num_elems - 1].size =
334
20
                (data_begin + _offsets_pos) - (char*)dict_word_info[_num_elems - 1].data;
335
20
        return Status::OK();
336
20
    }
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
247
    Status get_dict_word_info(StringRef* dict_word_info) override {
309
247
        if (UNLIKELY(_num_elems <= 0)) {
310
1
            return Status::OK();
311
1
        }
312
313
246
        char* data_begin = (char*)&_data[0];
314
246
        char* offset_ptr = (char*)&_data[_offsets_pos];
315
316
510
        for (uint32_t i = 0; i < _num_elems; ++i) {
317
264
            uint32_t offset = decode_fixed32_le((uint8_t*)offset_ptr);
318
264
            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
264
            dict_word_info[i].data = data_begin + offset;
325
264
            offset_ptr += sizeof(uint32_t);
326
264
        }
327
328
264
        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
246
        dict_word_info[_num_elems - 1].size =
334
246
                (data_begin + _offsets_pos) - (char*)dict_word_info[_num_elems - 1].data;
335
246
        return Status::OK();
336
246
    }
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
5.94k
    uint32_t offset(size_t idx) const {
342
5.94k
        if (idx >= _num_elems) {
343
2.41k
            return _offsets_pos;
344
2.41k
        }
345
3.52k
        return guarded_offset(idx);
346
5.94k
    }
_ZNK5doris10segment_v222BinaryPlainPageDecoderILNS_9FieldTypeE17EE6offsetEm
Line
Count
Source
341
5.69k
    uint32_t offset(size_t idx) const {
342
5.69k
        if (idx >= _num_elems) {
343
2.26k
            return _offsets_pos;
344
2.26k
        }
345
3.43k
        return guarded_offset(idx);
346
5.69k
    }
_ZNK5doris10segment_v222BinaryPlainPageDecoderILNS_9FieldTypeE26EE6offsetEm
Line
Count
Source
341
81
    uint32_t offset(size_t idx) const {
342
81
        if (idx >= _num_elems) {
343
32
            return _offsets_pos;
344
32
        }
345
49
        return guarded_offset(idx);
346
81
    }
_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
146
    uint32_t offset(size_t idx) const {
342
146
        if (idx >= _num_elems) {
343
110
            return _offsets_pos;
344
110
        }
345
36
        return guarded_offset(idx);
346
146
    }
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
119
    uint32_t guarded_offset(size_t idx) const {
349
119
        const auto* p =
350
119
                reinterpret_cast<const uint8_t*>(&_data[_offsets_pos + idx * SIZE_OF_INT32]);
351
119
        return decode_fixed32_le(p);
352
119
    }
_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
193
    uint32_t guarded_offset(size_t idx) const {
349
193
        const auto* p =
350
193
                reinterpret_cast<const uint8_t*>(&_data[_offsets_pos + idx * SIZE_OF_INT32]);
351
193
        return decode_fixed32_le(p);
352
193
    }
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