Coverage Report

Created: 2026-04-14 15:19

next uncovered line (L), next uncovered region (R), next uncovered branch (B)
be/src/exec/common/stringop_substring.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
#pragma once
19
20
#include <sys/types.h>
21
22
#include <algorithm>
23
#include <array>
24
#include <boost/iterator/iterator_facade.hpp>
25
#include <boost/locale.hpp>
26
#include <climits>
27
#include <cmath>
28
#include <cstddef>
29
#include <cstdlib>
30
#include <cstring>
31
#include <utility>
32
#include <vector>
33
34
#include "common/compiler_util.h" // IWYU pragma: keep
35
#include "core/block/block.h"
36
#include "core/block/column_numbers.h"
37
#include "core/block/column_with_type_and_name.h"
38
#include "core/column/column.h"
39
#include "core/column/column_const.h"
40
#include "core/column/column_vector.h"
41
#include "core/data_type/data_type.h"
42
#include "core/pod_array_fwd.h"
43
#include "core/types.h"
44
45
#ifndef USE_LIBCPP
46
#include <memory_resource>
47
732
#define PMR std::pmr
48
#else
49
#include <boost/container/pmr/monotonic_buffer_resource.hpp>
50
#include <boost/container/pmr/vector.hpp>
51
#define PMR boost::container::pmr
52
#endif
53
54
#include <fmt/format.h>
55
56
#include <cstdint>
57
#include <string_view>
58
59
#include "core/assert_cast.h"
60
#include "core/column/column_decimal.h"
61
#include "core/column/column_nullable.h"
62
#include "core/column/column_string.h"
63
#include "core/string_ref.h"
64
#include "util/simd/vstring_function.h"
65
66
namespace doris {
67
struct StringOP {
68
    static void push_empty_string(size_t index, ColumnString::Chars& chars,
69
544k
                                  ColumnString::Offsets& offsets) {
70
544k
        offsets[index] = (ColumnString::Offset)chars.size();
71
544k
    }
72
73
    static void push_null_string(size_t index, ColumnString::Chars& chars,
74
23.9k
                                 ColumnString::Offsets& offsets, NullMap& null_map) {
75
23.9k
        null_map[index] = 1;
76
23.9k
        push_empty_string(index, chars, offsets);
77
23.9k
    }
78
79
    static void push_value_string(const std::string_view& string_value, size_t index,
80
130k
                                  ColumnString::Chars& chars, ColumnString::Offsets& offsets) {
81
130k
        ColumnString::check_chars_length(chars.size() + string_value.size(), offsets.size());
82
83
130k
        chars.insert(string_value.data(), string_value.data() + string_value.size());
84
130k
        offsets[index] = (ColumnString::Offset)chars.size();
85
130k
    }
86
87
    static void push_value_string_reserved_and_allow_overflow(const std::string_view& string_value,
88
                                                              size_t index,
89
                                                              ColumnString::Chars& chars,
90
2.96M
                                                              ColumnString::Offsets& offsets) {
91
2.96M
        chars.insert_assume_reserved_and_allow_overflow(string_value.data(),
92
2.96M
                                                        string_value.data() + string_value.size());
93
2.96M
        offsets[index] = (ColumnString::Offset)chars.size();
94
2.96M
    }
95
96
    static void fast_repeat(uint8_t* dst, const uint8_t* src, size_t src_size,
97
2.53k
                            int32_t repeat_times) {
98
2.53k
        if (UNLIKELY(repeat_times <= 0)) {
99
73
            return;
100
73
        }
101
2.45k
        uint8_t* dst_begin = dst;
102
2.45k
        uint8_t* dst_curr = dst;
103
2.45k
        int32_t k = 0;
104
2.45k
        int32_t is_odd = repeat_times & 1;
105
2.45k
        repeat_times >>= 1;
106
107
2.45k
        memcpy(dst_curr, src, src_size);
108
2.45k
        dst_curr += src_size;
109
10.3k
        for (; repeat_times > 0; k += 1, is_odd = repeat_times & 1, repeat_times >>= 1) {
110
7.91k
            int64_t len = src_size * (1 << k);
111
7.91k
            memcpy(dst_curr, dst_begin, len);
112
7.91k
            dst_curr += len;
113
7.91k
            if (is_odd) {
114
5.80k
                memcpy(dst_curr, dst_begin, len);
115
5.80k
                dst_curr += len;
116
5.80k
            }
117
7.91k
        }
118
2.45k
    }
119
};
120
121
struct SubstringUtil {
122
    static constexpr auto name = "substring";
123
124
    static void substring_execute(Block& block, const ColumnNumbers& arguments, uint32_t result,
125
28.4k
                                  size_t input_rows_count) {
126
28.4k
        DCHECK_EQ(arguments.size(), 3);
127
28.4k
        auto res = ColumnString::create();
128
129
28.4k
        bool col_const[3];
130
28.4k
        ColumnPtr argument_columns[3];
131
113k
        for (int i = 0; i < 3; ++i) {
132
85.3k
            std::tie(argument_columns[i], col_const[i]) =
133
85.3k
                    unpack_if_const(block.get_by_position(arguments[i]).column);
134
85.3k
        }
135
136
28.4k
        const auto* specific_str_column =
137
28.4k
                assert_cast<const ColumnString*>(argument_columns[0].get());
138
28.4k
        const auto* specific_start_column =
139
28.4k
                assert_cast<const ColumnInt32*>(argument_columns[1].get());
140
28.4k
        const auto* specific_len_column =
141
28.4k
                assert_cast<const ColumnInt32*>(argument_columns[2].get());
142
143
28.4k
        bool is_ascii = specific_str_column->is_ascii();
144
145
28.4k
        std::visit(
146
28.4k
                [&](auto is_ascii, auto str_const, auto start_const, auto len_const) {
147
28.4k
                    vectors<is_ascii, str_const, start_const, len_const>(
148
28.4k
                            specific_str_column->get_chars(), specific_str_column->get_offsets(),
149
28.4k
                            specific_start_column->get_data(), specific_len_column->get_data(),
150
28.4k
                            res->get_chars(), res->get_offsets(), input_rows_count);
151
28.4k
                },
_ZZN5doris13SubstringUtil17substring_executeERNS_5BlockERKSt6vectorIjSaIjEEjmENKUlT_T0_T1_T2_E_clISt17integral_constantIbLb0EESF_SF_SF_EEDaS8_S9_SA_SB_
Line
Count
Source
146
86
                [&](auto is_ascii, auto str_const, auto start_const, auto len_const) {
147
86
                    vectors<is_ascii, str_const, start_const, len_const>(
148
86
                            specific_str_column->get_chars(), specific_str_column->get_offsets(),
149
86
                            specific_start_column->get_data(), specific_len_column->get_data(),
150
86
                            res->get_chars(), res->get_offsets(), input_rows_count);
151
86
                },
Unexecuted instantiation: _ZZN5doris13SubstringUtil17substring_executeERNS_5BlockERKSt6vectorIjSaIjEEjmENKUlT_T0_T1_T2_E_clISt17integral_constantIbLb1EESF_SF_SF_EEDaS8_S9_SA_SB_
_ZZN5doris13SubstringUtil17substring_executeERNS_5BlockERKSt6vectorIjSaIjEEjmENKUlT_T0_T1_T2_E_clISt17integral_constantIbLb1EESF_SF_SE_IbLb0EEEEDaS8_S9_SA_SB_
Line
Count
Source
146
128
                [&](auto is_ascii, auto str_const, auto start_const, auto len_const) {
147
128
                    vectors<is_ascii, str_const, start_const, len_const>(
148
128
                            specific_str_column->get_chars(), specific_str_column->get_offsets(),
149
128
                            specific_start_column->get_data(), specific_len_column->get_data(),
150
128
                            res->get_chars(), res->get_offsets(), input_rows_count);
151
128
                },
_ZZN5doris13SubstringUtil17substring_executeERNS_5BlockERKSt6vectorIjSaIjEEjmENKUlT_T0_T1_T2_E_clISt17integral_constantIbLb1EESF_SE_IbLb0EESF_EEDaS8_S9_SA_SB_
Line
Count
Source
146
128
                [&](auto is_ascii, auto str_const, auto start_const, auto len_const) {
147
128
                    vectors<is_ascii, str_const, start_const, len_const>(
148
128
                            specific_str_column->get_chars(), specific_str_column->get_offsets(),
149
128
                            specific_start_column->get_data(), specific_len_column->get_data(),
150
128
                            res->get_chars(), res->get_offsets(), input_rows_count);
151
128
                },
_ZZN5doris13SubstringUtil17substring_executeERNS_5BlockERKSt6vectorIjSaIjEEjmENKUlT_T0_T1_T2_E_clISt17integral_constantIbLb1EESF_SE_IbLb0EESG_EEDaS8_S9_SA_SB_
Line
Count
Source
146
161
                [&](auto is_ascii, auto str_const, auto start_const, auto len_const) {
147
161
                    vectors<is_ascii, str_const, start_const, len_const>(
148
161
                            specific_str_column->get_chars(), specific_str_column->get_offsets(),
149
161
                            specific_start_column->get_data(), specific_len_column->get_data(),
150
161
                            res->get_chars(), res->get_offsets(), input_rows_count);
151
161
                },
_ZZN5doris13SubstringUtil17substring_executeERNS_5BlockERKSt6vectorIjSaIjEEjmENKUlT_T0_T1_T2_E_clISt17integral_constantIbLb1EESE_IbLb0EESF_SF_EEDaS8_S9_SA_SB_
Line
Count
Source
146
26.7k
                [&](auto is_ascii, auto str_const, auto start_const, auto len_const) {
147
26.7k
                    vectors<is_ascii, str_const, start_const, len_const>(
148
26.7k
                            specific_str_column->get_chars(), specific_str_column->get_offsets(),
149
26.7k
                            specific_start_column->get_data(), specific_len_column->get_data(),
150
26.7k
                            res->get_chars(), res->get_offsets(), input_rows_count);
151
26.7k
                },
_ZZN5doris13SubstringUtil17substring_executeERNS_5BlockERKSt6vectorIjSaIjEEjmENKUlT_T0_T1_T2_E_clISt17integral_constantIbLb1EESE_IbLb0EESF_SG_EEDaS8_S9_SA_SB_
Line
Count
Source
146
146
                [&](auto is_ascii, auto str_const, auto start_const, auto len_const) {
147
146
                    vectors<is_ascii, str_const, start_const, len_const>(
148
146
                            specific_str_column->get_chars(), specific_str_column->get_offsets(),
149
146
                            specific_start_column->get_data(), specific_len_column->get_data(),
150
146
                            res->get_chars(), res->get_offsets(), input_rows_count);
151
146
                },
_ZZN5doris13SubstringUtil17substring_executeERNS_5BlockERKSt6vectorIjSaIjEEjmENKUlT_T0_T1_T2_E_clISt17integral_constantIbLb1EESE_IbLb0EESG_SF_EEDaS8_S9_SA_SB_
Line
Count
Source
146
160
                [&](auto is_ascii, auto str_const, auto start_const, auto len_const) {
147
160
                    vectors<is_ascii, str_const, start_const, len_const>(
148
160
                            specific_str_column->get_chars(), specific_str_column->get_offsets(),
149
160
                            specific_start_column->get_data(), specific_len_column->get_data(),
150
160
                            res->get_chars(), res->get_offsets(), input_rows_count);
151
160
                },
_ZZN5doris13SubstringUtil17substring_executeERNS_5BlockERKSt6vectorIjSaIjEEjmENKUlT_T0_T1_T2_E_clISt17integral_constantIbLb1EESE_IbLb0EESG_SG_EEDaS8_S9_SA_SB_
Line
Count
Source
146
577
                [&](auto is_ascii, auto str_const, auto start_const, auto len_const) {
147
577
                    vectors<is_ascii, str_const, start_const, len_const>(
148
577
                            specific_str_column->get_chars(), specific_str_column->get_offsets(),
149
577
                            specific_start_column->get_data(), specific_len_column->get_data(),
150
577
                            res->get_chars(), res->get_offsets(), input_rows_count);
151
577
                },
Unexecuted instantiation: _ZZN5doris13SubstringUtil17substring_executeERNS_5BlockERKSt6vectorIjSaIjEEjmENKUlT_T0_T1_T2_E_clISt17integral_constantIbLb0EESE_IbLb1EESG_SG_EEDaS8_S9_SA_SB_
_ZZN5doris13SubstringUtil17substring_executeERNS_5BlockERKSt6vectorIjSaIjEEjmENKUlT_T0_T1_T2_E_clISt17integral_constantIbLb0EESE_IbLb1EESG_SF_EEDaS8_S9_SA_SB_
Line
Count
Source
146
16
                [&](auto is_ascii, auto str_const, auto start_const, auto len_const) {
147
16
                    vectors<is_ascii, str_const, start_const, len_const>(
148
16
                            specific_str_column->get_chars(), specific_str_column->get_offsets(),
149
16
                            specific_start_column->get_data(), specific_len_column->get_data(),
150
16
                            res->get_chars(), res->get_offsets(), input_rows_count);
151
16
                },
_ZZN5doris13SubstringUtil17substring_executeERNS_5BlockERKSt6vectorIjSaIjEEjmENKUlT_T0_T1_T2_E_clISt17integral_constantIbLb0EESE_IbLb1EESF_SG_EEDaS8_S9_SA_SB_
Line
Count
Source
146
16
                [&](auto is_ascii, auto str_const, auto start_const, auto len_const) {
147
16
                    vectors<is_ascii, str_const, start_const, len_const>(
148
16
                            specific_str_column->get_chars(), specific_str_column->get_offsets(),
149
16
                            specific_start_column->get_data(), specific_len_column->get_data(),
150
16
                            res->get_chars(), res->get_offsets(), input_rows_count);
151
16
                },
_ZZN5doris13SubstringUtil17substring_executeERNS_5BlockERKSt6vectorIjSaIjEEjmENKUlT_T0_T1_T2_E_clISt17integral_constantIbLb0EESE_IbLb1EESF_SF_EEDaS8_S9_SA_SB_
Line
Count
Source
146
21
                [&](auto is_ascii, auto str_const, auto start_const, auto len_const) {
147
21
                    vectors<is_ascii, str_const, start_const, len_const>(
148
21
                            specific_str_column->get_chars(), specific_str_column->get_offsets(),
149
21
                            specific_start_column->get_data(), specific_len_column->get_data(),
150
21
                            res->get_chars(), res->get_offsets(), input_rows_count);
151
21
                },
_ZZN5doris13SubstringUtil17substring_executeERNS_5BlockERKSt6vectorIjSaIjEEjmENKUlT_T0_T1_T2_E_clISt17integral_constantIbLb0EESF_SE_IbLb1EESG_EEDaS8_S9_SA_SB_
Line
Count
Source
146
199
                [&](auto is_ascii, auto str_const, auto start_const, auto len_const) {
147
199
                    vectors<is_ascii, str_const, start_const, len_const>(
148
199
                            specific_str_column->get_chars(), specific_str_column->get_offsets(),
149
199
                            specific_start_column->get_data(), specific_len_column->get_data(),
150
199
                            res->get_chars(), res->get_offsets(), input_rows_count);
151
199
                },
_ZZN5doris13SubstringUtil17substring_executeERNS_5BlockERKSt6vectorIjSaIjEEjmENKUlT_T0_T1_T2_E_clISt17integral_constantIbLb0EESF_SE_IbLb1EESF_EEDaS8_S9_SA_SB_
Line
Count
Source
146
16
                [&](auto is_ascii, auto str_const, auto start_const, auto len_const) {
147
16
                    vectors<is_ascii, str_const, start_const, len_const>(
148
16
                            specific_str_column->get_chars(), specific_str_column->get_offsets(),
149
16
                            specific_start_column->get_data(), specific_len_column->get_data(),
150
16
                            res->get_chars(), res->get_offsets(), input_rows_count);
151
16
                },
_ZZN5doris13SubstringUtil17substring_executeERNS_5BlockERKSt6vectorIjSaIjEEjmENKUlT_T0_T1_T2_E_clISt17integral_constantIbLb0EESF_SF_SE_IbLb1EEEEDaS8_S9_SA_SB_
Line
Count
Source
146
16
                [&](auto is_ascii, auto str_const, auto start_const, auto len_const) {
147
16
                    vectors<is_ascii, str_const, start_const, len_const>(
148
16
                            specific_str_column->get_chars(), specific_str_column->get_offsets(),
149
16
                            specific_start_column->get_data(), specific_len_column->get_data(),
150
16
                            res->get_chars(), res->get_offsets(), input_rows_count);
151
16
                },
152
28.4k
                make_bool_variant(is_ascii), make_bool_variant(col_const[0]),
153
28.4k
                make_bool_variant(col_const[1]), make_bool_variant(col_const[2]));
154
28.4k
        block.get_by_position(result).column = std::move(res);
155
28.4k
    }
156
157
private:
158
    template <bool is_ascii, bool str_const, bool start_const, bool len_const>
159
    static void vectors(const ColumnString::Chars& chars, const ColumnString::Offsets& offsets,
160
                        const PaddedPODArray<Int32>& start, const PaddedPODArray<Int32>& len,
161
                        ColumnString::Chars& res_chars, ColumnString::Offsets& res_offsets,
162
28.4k
                        size_t size) {
163
28.4k
        res_offsets.resize(size);
164
165
28.4k
        if constexpr (start_const && len_const) {
166
26.9k
            if (start[0] == 0 || len[0] <= 0) {
167
74
                for (size_t i = 0; i < size; ++i) {
168
37
                    StringOP::push_empty_string(i, res_chars, res_offsets);
169
37
                }
170
37
                return;
171
37
            }
172
26.9k
        }
173
174
26.9k
        if constexpr (str_const) {
175
470
            res_chars.reserve(size * chars.size());
176
27.9k
        } else {
177
27.9k
            res_chars.reserve(chars.size());
178
27.9k
        }
179
180
28.4k
        if constexpr (is_ascii) {
181
28.0k
            vectors_ascii<str_const, start_const, len_const>(chars, offsets, start, len, res_chars,
182
28.0k
                                                             res_offsets, size);
183
28.0k
        } else {
184
370
            vectors_utf8<str_const, start_const, len_const>(chars, offsets, start, len, res_chars,
185
370
                                                            res_offsets, size);
186
370
        }
187
28.4k
    }
_ZN5doris13SubstringUtil7vectorsILb0ELb0ELb0ELb0EEEvRKNS_8PODArrayIhLm4096ENS_9AllocatorILb0ELb0ELb0ENS_22DefaultMemoryAllocatorELb1EEELm16ELm15EEERKNS2_IjLm4096ES5_Lm16ELm15EEERKNS2_IiLm4096ES5_Lm16ELm15EEESE_RS6_RS9_m
Line
Count
Source
162
86
                        size_t size) {
163
86
        res_offsets.resize(size);
164
165
        if constexpr (start_const && len_const) {
166
            if (start[0] == 0 || len[0] <= 0) {
167
                for (size_t i = 0; i < size; ++i) {
168
                    StringOP::push_empty_string(i, res_chars, res_offsets);
169
                }
170
                return;
171
            }
172
        }
173
174
        if constexpr (str_const) {
175
            res_chars.reserve(size * chars.size());
176
86
        } else {
177
86
            res_chars.reserve(chars.size());
178
86
        }
179
180
        if constexpr (is_ascii) {
181
            vectors_ascii<str_const, start_const, len_const>(chars, offsets, start, len, res_chars,
182
                                                             res_offsets, size);
183
86
        } else {
184
86
            vectors_utf8<str_const, start_const, len_const>(chars, offsets, start, len, res_chars,
185
86
                                                            res_offsets, size);
186
86
        }
187
86
    }
Unexecuted instantiation: _ZN5doris13SubstringUtil7vectorsILb1ELb1ELb1ELb1EEEvRKNS_8PODArrayIhLm4096ENS_9AllocatorILb0ELb0ELb0ENS_22DefaultMemoryAllocatorELb1EEELm16ELm15EEERKNS2_IjLm4096ES5_Lm16ELm15EEERKNS2_IiLm4096ES5_Lm16ELm15EEESE_RS6_RS9_m
_ZN5doris13SubstringUtil7vectorsILb1ELb1ELb1ELb0EEEvRKNS_8PODArrayIhLm4096ENS_9AllocatorILb0ELb0ELb0ENS_22DefaultMemoryAllocatorELb1EEELm16ELm15EEERKNS2_IjLm4096ES5_Lm16ELm15EEERKNS2_IiLm4096ES5_Lm16ELm15EEESE_RS6_RS9_m
Line
Count
Source
162
128
                        size_t size) {
163
128
        res_offsets.resize(size);
164
165
        if constexpr (start_const && len_const) {
166
            if (start[0] == 0 || len[0] <= 0) {
167
                for (size_t i = 0; i < size; ++i) {
168
                    StringOP::push_empty_string(i, res_chars, res_offsets);
169
                }
170
                return;
171
            }
172
        }
173
174
128
        if constexpr (str_const) {
175
128
            res_chars.reserve(size * chars.size());
176
        } else {
177
            res_chars.reserve(chars.size());
178
        }
179
180
128
        if constexpr (is_ascii) {
181
128
            vectors_ascii<str_const, start_const, len_const>(chars, offsets, start, len, res_chars,
182
128
                                                             res_offsets, size);
183
        } else {
184
            vectors_utf8<str_const, start_const, len_const>(chars, offsets, start, len, res_chars,
185
                                                            res_offsets, size);
186
        }
187
128
    }
_ZN5doris13SubstringUtil7vectorsILb1ELb1ELb0ELb1EEEvRKNS_8PODArrayIhLm4096ENS_9AllocatorILb0ELb0ELb0ENS_22DefaultMemoryAllocatorELb1EEELm16ELm15EEERKNS2_IjLm4096ES5_Lm16ELm15EEERKNS2_IiLm4096ES5_Lm16ELm15EEESE_RS6_RS9_m
Line
Count
Source
162
128
                        size_t size) {
163
128
        res_offsets.resize(size);
164
165
        if constexpr (start_const && len_const) {
166
            if (start[0] == 0 || len[0] <= 0) {
167
                for (size_t i = 0; i < size; ++i) {
168
                    StringOP::push_empty_string(i, res_chars, res_offsets);
169
                }
170
                return;
171
            }
172
        }
173
174
128
        if constexpr (str_const) {
175
128
            res_chars.reserve(size * chars.size());
176
        } else {
177
            res_chars.reserve(chars.size());
178
        }
179
180
128
        if constexpr (is_ascii) {
181
128
            vectors_ascii<str_const, start_const, len_const>(chars, offsets, start, len, res_chars,
182
128
                                                             res_offsets, size);
183
        } else {
184
            vectors_utf8<str_const, start_const, len_const>(chars, offsets, start, len, res_chars,
185
                                                            res_offsets, size);
186
        }
187
128
    }
_ZN5doris13SubstringUtil7vectorsILb1ELb1ELb0ELb0EEEvRKNS_8PODArrayIhLm4096ENS_9AllocatorILb0ELb0ELb0ENS_22DefaultMemoryAllocatorELb1EEELm16ELm15EEERKNS2_IjLm4096ES5_Lm16ELm15EEERKNS2_IiLm4096ES5_Lm16ELm15EEESE_RS6_RS9_m
Line
Count
Source
162
161
                        size_t size) {
163
161
        res_offsets.resize(size);
164
165
        if constexpr (start_const && len_const) {
166
            if (start[0] == 0 || len[0] <= 0) {
167
                for (size_t i = 0; i < size; ++i) {
168
                    StringOP::push_empty_string(i, res_chars, res_offsets);
169
                }
170
                return;
171
            }
172
        }
173
174
161
        if constexpr (str_const) {
175
161
            res_chars.reserve(size * chars.size());
176
        } else {
177
            res_chars.reserve(chars.size());
178
        }
179
180
161
        if constexpr (is_ascii) {
181
161
            vectors_ascii<str_const, start_const, len_const>(chars, offsets, start, len, res_chars,
182
161
                                                             res_offsets, size);
183
        } else {
184
            vectors_utf8<str_const, start_const, len_const>(chars, offsets, start, len, res_chars,
185
                                                            res_offsets, size);
186
        }
187
161
    }
_ZN5doris13SubstringUtil7vectorsILb1ELb0ELb1ELb1EEEvRKNS_8PODArrayIhLm4096ENS_9AllocatorILb0ELb0ELb0ENS_22DefaultMemoryAllocatorELb1EEELm16ELm15EEERKNS2_IjLm4096ES5_Lm16ELm15EEERKNS2_IiLm4096ES5_Lm16ELm15EEESE_RS6_RS9_m
Line
Count
Source
162
26.7k
                        size_t size) {
163
26.7k
        res_offsets.resize(size);
164
165
26.7k
        if constexpr (start_const && len_const) {
166
26.7k
            if (start[0] == 0 || len[0] <= 0) {
167
66
                for (size_t i = 0; i < size; ++i) {
168
33
                    StringOP::push_empty_string(i, res_chars, res_offsets);
169
33
                }
170
33
                return;
171
33
            }
172
26.7k
        }
173
174
        if constexpr (str_const) {
175
            res_chars.reserve(size * chars.size());
176
26.7k
        } else {
177
26.7k
            res_chars.reserve(chars.size());
178
26.7k
        }
179
180
26.7k
        if constexpr (is_ascii) {
181
26.7k
            vectors_ascii<str_const, start_const, len_const>(chars, offsets, start, len, res_chars,
182
26.7k
                                                             res_offsets, size);
183
        } else {
184
            vectors_utf8<str_const, start_const, len_const>(chars, offsets, start, len, res_chars,
185
                                                            res_offsets, size);
186
        }
187
26.7k
    }
_ZN5doris13SubstringUtil7vectorsILb1ELb0ELb1ELb0EEEvRKNS_8PODArrayIhLm4096ENS_9AllocatorILb0ELb0ELb0ENS_22DefaultMemoryAllocatorELb1EEELm16ELm15EEERKNS2_IjLm4096ES5_Lm16ELm15EEERKNS2_IiLm4096ES5_Lm16ELm15EEESE_RS6_RS9_m
Line
Count
Source
162
146
                        size_t size) {
163
146
        res_offsets.resize(size);
164
165
        if constexpr (start_const && len_const) {
166
            if (start[0] == 0 || len[0] <= 0) {
167
                for (size_t i = 0; i < size; ++i) {
168
                    StringOP::push_empty_string(i, res_chars, res_offsets);
169
                }
170
                return;
171
            }
172
        }
173
174
        if constexpr (str_const) {
175
            res_chars.reserve(size * chars.size());
176
146
        } else {
177
146
            res_chars.reserve(chars.size());
178
146
        }
179
180
146
        if constexpr (is_ascii) {
181
146
            vectors_ascii<str_const, start_const, len_const>(chars, offsets, start, len, res_chars,
182
146
                                                             res_offsets, size);
183
        } else {
184
            vectors_utf8<str_const, start_const, len_const>(chars, offsets, start, len, res_chars,
185
                                                            res_offsets, size);
186
        }
187
146
    }
_ZN5doris13SubstringUtil7vectorsILb1ELb0ELb0ELb1EEEvRKNS_8PODArrayIhLm4096ENS_9AllocatorILb0ELb0ELb0ENS_22DefaultMemoryAllocatorELb1EEELm16ELm15EEERKNS2_IjLm4096ES5_Lm16ELm15EEERKNS2_IiLm4096ES5_Lm16ELm15EEESE_RS6_RS9_m
Line
Count
Source
162
160
                        size_t size) {
163
160
        res_offsets.resize(size);
164
165
        if constexpr (start_const && len_const) {
166
            if (start[0] == 0 || len[0] <= 0) {
167
                for (size_t i = 0; i < size; ++i) {
168
                    StringOP::push_empty_string(i, res_chars, res_offsets);
169
                }
170
                return;
171
            }
172
        }
173
174
        if constexpr (str_const) {
175
            res_chars.reserve(size * chars.size());
176
160
        } else {
177
160
            res_chars.reserve(chars.size());
178
160
        }
179
180
160
        if constexpr (is_ascii) {
181
160
            vectors_ascii<str_const, start_const, len_const>(chars, offsets, start, len, res_chars,
182
160
                                                             res_offsets, size);
183
        } else {
184
            vectors_utf8<str_const, start_const, len_const>(chars, offsets, start, len, res_chars,
185
                                                            res_offsets, size);
186
        }
187
160
    }
_ZN5doris13SubstringUtil7vectorsILb1ELb0ELb0ELb0EEEvRKNS_8PODArrayIhLm4096ENS_9AllocatorILb0ELb0ELb0ENS_22DefaultMemoryAllocatorELb1EEELm16ELm15EEERKNS2_IjLm4096ES5_Lm16ELm15EEERKNS2_IiLm4096ES5_Lm16ELm15EEESE_RS6_RS9_m
Line
Count
Source
162
577
                        size_t size) {
163
577
        res_offsets.resize(size);
164
165
        if constexpr (start_const && len_const) {
166
            if (start[0] == 0 || len[0] <= 0) {
167
                for (size_t i = 0; i < size; ++i) {
168
                    StringOP::push_empty_string(i, res_chars, res_offsets);
169
                }
170
                return;
171
            }
172
        }
173
174
        if constexpr (str_const) {
175
            res_chars.reserve(size * chars.size());
176
577
        } else {
177
577
            res_chars.reserve(chars.size());
178
577
        }
179
180
577
        if constexpr (is_ascii) {
181
577
            vectors_ascii<str_const, start_const, len_const>(chars, offsets, start, len, res_chars,
182
577
                                                             res_offsets, size);
183
        } else {
184
            vectors_utf8<str_const, start_const, len_const>(chars, offsets, start, len, res_chars,
185
                                                            res_offsets, size);
186
        }
187
577
    }
Unexecuted instantiation: _ZN5doris13SubstringUtil7vectorsILb0ELb1ELb1ELb1EEEvRKNS_8PODArrayIhLm4096ENS_9AllocatorILb0ELb0ELb0ENS_22DefaultMemoryAllocatorELb1EEELm16ELm15EEERKNS2_IjLm4096ES5_Lm16ELm15EEERKNS2_IiLm4096ES5_Lm16ELm15EEESE_RS6_RS9_m
_ZN5doris13SubstringUtil7vectorsILb0ELb1ELb1ELb0EEEvRKNS_8PODArrayIhLm4096ENS_9AllocatorILb0ELb0ELb0ENS_22DefaultMemoryAllocatorELb1EEELm16ELm15EEERKNS2_IjLm4096ES5_Lm16ELm15EEERKNS2_IiLm4096ES5_Lm16ELm15EEESE_RS6_RS9_m
Line
Count
Source
162
16
                        size_t size) {
163
16
        res_offsets.resize(size);
164
165
        if constexpr (start_const && len_const) {
166
            if (start[0] == 0 || len[0] <= 0) {
167
                for (size_t i = 0; i < size; ++i) {
168
                    StringOP::push_empty_string(i, res_chars, res_offsets);
169
                }
170
                return;
171
            }
172
        }
173
174
16
        if constexpr (str_const) {
175
16
            res_chars.reserve(size * chars.size());
176
        } else {
177
            res_chars.reserve(chars.size());
178
        }
179
180
        if constexpr (is_ascii) {
181
            vectors_ascii<str_const, start_const, len_const>(chars, offsets, start, len, res_chars,
182
                                                             res_offsets, size);
183
16
        } else {
184
16
            vectors_utf8<str_const, start_const, len_const>(chars, offsets, start, len, res_chars,
185
16
                                                            res_offsets, size);
186
16
        }
187
16
    }
_ZN5doris13SubstringUtil7vectorsILb0ELb1ELb0ELb1EEEvRKNS_8PODArrayIhLm4096ENS_9AllocatorILb0ELb0ELb0ENS_22DefaultMemoryAllocatorELb1EEELm16ELm15EEERKNS2_IjLm4096ES5_Lm16ELm15EEERKNS2_IiLm4096ES5_Lm16ELm15EEESE_RS6_RS9_m
Line
Count
Source
162
16
                        size_t size) {
163
16
        res_offsets.resize(size);
164
165
        if constexpr (start_const && len_const) {
166
            if (start[0] == 0 || len[0] <= 0) {
167
                for (size_t i = 0; i < size; ++i) {
168
                    StringOP::push_empty_string(i, res_chars, res_offsets);
169
                }
170
                return;
171
            }
172
        }
173
174
16
        if constexpr (str_const) {
175
16
            res_chars.reserve(size * chars.size());
176
        } else {
177
            res_chars.reserve(chars.size());
178
        }
179
180
        if constexpr (is_ascii) {
181
            vectors_ascii<str_const, start_const, len_const>(chars, offsets, start, len, res_chars,
182
                                                             res_offsets, size);
183
16
        } else {
184
16
            vectors_utf8<str_const, start_const, len_const>(chars, offsets, start, len, res_chars,
185
16
                                                            res_offsets, size);
186
16
        }
187
16
    }
_ZN5doris13SubstringUtil7vectorsILb0ELb1ELb0ELb0EEEvRKNS_8PODArrayIhLm4096ENS_9AllocatorILb0ELb0ELb0ENS_22DefaultMemoryAllocatorELb1EEELm16ELm15EEERKNS2_IjLm4096ES5_Lm16ELm15EEERKNS2_IiLm4096ES5_Lm16ELm15EEESE_RS6_RS9_m
Line
Count
Source
162
21
                        size_t size) {
163
21
        res_offsets.resize(size);
164
165
        if constexpr (start_const && len_const) {
166
            if (start[0] == 0 || len[0] <= 0) {
167
                for (size_t i = 0; i < size; ++i) {
168
                    StringOP::push_empty_string(i, res_chars, res_offsets);
169
                }
170
                return;
171
            }
172
        }
173
174
21
        if constexpr (str_const) {
175
21
            res_chars.reserve(size * chars.size());
176
        } else {
177
            res_chars.reserve(chars.size());
178
        }
179
180
        if constexpr (is_ascii) {
181
            vectors_ascii<str_const, start_const, len_const>(chars, offsets, start, len, res_chars,
182
                                                             res_offsets, size);
183
21
        } else {
184
21
            vectors_utf8<str_const, start_const, len_const>(chars, offsets, start, len, res_chars,
185
21
                                                            res_offsets, size);
186
21
        }
187
21
    }
_ZN5doris13SubstringUtil7vectorsILb0ELb0ELb1ELb1EEEvRKNS_8PODArrayIhLm4096ENS_9AllocatorILb0ELb0ELb0ENS_22DefaultMemoryAllocatorELb1EEELm16ELm15EEERKNS2_IjLm4096ES5_Lm16ELm15EEERKNS2_IiLm4096ES5_Lm16ELm15EEESE_RS6_RS9_m
Line
Count
Source
162
199
                        size_t size) {
163
199
        res_offsets.resize(size);
164
165
199
        if constexpr (start_const && len_const) {
166
199
            if (start[0] == 0 || len[0] <= 0) {
167
8
                for (size_t i = 0; i < size; ++i) {
168
4
                    StringOP::push_empty_string(i, res_chars, res_offsets);
169
4
                }
170
4
                return;
171
4
            }
172
199
        }
173
174
        if constexpr (str_const) {
175
            res_chars.reserve(size * chars.size());
176
199
        } else {
177
199
            res_chars.reserve(chars.size());
178
199
        }
179
180
        if constexpr (is_ascii) {
181
            vectors_ascii<str_const, start_const, len_const>(chars, offsets, start, len, res_chars,
182
                                                             res_offsets, size);
183
199
        } else {
184
199
            vectors_utf8<str_const, start_const, len_const>(chars, offsets, start, len, res_chars,
185
199
                                                            res_offsets, size);
186
199
        }
187
199
    }
_ZN5doris13SubstringUtil7vectorsILb0ELb0ELb1ELb0EEEvRKNS_8PODArrayIhLm4096ENS_9AllocatorILb0ELb0ELb0ENS_22DefaultMemoryAllocatorELb1EEELm16ELm15EEERKNS2_IjLm4096ES5_Lm16ELm15EEERKNS2_IiLm4096ES5_Lm16ELm15EEESE_RS6_RS9_m
Line
Count
Source
162
16
                        size_t size) {
163
16
        res_offsets.resize(size);
164
165
        if constexpr (start_const && len_const) {
166
            if (start[0] == 0 || len[0] <= 0) {
167
                for (size_t i = 0; i < size; ++i) {
168
                    StringOP::push_empty_string(i, res_chars, res_offsets);
169
                }
170
                return;
171
            }
172
        }
173
174
        if constexpr (str_const) {
175
            res_chars.reserve(size * chars.size());
176
16
        } else {
177
16
            res_chars.reserve(chars.size());
178
16
        }
179
180
        if constexpr (is_ascii) {
181
            vectors_ascii<str_const, start_const, len_const>(chars, offsets, start, len, res_chars,
182
                                                             res_offsets, size);
183
16
        } else {
184
16
            vectors_utf8<str_const, start_const, len_const>(chars, offsets, start, len, res_chars,
185
16
                                                            res_offsets, size);
186
16
        }
187
16
    }
_ZN5doris13SubstringUtil7vectorsILb0ELb0ELb0ELb1EEEvRKNS_8PODArrayIhLm4096ENS_9AllocatorILb0ELb0ELb0ENS_22DefaultMemoryAllocatorELb1EEELm16ELm15EEERKNS2_IjLm4096ES5_Lm16ELm15EEERKNS2_IiLm4096ES5_Lm16ELm15EEESE_RS6_RS9_m
Line
Count
Source
162
16
                        size_t size) {
163
16
        res_offsets.resize(size);
164
165
        if constexpr (start_const && len_const) {
166
            if (start[0] == 0 || len[0] <= 0) {
167
                for (size_t i = 0; i < size; ++i) {
168
                    StringOP::push_empty_string(i, res_chars, res_offsets);
169
                }
170
                return;
171
            }
172
        }
173
174
        if constexpr (str_const) {
175
            res_chars.reserve(size * chars.size());
176
16
        } else {
177
16
            res_chars.reserve(chars.size());
178
16
        }
179
180
        if constexpr (is_ascii) {
181
            vectors_ascii<str_const, start_const, len_const>(chars, offsets, start, len, res_chars,
182
                                                             res_offsets, size);
183
16
        } else {
184
16
            vectors_utf8<str_const, start_const, len_const>(chars, offsets, start, len, res_chars,
185
16
                                                            res_offsets, size);
186
16
        }
187
16
    }
188
189
    template <bool str_const, bool start_const, bool len_const>
190
    NO_SANITIZE_UNDEFINED static void vectors_utf8(
191
            const ColumnString::Chars& chars, const ColumnString::Offsets& offsets,
192
            const PaddedPODArray<Int32>& start, const PaddedPODArray<Int32>& len,
193
366
            ColumnString::Chars& res_chars, ColumnString::Offsets& res_offsets, size_t size) {
194
366
        std::array<std::byte, 128 * 1024> buf;
195
366
        PMR::monotonic_buffer_resource pool {buf.data(), buf.size()};
196
366
        PMR::vector<size_t> index {&pool};
197
198
15.5k
        for (size_t i = 0; i < size; ++i) {
199
15.1k
            int str_size = offsets[index_check_const<str_const>(i)] -
200
15.1k
                           offsets[index_check_const<str_const>(i) - 1];
201
15.1k
            const char* str_data =
202
15.1k
                    (char*)chars.data() + offsets[index_check_const<str_const>(i) - 1];
203
15.1k
            int start_value = start[index_check_const<start_const>(i)];
204
15.1k
            int len_value = len[index_check_const<len_const>(i)];
205
            // Unsigned numbers cannot be used here because start_value can be negative.
206
15.1k
            int char_len = simd::VStringFunctions::get_char_len(str_data, str_size);
207
            // return empty string if start > src.length
208
            // Here, start_value is compared against the length of the character.
209
15.1k
            if (start_value > char_len || str_size == 0 || start_value == 0 || len_value <= 0) {
210
1.66k
                StringOP::push_empty_string(i, res_chars, res_offsets);
211
1.66k
                continue;
212
1.66k
            }
213
214
13.4k
            size_t byte_pos = 0;
215
13.4k
            index.clear();
216
1.09M
            for (size_t j = 0, char_size = 0; j < str_size; j += char_size) {
217
1.08M
                char_size = get_utf8_byte_length(str_data[j]);
218
1.08M
                index.push_back(j);
219
                // index_size represents the number of characters from the beginning of the character to the current position.
220
                // So index.size() > start_value + len_value breaks because you don't need to get the characters after start + len characters.
221
1.08M
                if (start_value > 0 && index.size() > start_value + len_value) {
222
149
                    break;
223
149
                }
224
1.08M
            }
225
226
13.4k
            int64_t fixed_pos = start_value;
227
13.4k
            if (fixed_pos < -(int)index.size()) {
228
0
                StringOP::push_empty_string(i, res_chars, res_offsets);
229
0
                continue;
230
0
            }
231
13.4k
            if (fixed_pos < 0) {
232
98
                fixed_pos = index.size() + fixed_pos + 1;
233
98
            }
234
235
13.4k
            byte_pos = index[fixed_pos - 1];
236
13.4k
            size_t fixed_len = str_size - byte_pos;
237
13.4k
            if (fixed_pos + len_value <= index.size()) {
238
159
                fixed_len = index[fixed_pos + len_value - 1] - byte_pos;
239
159
            }
240
241
13.4k
            if (byte_pos <= str_size && fixed_len > 0) {
242
13.4k
                StringOP::push_value_string_reserved_and_allow_overflow(
243
13.4k
                        {str_data + byte_pos, fixed_len}, i, res_chars, res_offsets);
244
13.4k
            } else {
245
0
                StringOP::push_empty_string(i, res_chars, res_offsets);
246
0
            }
247
13.4k
        }
248
366
    }
_ZN5doris13SubstringUtil12vectors_utf8ILb0ELb0ELb0EEEvRKNS_8PODArrayIhLm4096ENS_9AllocatorILb0ELb0ELb0ENS_22DefaultMemoryAllocatorELb1EEELm16ELm15EEERKNS2_IjLm4096ES5_Lm16ELm15EEERKNS2_IiLm4096ES5_Lm16ELm15EEESE_RS6_RS9_m
Line
Count
Source
193
86
            ColumnString::Chars& res_chars, ColumnString::Offsets& res_offsets, size_t size) {
194
86
        std::array<std::byte, 128 * 1024> buf;
195
86
        PMR::monotonic_buffer_resource pool {buf.data(), buf.size()};
196
86
        PMR::vector<size_t> index {&pool};
197
198
446
        for (size_t i = 0; i < size; ++i) {
199
360
            int str_size = offsets[index_check_const<str_const>(i)] -
200
360
                           offsets[index_check_const<str_const>(i) - 1];
201
360
            const char* str_data =
202
360
                    (char*)chars.data() + offsets[index_check_const<str_const>(i) - 1];
203
360
            int start_value = start[index_check_const<start_const>(i)];
204
360
            int len_value = len[index_check_const<len_const>(i)];
205
            // Unsigned numbers cannot be used here because start_value can be negative.
206
360
            int char_len = simd::VStringFunctions::get_char_len(str_data, str_size);
207
            // return empty string if start > src.length
208
            // Here, start_value is compared against the length of the character.
209
360
            if (start_value > char_len || str_size == 0 || start_value == 0 || len_value <= 0) {
210
207
                StringOP::push_empty_string(i, res_chars, res_offsets);
211
207
                continue;
212
207
            }
213
214
153
            size_t byte_pos = 0;
215
153
            index.clear();
216
1.34k
            for (size_t j = 0, char_size = 0; j < str_size; j += char_size) {
217
1.22k
                char_size = get_utf8_byte_length(str_data[j]);
218
1.22k
                index.push_back(j);
219
                // index_size represents the number of characters from the beginning of the character to the current position.
220
                // So index.size() > start_value + len_value breaks because you don't need to get the characters after start + len characters.
221
1.22k
                if (start_value > 0 && index.size() > start_value + len_value) {
222
31
                    break;
223
31
                }
224
1.22k
            }
225
226
153
            int64_t fixed_pos = start_value;
227
153
            if (fixed_pos < -(int)index.size()) {
228
0
                StringOP::push_empty_string(i, res_chars, res_offsets);
229
0
                continue;
230
0
            }
231
153
            if (fixed_pos < 0) {
232
78
                fixed_pos = index.size() + fixed_pos + 1;
233
78
            }
234
235
153
            byte_pos = index[fixed_pos - 1];
236
153
            size_t fixed_len = str_size - byte_pos;
237
153
            if (fixed_pos + len_value <= index.size()) {
238
33
                fixed_len = index[fixed_pos + len_value - 1] - byte_pos;
239
33
            }
240
241
153
            if (byte_pos <= str_size && fixed_len > 0) {
242
153
                StringOP::push_value_string_reserved_and_allow_overflow(
243
153
                        {str_data + byte_pos, fixed_len}, i, res_chars, res_offsets);
244
153
            } else {
245
0
                StringOP::push_empty_string(i, res_chars, res_offsets);
246
0
            }
247
153
        }
248
86
    }
Unexecuted instantiation: _ZN5doris13SubstringUtil12vectors_utf8ILb1ELb1ELb1EEEvRKNS_8PODArrayIhLm4096ENS_9AllocatorILb0ELb0ELb0ENS_22DefaultMemoryAllocatorELb1EEELm16ELm15EEERKNS2_IjLm4096ES5_Lm16ELm15EEERKNS2_IiLm4096ES5_Lm16ELm15EEESE_RS6_RS9_m
_ZN5doris13SubstringUtil12vectors_utf8ILb1ELb1ELb0EEEvRKNS_8PODArrayIhLm4096ENS_9AllocatorILb0ELb0ELb0ENS_22DefaultMemoryAllocatorELb1EEELm16ELm15EEERKNS2_IjLm4096ES5_Lm16ELm15EEERKNS2_IiLm4096ES5_Lm16ELm15EEESE_RS6_RS9_m
Line
Count
Source
193
16
            ColumnString::Chars& res_chars, ColumnString::Offsets& res_offsets, size_t size) {
194
16
        std::array<std::byte, 128 * 1024> buf;
195
16
        PMR::monotonic_buffer_resource pool {buf.data(), buf.size()};
196
16
        PMR::vector<size_t> index {&pool};
197
198
32
        for (size_t i = 0; i < size; ++i) {
199
16
            int str_size = offsets[index_check_const<str_const>(i)] -
200
16
                           offsets[index_check_const<str_const>(i) - 1];
201
16
            const char* str_data =
202
16
                    (char*)chars.data() + offsets[index_check_const<str_const>(i) - 1];
203
16
            int start_value = start[index_check_const<start_const>(i)];
204
16
            int len_value = len[index_check_const<len_const>(i)];
205
            // Unsigned numbers cannot be used here because start_value can be negative.
206
16
            int char_len = simd::VStringFunctions::get_char_len(str_data, str_size);
207
            // return empty string if start > src.length
208
            // Here, start_value is compared against the length of the character.
209
16
            if (start_value > char_len || str_size == 0 || start_value == 0 || len_value <= 0) {
210
7
                StringOP::push_empty_string(i, res_chars, res_offsets);
211
7
                continue;
212
7
            }
213
214
9
            size_t byte_pos = 0;
215
9
            index.clear();
216
65
            for (size_t j = 0, char_size = 0; j < str_size; j += char_size) {
217
59
                char_size = get_utf8_byte_length(str_data[j]);
218
59
                index.push_back(j);
219
                // index_size represents the number of characters from the beginning of the character to the current position.
220
                // So index.size() > start_value + len_value breaks because you don't need to get the characters after start + len characters.
221
59
                if (start_value > 0 && index.size() > start_value + len_value) {
222
3
                    break;
223
3
                }
224
59
            }
225
226
9
            int64_t fixed_pos = start_value;
227
9
            if (fixed_pos < -(int)index.size()) {
228
0
                StringOP::push_empty_string(i, res_chars, res_offsets);
229
0
                continue;
230
0
            }
231
9
            if (fixed_pos < 0) {
232
3
                fixed_pos = index.size() + fixed_pos + 1;
233
3
            }
234
235
9
            byte_pos = index[fixed_pos - 1];
236
9
            size_t fixed_len = str_size - byte_pos;
237
9
            if (fixed_pos + len_value <= index.size()) {
238
3
                fixed_len = index[fixed_pos + len_value - 1] - byte_pos;
239
3
            }
240
241
9
            if (byte_pos <= str_size && fixed_len > 0) {
242
9
                StringOP::push_value_string_reserved_and_allow_overflow(
243
9
                        {str_data + byte_pos, fixed_len}, i, res_chars, res_offsets);
244
9
            } else {
245
0
                StringOP::push_empty_string(i, res_chars, res_offsets);
246
0
            }
247
9
        }
248
16
    }
_ZN5doris13SubstringUtil12vectors_utf8ILb1ELb0ELb1EEEvRKNS_8PODArrayIhLm4096ENS_9AllocatorILb0ELb0ELb0ENS_22DefaultMemoryAllocatorELb1EEELm16ELm15EEERKNS2_IjLm4096ES5_Lm16ELm15EEERKNS2_IiLm4096ES5_Lm16ELm15EEESE_RS6_RS9_m
Line
Count
Source
193
16
            ColumnString::Chars& res_chars, ColumnString::Offsets& res_offsets, size_t size) {
194
16
        std::array<std::byte, 128 * 1024> buf;
195
16
        PMR::monotonic_buffer_resource pool {buf.data(), buf.size()};
196
16
        PMR::vector<size_t> index {&pool};
197
198
32
        for (size_t i = 0; i < size; ++i) {
199
16
            int str_size = offsets[index_check_const<str_const>(i)] -
200
16
                           offsets[index_check_const<str_const>(i) - 1];
201
16
            const char* str_data =
202
16
                    (char*)chars.data() + offsets[index_check_const<str_const>(i) - 1];
203
16
            int start_value = start[index_check_const<start_const>(i)];
204
16
            int len_value = len[index_check_const<len_const>(i)];
205
            // Unsigned numbers cannot be used here because start_value can be negative.
206
16
            int char_len = simd::VStringFunctions::get_char_len(str_data, str_size);
207
            // return empty string if start > src.length
208
            // Here, start_value is compared against the length of the character.
209
16
            if (start_value > char_len || str_size == 0 || start_value == 0 || len_value <= 0) {
210
7
                StringOP::push_empty_string(i, res_chars, res_offsets);
211
7
                continue;
212
7
            }
213
214
9
            size_t byte_pos = 0;
215
9
            index.clear();
216
65
            for (size_t j = 0, char_size = 0; j < str_size; j += char_size) {
217
59
                char_size = get_utf8_byte_length(str_data[j]);
218
59
                index.push_back(j);
219
                // index_size represents the number of characters from the beginning of the character to the current position.
220
                // So index.size() > start_value + len_value breaks because you don't need to get the characters after start + len characters.
221
59
                if (start_value > 0 && index.size() > start_value + len_value) {
222
3
                    break;
223
3
                }
224
59
            }
225
226
9
            int64_t fixed_pos = start_value;
227
9
            if (fixed_pos < -(int)index.size()) {
228
0
                StringOP::push_empty_string(i, res_chars, res_offsets);
229
0
                continue;
230
0
            }
231
9
            if (fixed_pos < 0) {
232
3
                fixed_pos = index.size() + fixed_pos + 1;
233
3
            }
234
235
9
            byte_pos = index[fixed_pos - 1];
236
9
            size_t fixed_len = str_size - byte_pos;
237
9
            if (fixed_pos + len_value <= index.size()) {
238
3
                fixed_len = index[fixed_pos + len_value - 1] - byte_pos;
239
3
            }
240
241
9
            if (byte_pos <= str_size && fixed_len > 0) {
242
9
                StringOP::push_value_string_reserved_and_allow_overflow(
243
9
                        {str_data + byte_pos, fixed_len}, i, res_chars, res_offsets);
244
9
            } else {
245
0
                StringOP::push_empty_string(i, res_chars, res_offsets);
246
0
            }
247
9
        }
248
16
    }
_ZN5doris13SubstringUtil12vectors_utf8ILb1ELb0ELb0EEEvRKNS_8PODArrayIhLm4096ENS_9AllocatorILb0ELb0ELb0ENS_22DefaultMemoryAllocatorELb1EEELm16ELm15EEERKNS2_IjLm4096ES5_Lm16ELm15EEERKNS2_IiLm4096ES5_Lm16ELm15EEESE_RS6_RS9_m
Line
Count
Source
193
21
            ColumnString::Chars& res_chars, ColumnString::Offsets& res_offsets, size_t size) {
194
21
        std::array<std::byte, 128 * 1024> buf;
195
21
        PMR::monotonic_buffer_resource pool {buf.data(), buf.size()};
196
21
        PMR::vector<size_t> index {&pool};
197
198
42
        for (size_t i = 0; i < size; ++i) {
199
21
            int str_size = offsets[index_check_const<str_const>(i)] -
200
21
                           offsets[index_check_const<str_const>(i) - 1];
201
21
            const char* str_data =
202
21
                    (char*)chars.data() + offsets[index_check_const<str_const>(i) - 1];
203
21
            int start_value = start[index_check_const<start_const>(i)];
204
21
            int len_value = len[index_check_const<len_const>(i)];
205
            // Unsigned numbers cannot be used here because start_value can be negative.
206
21
            int char_len = simd::VStringFunctions::get_char_len(str_data, str_size);
207
            // return empty string if start > src.length
208
            // Here, start_value is compared against the length of the character.
209
21
            if (start_value > char_len || str_size == 0 || start_value == 0 || len_value <= 0) {
210
8
                StringOP::push_empty_string(i, res_chars, res_offsets);
211
8
                continue;
212
8
            }
213
214
13
            size_t byte_pos = 0;
215
13
            index.clear();
216
82
            for (size_t j = 0, char_size = 0; j < str_size; j += char_size) {
217
72
                char_size = get_utf8_byte_length(str_data[j]);
218
72
                index.push_back(j);
219
                // index_size represents the number of characters from the beginning of the character to the current position.
220
                // So index.size() > start_value + len_value breaks because you don't need to get the characters after start + len characters.
221
72
                if (start_value > 0 && index.size() > start_value + len_value) {
222
3
                    break;
223
3
                }
224
72
            }
225
226
13
            int64_t fixed_pos = start_value;
227
13
            if (fixed_pos < -(int)index.size()) {
228
0
                StringOP::push_empty_string(i, res_chars, res_offsets);
229
0
                continue;
230
0
            }
231
13
            if (fixed_pos < 0) {
232
5
                fixed_pos = index.size() + fixed_pos + 1;
233
5
            }
234
235
13
            byte_pos = index[fixed_pos - 1];
236
13
            size_t fixed_len = str_size - byte_pos;
237
13
            if (fixed_pos + len_value <= index.size()) {
238
3
                fixed_len = index[fixed_pos + len_value - 1] - byte_pos;
239
3
            }
240
241
13
            if (byte_pos <= str_size && fixed_len > 0) {
242
13
                StringOP::push_value_string_reserved_and_allow_overflow(
243
13
                        {str_data + byte_pos, fixed_len}, i, res_chars, res_offsets);
244
13
            } else {
245
0
                StringOP::push_empty_string(i, res_chars, res_offsets);
246
0
            }
247
13
        }
248
21
    }
_ZN5doris13SubstringUtil12vectors_utf8ILb0ELb1ELb1EEEvRKNS_8PODArrayIhLm4096ENS_9AllocatorILb0ELb0ELb0ENS_22DefaultMemoryAllocatorELb1EEELm16ELm15EEERKNS2_IjLm4096ES5_Lm16ELm15EEERKNS2_IiLm4096ES5_Lm16ELm15EEESE_RS6_RS9_m
Line
Count
Source
193
195
            ColumnString::Chars& res_chars, ColumnString::Offsets& res_offsets, size_t size) {
194
195
        std::array<std::byte, 128 * 1024> buf;
195
195
        PMR::monotonic_buffer_resource pool {buf.data(), buf.size()};
196
195
        PMR::vector<size_t> index {&pool};
197
198
14.9k
        for (size_t i = 0; i < size; ++i) {
199
14.7k
            int str_size = offsets[index_check_const<str_const>(i)] -
200
14.7k
                           offsets[index_check_const<str_const>(i) - 1];
201
14.7k
            const char* str_data =
202
14.7k
                    (char*)chars.data() + offsets[index_check_const<str_const>(i) - 1];
203
14.7k
            int start_value = start[index_check_const<start_const>(i)];
204
14.7k
            int len_value = len[index_check_const<len_const>(i)];
205
            // Unsigned numbers cannot be used here because start_value can be negative.
206
14.7k
            int char_len = simd::VStringFunctions::get_char_len(str_data, str_size);
207
            // return empty string if start > src.length
208
            // Here, start_value is compared against the length of the character.
209
14.7k
            if (start_value > char_len || str_size == 0 || start_value == 0 || len_value <= 0) {
210
1.42k
                StringOP::push_empty_string(i, res_chars, res_offsets);
211
1.42k
                continue;
212
1.42k
            }
213
214
13.2k
            size_t byte_pos = 0;
215
13.2k
            index.clear();
216
1.09M
            for (size_t j = 0, char_size = 0; j < str_size; j += char_size) {
217
1.08M
                char_size = get_utf8_byte_length(str_data[j]);
218
1.08M
                index.push_back(j);
219
                // index_size represents the number of characters from the beginning of the character to the current position.
220
                // So index.size() > start_value + len_value breaks because you don't need to get the characters after start + len characters.
221
1.08M
                if (start_value > 0 && index.size() > start_value + len_value) {
222
103
                    break;
223
103
                }
224
1.08M
            }
225
226
13.2k
            int64_t fixed_pos = start_value;
227
13.2k
            if (fixed_pos < -(int)index.size()) {
228
0
                StringOP::push_empty_string(i, res_chars, res_offsets);
229
0
                continue;
230
0
            }
231
13.2k
            if (fixed_pos < 0) {
232
3
                fixed_pos = index.size() + fixed_pos + 1;
233
3
            }
234
235
13.2k
            byte_pos = index[fixed_pos - 1];
236
13.2k
            size_t fixed_len = str_size - byte_pos;
237
13.2k
            if (fixed_pos + len_value <= index.size()) {
238
111
                fixed_len = index[fixed_pos + len_value - 1] - byte_pos;
239
111
            }
240
241
13.2k
            if (byte_pos <= str_size && fixed_len > 0) {
242
13.2k
                StringOP::push_value_string_reserved_and_allow_overflow(
243
13.2k
                        {str_data + byte_pos, fixed_len}, i, res_chars, res_offsets);
244
13.2k
            } else {
245
0
                StringOP::push_empty_string(i, res_chars, res_offsets);
246
0
            }
247
13.2k
        }
248
195
    }
_ZN5doris13SubstringUtil12vectors_utf8ILb0ELb1ELb0EEEvRKNS_8PODArrayIhLm4096ENS_9AllocatorILb0ELb0ELb0ENS_22DefaultMemoryAllocatorELb1EEELm16ELm15EEERKNS2_IjLm4096ES5_Lm16ELm15EEERKNS2_IiLm4096ES5_Lm16ELm15EEESE_RS6_RS9_m
Line
Count
Source
193
16
            ColumnString::Chars& res_chars, ColumnString::Offsets& res_offsets, size_t size) {
194
16
        std::array<std::byte, 128 * 1024> buf;
195
16
        PMR::monotonic_buffer_resource pool {buf.data(), buf.size()};
196
16
        PMR::vector<size_t> index {&pool};
197
198
32
        for (size_t i = 0; i < size; ++i) {
199
16
            int str_size = offsets[index_check_const<str_const>(i)] -
200
16
                           offsets[index_check_const<str_const>(i) - 1];
201
16
            const char* str_data =
202
16
                    (char*)chars.data() + offsets[index_check_const<str_const>(i) - 1];
203
16
            int start_value = start[index_check_const<start_const>(i)];
204
16
            int len_value = len[index_check_const<len_const>(i)];
205
            // Unsigned numbers cannot be used here because start_value can be negative.
206
16
            int char_len = simd::VStringFunctions::get_char_len(str_data, str_size);
207
            // return empty string if start > src.length
208
            // Here, start_value is compared against the length of the character.
209
16
            if (start_value > char_len || str_size == 0 || start_value == 0 || len_value <= 0) {
210
7
                StringOP::push_empty_string(i, res_chars, res_offsets);
211
7
                continue;
212
7
            }
213
214
9
            size_t byte_pos = 0;
215
9
            index.clear();
216
65
            for (size_t j = 0, char_size = 0; j < str_size; j += char_size) {
217
59
                char_size = get_utf8_byte_length(str_data[j]);
218
59
                index.push_back(j);
219
                // index_size represents the number of characters from the beginning of the character to the current position.
220
                // So index.size() > start_value + len_value breaks because you don't need to get the characters after start + len characters.
221
59
                if (start_value > 0 && index.size() > start_value + len_value) {
222
3
                    break;
223
3
                }
224
59
            }
225
226
9
            int64_t fixed_pos = start_value;
227
9
            if (fixed_pos < -(int)index.size()) {
228
0
                StringOP::push_empty_string(i, res_chars, res_offsets);
229
0
                continue;
230
0
            }
231
9
            if (fixed_pos < 0) {
232
3
                fixed_pos = index.size() + fixed_pos + 1;
233
3
            }
234
235
9
            byte_pos = index[fixed_pos - 1];
236
9
            size_t fixed_len = str_size - byte_pos;
237
9
            if (fixed_pos + len_value <= index.size()) {
238
3
                fixed_len = index[fixed_pos + len_value - 1] - byte_pos;
239
3
            }
240
241
9
            if (byte_pos <= str_size && fixed_len > 0) {
242
9
                StringOP::push_value_string_reserved_and_allow_overflow(
243
9
                        {str_data + byte_pos, fixed_len}, i, res_chars, res_offsets);
244
9
            } else {
245
0
                StringOP::push_empty_string(i, res_chars, res_offsets);
246
0
            }
247
9
        }
248
16
    }
_ZN5doris13SubstringUtil12vectors_utf8ILb0ELb0ELb1EEEvRKNS_8PODArrayIhLm4096ENS_9AllocatorILb0ELb0ELb0ENS_22DefaultMemoryAllocatorELb1EEELm16ELm15EEERKNS2_IjLm4096ES5_Lm16ELm15EEERKNS2_IiLm4096ES5_Lm16ELm15EEESE_RS6_RS9_m
Line
Count
Source
193
16
            ColumnString::Chars& res_chars, ColumnString::Offsets& res_offsets, size_t size) {
194
16
        std::array<std::byte, 128 * 1024> buf;
195
16
        PMR::monotonic_buffer_resource pool {buf.data(), buf.size()};
196
16
        PMR::vector<size_t> index {&pool};
197
198
32
        for (size_t i = 0; i < size; ++i) {
199
16
            int str_size = offsets[index_check_const<str_const>(i)] -
200
16
                           offsets[index_check_const<str_const>(i) - 1];
201
16
            const char* str_data =
202
16
                    (char*)chars.data() + offsets[index_check_const<str_const>(i) - 1];
203
16
            int start_value = start[index_check_const<start_const>(i)];
204
16
            int len_value = len[index_check_const<len_const>(i)];
205
            // Unsigned numbers cannot be used here because start_value can be negative.
206
16
            int char_len = simd::VStringFunctions::get_char_len(str_data, str_size);
207
            // return empty string if start > src.length
208
            // Here, start_value is compared against the length of the character.
209
16
            if (start_value > char_len || str_size == 0 || start_value == 0 || len_value <= 0) {
210
7
                StringOP::push_empty_string(i, res_chars, res_offsets);
211
7
                continue;
212
7
            }
213
214
9
            size_t byte_pos = 0;
215
9
            index.clear();
216
65
            for (size_t j = 0, char_size = 0; j < str_size; j += char_size) {
217
59
                char_size = get_utf8_byte_length(str_data[j]);
218
59
                index.push_back(j);
219
                // index_size represents the number of characters from the beginning of the character to the current position.
220
                // So index.size() > start_value + len_value breaks because you don't need to get the characters after start + len characters.
221
59
                if (start_value > 0 && index.size() > start_value + len_value) {
222
3
                    break;
223
3
                }
224
59
            }
225
226
9
            int64_t fixed_pos = start_value;
227
9
            if (fixed_pos < -(int)index.size()) {
228
0
                StringOP::push_empty_string(i, res_chars, res_offsets);
229
0
                continue;
230
0
            }
231
9
            if (fixed_pos < 0) {
232
3
                fixed_pos = index.size() + fixed_pos + 1;
233
3
            }
234
235
9
            byte_pos = index[fixed_pos - 1];
236
9
            size_t fixed_len = str_size - byte_pos;
237
9
            if (fixed_pos + len_value <= index.size()) {
238
3
                fixed_len = index[fixed_pos + len_value - 1] - byte_pos;
239
3
            }
240
241
9
            if (byte_pos <= str_size && fixed_len > 0) {
242
9
                StringOP::push_value_string_reserved_and_allow_overflow(
243
9
                        {str_data + byte_pos, fixed_len}, i, res_chars, res_offsets);
244
9
            } else {
245
0
                StringOP::push_empty_string(i, res_chars, res_offsets);
246
0
            }
247
9
        }
248
16
    }
249
250
    template <bool str_const, bool start_const, bool len_const>
251
    static void vectors_ascii(const ColumnString::Chars& chars,
252
                              const ColumnString::Offsets& offsets,
253
                              const PaddedPODArray<Int32>& start, const PaddedPODArray<Int32>& len,
254
                              ColumnString::Chars& res_chars, ColumnString::Offsets& res_offsets,
255
28.0k
                              size_t size) {
256
3.49M
        for (size_t i = 0; i < size; ++i) {
257
3.46M
            int str_size = offsets[index_check_const<str_const>(i)] -
258
3.46M
                           offsets[index_check_const<str_const>(i) - 1];
259
3.46M
            const char* str_data =
260
3.46M
                    (char*)chars.data() + offsets[index_check_const<str_const>(i) - 1];
261
3.46M
            int start_value = start[index_check_const<start_const>(i)];
262
3.46M
            int len_value = len[index_check_const<len_const>(i)];
263
264
3.46M
            if (start_value > str_size || start_value < -str_size || str_size == 0 ||
265
3.46M
                len_value <= 0) {
266
518k
                StringOP::push_empty_string(i, res_chars, res_offsets);
267
518k
                continue;
268
518k
            }
269
2.94M
            int fixed_pos = start_value - 1;
270
2.94M
            if (fixed_pos < 0) {
271
504
                fixed_pos = str_size + fixed_pos + 1;
272
504
            }
273
2.94M
            size_t fixed_len = std::min(str_size - fixed_pos, len_value);
274
2.94M
            StringOP::push_value_string_reserved_and_allow_overflow(
275
2.94M
                    {str_data + fixed_pos, fixed_len}, i, res_chars, res_offsets);
276
2.94M
        }
277
28.0k
    }
Unexecuted instantiation: _ZN5doris13SubstringUtil13vectors_asciiILb1ELb1ELb1EEEvRKNS_8PODArrayIhLm4096ENS_9AllocatorILb0ELb0ELb0ENS_22DefaultMemoryAllocatorELb1EEELm16ELm15EEERKNS2_IjLm4096ES5_Lm16ELm15EEERKNS2_IiLm4096ES5_Lm16ELm15EEESE_RS6_RS9_m
_ZN5doris13SubstringUtil13vectors_asciiILb1ELb1ELb0EEEvRKNS_8PODArrayIhLm4096ENS_9AllocatorILb0ELb0ELb0ENS_22DefaultMemoryAllocatorELb1EEELm16ELm15EEERKNS2_IjLm4096ES5_Lm16ELm15EEERKNS2_IiLm4096ES5_Lm16ELm15EEESE_RS6_RS9_m
Line
Count
Source
255
128
                              size_t size) {
256
256
        for (size_t i = 0; i < size; ++i) {
257
128
            int str_size = offsets[index_check_const<str_const>(i)] -
258
128
                           offsets[index_check_const<str_const>(i) - 1];
259
128
            const char* str_data =
260
128
                    (char*)chars.data() + offsets[index_check_const<str_const>(i) - 1];
261
128
            int start_value = start[index_check_const<start_const>(i)];
262
128
            int len_value = len[index_check_const<len_const>(i)];
263
264
128
            if (start_value > str_size || start_value < -str_size || str_size == 0 ||
265
128
                len_value <= 0) {
266
65
                StringOP::push_empty_string(i, res_chars, res_offsets);
267
65
                continue;
268
65
            }
269
63
            int fixed_pos = start_value - 1;
270
63
            if (fixed_pos < 0) {
271
21
                fixed_pos = str_size + fixed_pos + 1;
272
21
            }
273
63
            size_t fixed_len = std::min(str_size - fixed_pos, len_value);
274
63
            StringOP::push_value_string_reserved_and_allow_overflow(
275
63
                    {str_data + fixed_pos, fixed_len}, i, res_chars, res_offsets);
276
63
        }
277
128
    }
_ZN5doris13SubstringUtil13vectors_asciiILb1ELb0ELb1EEEvRKNS_8PODArrayIhLm4096ENS_9AllocatorILb0ELb0ELb0ENS_22DefaultMemoryAllocatorELb1EEELm16ELm15EEERKNS2_IjLm4096ES5_Lm16ELm15EEERKNS2_IiLm4096ES5_Lm16ELm15EEESE_RS6_RS9_m
Line
Count
Source
255
128
                              size_t size) {
256
256
        for (size_t i = 0; i < size; ++i) {
257
128
            int str_size = offsets[index_check_const<str_const>(i)] -
258
128
                           offsets[index_check_const<str_const>(i) - 1];
259
128
            const char* str_data =
260
128
                    (char*)chars.data() + offsets[index_check_const<str_const>(i) - 1];
261
128
            int start_value = start[index_check_const<start_const>(i)];
262
128
            int len_value = len[index_check_const<len_const>(i)];
263
264
128
            if (start_value > str_size || start_value < -str_size || str_size == 0 ||
265
128
                len_value <= 0) {
266
65
                StringOP::push_empty_string(i, res_chars, res_offsets);
267
65
                continue;
268
65
            }
269
63
            int fixed_pos = start_value - 1;
270
63
            if (fixed_pos < 0) {
271
21
                fixed_pos = str_size + fixed_pos + 1;
272
21
            }
273
63
            size_t fixed_len = std::min(str_size - fixed_pos, len_value);
274
63
            StringOP::push_value_string_reserved_and_allow_overflow(
275
63
                    {str_data + fixed_pos, fixed_len}, i, res_chars, res_offsets);
276
63
        }
277
128
    }
_ZN5doris13SubstringUtil13vectors_asciiILb1ELb0ELb0EEEvRKNS_8PODArrayIhLm4096ENS_9AllocatorILb0ELb0ELb0ENS_22DefaultMemoryAllocatorELb1EEELm16ELm15EEERKNS2_IjLm4096ES5_Lm16ELm15EEERKNS2_IiLm4096ES5_Lm16ELm15EEESE_RS6_RS9_m
Line
Count
Source
255
161
                              size_t size) {
256
322
        for (size_t i = 0; i < size; ++i) {
257
161
            int str_size = offsets[index_check_const<str_const>(i)] -
258
161
                           offsets[index_check_const<str_const>(i) - 1];
259
161
            const char* str_data =
260
161
                    (char*)chars.data() + offsets[index_check_const<str_const>(i) - 1];
261
161
            int start_value = start[index_check_const<start_const>(i)];
262
161
            int len_value = len[index_check_const<len_const>(i)];
263
264
161
            if (start_value > str_size || start_value < -str_size || str_size == 0 ||
265
161
                len_value <= 0) {
266
81
                StringOP::push_empty_string(i, res_chars, res_offsets);
267
81
                continue;
268
81
            }
269
80
            int fixed_pos = start_value - 1;
270
80
            if (fixed_pos < 0) {
271
31
                fixed_pos = str_size + fixed_pos + 1;
272
31
            }
273
80
            size_t fixed_len = std::min(str_size - fixed_pos, len_value);
274
80
            StringOP::push_value_string_reserved_and_allow_overflow(
275
80
                    {str_data + fixed_pos, fixed_len}, i, res_chars, res_offsets);
276
80
        }
277
161
    }
_ZN5doris13SubstringUtil13vectors_asciiILb0ELb1ELb1EEEvRKNS_8PODArrayIhLm4096ENS_9AllocatorILb0ELb0ELb0ENS_22DefaultMemoryAllocatorELb1EEELm16ELm15EEERKNS2_IjLm4096ES5_Lm16ELm15EEERKNS2_IiLm4096ES5_Lm16ELm15EEESE_RS6_RS9_m
Line
Count
Source
255
26.7k
                              size_t size) {
256
3.48M
        for (size_t i = 0; i < size; ++i) {
257
3.46M
            int str_size = offsets[index_check_const<str_const>(i)] -
258
3.46M
                           offsets[index_check_const<str_const>(i) - 1];
259
3.46M
            const char* str_data =
260
3.46M
                    (char*)chars.data() + offsets[index_check_const<str_const>(i) - 1];
261
3.46M
            int start_value = start[index_check_const<start_const>(i)];
262
3.46M
            int len_value = len[index_check_const<len_const>(i)];
263
264
3.46M
            if (start_value > str_size || start_value < -str_size || str_size == 0 ||
265
3.46M
                len_value <= 0) {
266
518k
                StringOP::push_empty_string(i, res_chars, res_offsets);
267
518k
                continue;
268
518k
            }
269
2.94M
            int fixed_pos = start_value - 1;
270
2.94M
            if (fixed_pos < 0) {
271
65
                fixed_pos = str_size + fixed_pos + 1;
272
65
            }
273
2.94M
            size_t fixed_len = std::min(str_size - fixed_pos, len_value);
274
2.94M
            StringOP::push_value_string_reserved_and_allow_overflow(
275
2.94M
                    {str_data + fixed_pos, fixed_len}, i, res_chars, res_offsets);
276
2.94M
        }
277
26.7k
    }
_ZN5doris13SubstringUtil13vectors_asciiILb0ELb1ELb0EEEvRKNS_8PODArrayIhLm4096ENS_9AllocatorILb0ELb0ELb0ENS_22DefaultMemoryAllocatorELb1EEELm16ELm15EEERKNS2_IjLm4096ES5_Lm16ELm15EEERKNS2_IiLm4096ES5_Lm16ELm15EEESE_RS6_RS9_m
Line
Count
Source
255
146
                              size_t size) {
256
292
        for (size_t i = 0; i < size; ++i) {
257
146
            int str_size = offsets[index_check_const<str_const>(i)] -
258
146
                           offsets[index_check_const<str_const>(i) - 1];
259
146
            const char* str_data =
260
146
                    (char*)chars.data() + offsets[index_check_const<str_const>(i) - 1];
261
146
            int start_value = start[index_check_const<start_const>(i)];
262
146
            int len_value = len[index_check_const<len_const>(i)];
263
264
146
            if (start_value > str_size || start_value < -str_size || str_size == 0 ||
265
146
                len_value <= 0) {
266
77
                StringOP::push_empty_string(i, res_chars, res_offsets);
267
77
                continue;
268
77
            }
269
69
            int fixed_pos = start_value - 1;
270
69
            if (fixed_pos < 0) {
271
24
                fixed_pos = str_size + fixed_pos + 1;
272
24
            }
273
69
            size_t fixed_len = std::min(str_size - fixed_pos, len_value);
274
69
            StringOP::push_value_string_reserved_and_allow_overflow(
275
69
                    {str_data + fixed_pos, fixed_len}, i, res_chars, res_offsets);
276
69
        }
277
146
    }
_ZN5doris13SubstringUtil13vectors_asciiILb0ELb0ELb1EEEvRKNS_8PODArrayIhLm4096ENS_9AllocatorILb0ELb0ELb0ENS_22DefaultMemoryAllocatorELb1EEELm16ELm15EEERKNS2_IjLm4096ES5_Lm16ELm15EEERKNS2_IiLm4096ES5_Lm16ELm15EEESE_RS6_RS9_m
Line
Count
Source
255
160
                              size_t size) {
256
388
        for (size_t i = 0; i < size; ++i) {
257
228
            int str_size = offsets[index_check_const<str_const>(i)] -
258
228
                           offsets[index_check_const<str_const>(i) - 1];
259
228
            const char* str_data =
260
228
                    (char*)chars.data() + offsets[index_check_const<str_const>(i) - 1];
261
228
            int start_value = start[index_check_const<start_const>(i)];
262
228
            int len_value = len[index_check_const<len_const>(i)];
263
264
228
            if (start_value > str_size || start_value < -str_size || str_size == 0 ||
265
228
                len_value <= 0) {
266
97
                StringOP::push_empty_string(i, res_chars, res_offsets);
267
97
                continue;
268
97
            }
269
131
            int fixed_pos = start_value - 1;
270
131
            if (fixed_pos < 0) {
271
25
                fixed_pos = str_size + fixed_pos + 1;
272
25
            }
273
131
            size_t fixed_len = std::min(str_size - fixed_pos, len_value);
274
131
            StringOP::push_value_string_reserved_and_allow_overflow(
275
131
                    {str_data + fixed_pos, fixed_len}, i, res_chars, res_offsets);
276
131
        }
277
160
    }
_ZN5doris13SubstringUtil13vectors_asciiILb0ELb0ELb0EEEvRKNS_8PODArrayIhLm4096ENS_9AllocatorILb0ELb0ELb0ENS_22DefaultMemoryAllocatorELb1EEELm16ELm15EEERKNS2_IjLm4096ES5_Lm16ELm15EEERKNS2_IiLm4096ES5_Lm16ELm15EEESE_RS6_RS9_m
Line
Count
Source
255
577
                              size_t size) {
256
1.38k
        for (size_t i = 0; i < size; ++i) {
257
809
            int str_size = offsets[index_check_const<str_const>(i)] -
258
809
                           offsets[index_check_const<str_const>(i) - 1];
259
809
            const char* str_data =
260
809
                    (char*)chars.data() + offsets[index_check_const<str_const>(i) - 1];
261
809
            int start_value = start[index_check_const<start_const>(i)];
262
809
            int len_value = len[index_check_const<len_const>(i)];
263
264
809
            if (start_value > str_size || start_value < -str_size || str_size == 0 ||
265
809
                len_value <= 0) {
266
207
                StringOP::push_empty_string(i, res_chars, res_offsets);
267
207
                continue;
268
207
            }
269
602
            int fixed_pos = start_value - 1;
270
602
            if (fixed_pos < 0) {
271
317
                fixed_pos = str_size + fixed_pos + 1;
272
317
            }
273
602
            size_t fixed_len = std::min(str_size - fixed_pos, len_value);
274
602
            StringOP::push_value_string_reserved_and_allow_overflow(
275
602
                    {str_data + fixed_pos, fixed_len}, i, res_chars, res_offsets);
276
602
        }
277
577
    }
278
};
279
280
} // namespace doris