Coverage Report

Created: 2026-03-19 10:12

next uncovered line (L), next uncovered region (R), next uncovered branch (B)
be/src/util/io_helper.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 <fmt/compile.h>
21
#include <gen_cpp/data.pb.h>
22
#include <snappy/snappy.h>
23
24
#include <iostream>
25
#include <type_traits>
26
27
#include "common/exception.h"
28
#include "core/arena.h"
29
#include "core/binary_cast.hpp"
30
#include "core/field.h"
31
#include "core/string_buffer.hpp"
32
#include "core/string_ref.h"
33
#include "core/types.h"
34
#include "core/uint128.h"
35
#include "core/value/ipv4_value.h"
36
#include "core/value/ipv6_value.h"
37
#include "core/value/vdatetime_value.h"
38
#include "util/string_parser.hpp"
39
#include "util/var_int.h"
40
41
namespace doris {
42
#include "common/compile_check_begin.h"
43
8.98k
inline std::string int128_to_string(int128_t value) {
44
8.98k
    return fmt::format(FMT_COMPILE("{}"), value);
45
8.98k
}
46
47
0
inline std::string int128_to_string(uint128_t value) {
48
0
    return fmt::format(FMT_COMPILE("{}"), value);
49
0
}
50
51
0
inline std::string int128_to_string(UInt128 value) {
52
0
    return value.to_hex_string();
53
0
}
54
55
template <typename T>
56
void write_text(Decimal<T> value, UInt32 scale, std::ostream& ostr) {
57
    if (value < Decimal<T>(0)) {
58
        value *= Decimal<T>(-1);
59
        if (value > Decimal<T>(0)) {
60
            ostr << '-';
61
        }
62
    }
63
64
    T whole_part = value;
65
66
    if (scale) {
67
        whole_part = value / decimal_scale_multiplier<T>(scale);
68
    }
69
    if constexpr (std::is_same_v<T, __int128_t>) {
70
        ostr << int128_to_string(whole_part);
71
    } else {
72
        ostr << whole_part;
73
    }
74
    if (scale) {
75
        ostr << '.';
76
        String str_fractional(scale, '0');
77
        Int32 pos = scale - 1;
78
        if (value < Decimal<T>(0) && pos >= 0) {
79
            // Reach here iff this value is a min value of a signed numeric type. It means min<int>()
80
            // which is -2147483648 multiply -1 is still -2147483648.
81
            str_fractional[pos] += (value / 10 * 10) - value;
82
            pos--;
83
            value /= 10;
84
            value *= Decimal<T>(-1);
85
        }
86
        for (; pos >= 0; --pos, value /= 10) {
87
            str_fractional[pos] += value % 10;
88
        }
89
        ostr.write(str_fractional.data(), scale);
90
    }
91
}
92
93
template <typename T>
94
4.20M
bool try_read_float_text(T& x, const StringRef& in) {
95
4.20M
    static_assert(std::is_same_v<T, double> || std::is_same_v<T, float>,
96
4.20M
                  "Argument for readFloatTextImpl must be float or double");
97
4.20M
    static_assert('a' > '.' && 'A' > '.' && '\n' < '.' && '\t' < '.' && '\'' < '.' && '"' < '.',
98
4.20M
                  "Layout of char is not like ASCII"); //-V590
99
100
4.20M
    StringParser::ParseResult result;
101
4.20M
    x = StringParser::string_to_float<T>(in.data, in.size, &result);
102
103
4.20M
    return result == StringParser::PARSE_SUCCESS;
104
4.20M
}
_ZN5doris19try_read_float_textIfEEbRT_RKNS_9StringRefE
Line
Count
Source
94
955k
bool try_read_float_text(T& x, const StringRef& in) {
95
955k
    static_assert(std::is_same_v<T, double> || std::is_same_v<T, float>,
96
955k
                  "Argument for readFloatTextImpl must be float or double");
97
955k
    static_assert('a' > '.' && 'A' > '.' && '\n' < '.' && '\t' < '.' && '\'' < '.' && '"' < '.',
98
955k
                  "Layout of char is not like ASCII"); //-V590
99
100
955k
    StringParser::ParseResult result;
101
955k
    x = StringParser::string_to_float<T>(in.data, in.size, &result);
102
103
955k
    return result == StringParser::PARSE_SUCCESS;
104
955k
}
_ZN5doris19try_read_float_textIdEEbRT_RKNS_9StringRefE
Line
Count
Source
94
3.25M
bool try_read_float_text(T& x, const StringRef& in) {
95
3.25M
    static_assert(std::is_same_v<T, double> || std::is_same_v<T, float>,
96
3.25M
                  "Argument for readFloatTextImpl must be float or double");
97
3.25M
    static_assert('a' > '.' && 'A' > '.' && '\n' < '.' && '\t' < '.' && '\'' < '.' && '"' < '.',
98
3.25M
                  "Layout of char is not like ASCII"); //-V590
99
100
3.25M
    StringParser::ParseResult result;
101
3.25M
    x = StringParser::string_to_float<T>(in.data, in.size, &result);
102
103
3.25M
    return result == StringParser::PARSE_SUCCESS;
104
3.25M
}
105
106
template <typename T, bool enable_strict_mode = false>
107
135M
bool try_read_int_text(T& x, const StringRef& buf) {
108
135M
    StringParser::ParseResult result;
109
135M
    x = StringParser::string_to_int<T, enable_strict_mode>(buf.data, buf.size, &result);
110
111
135M
    return result == StringParser::PARSE_SUCCESS;
112
135M
}
_ZN5doris17try_read_int_textInLb0EEEbRT_RKNS_9StringRefE
Line
Count
Source
107
1.05M
bool try_read_int_text(T& x, const StringRef& buf) {
108
1.05M
    StringParser::ParseResult result;
109
1.05M
    x = StringParser::string_to_int<T, enable_strict_mode>(buf.data, buf.size, &result);
110
111
1.05M
    return result == StringParser::PARSE_SUCCESS;
112
1.05M
}
_ZN5doris17try_read_int_textIaLb1EEEbRT_RKNS_9StringRefE
Line
Count
Source
107
11.5k
bool try_read_int_text(T& x, const StringRef& buf) {
108
11.5k
    StringParser::ParseResult result;
109
11.5k
    x = StringParser::string_to_int<T, enable_strict_mode>(buf.data, buf.size, &result);
110
111
11.5k
    return result == StringParser::PARSE_SUCCESS;
112
11.5k
}
_ZN5doris17try_read_int_textIsLb1EEEbRT_RKNS_9StringRefE
Line
Count
Source
107
11.5k
bool try_read_int_text(T& x, const StringRef& buf) {
108
11.5k
    StringParser::ParseResult result;
109
11.5k
    x = StringParser::string_to_int<T, enable_strict_mode>(buf.data, buf.size, &result);
110
111
11.5k
    return result == StringParser::PARSE_SUCCESS;
112
11.5k
}
_ZN5doris17try_read_int_textIiLb1EEEbRT_RKNS_9StringRefE
Line
Count
Source
107
13.2k
bool try_read_int_text(T& x, const StringRef& buf) {
108
13.2k
    StringParser::ParseResult result;
109
13.2k
    x = StringParser::string_to_int<T, enable_strict_mode>(buf.data, buf.size, &result);
110
111
13.2k
    return result == StringParser::PARSE_SUCCESS;
112
13.2k
}
_ZN5doris17try_read_int_textIlLb1EEEbRT_RKNS_9StringRefE
Line
Count
Source
107
12.0k
bool try_read_int_text(T& x, const StringRef& buf) {
108
12.0k
    StringParser::ParseResult result;
109
12.0k
    x = StringParser::string_to_int<T, enable_strict_mode>(buf.data, buf.size, &result);
110
111
12.0k
    return result == StringParser::PARSE_SUCCESS;
112
12.0k
}
_ZN5doris17try_read_int_textInLb1EEEbRT_RKNS_9StringRefE
Line
Count
Source
107
11.8k
bool try_read_int_text(T& x, const StringRef& buf) {
108
11.8k
    StringParser::ParseResult result;
109
11.8k
    x = StringParser::string_to_int<T, enable_strict_mode>(buf.data, buf.size, &result);
110
111
11.8k
    return result == StringParser::PARSE_SUCCESS;
112
11.8k
}
_ZN5doris17try_read_int_textIaLb0EEEbRT_RKNS_9StringRefE
Line
Count
Source
107
6.85M
bool try_read_int_text(T& x, const StringRef& buf) {
108
6.85M
    StringParser::ParseResult result;
109
6.85M
    x = StringParser::string_to_int<T, enable_strict_mode>(buf.data, buf.size, &result);
110
111
6.85M
    return result == StringParser::PARSE_SUCCESS;
112
6.85M
}
_ZN5doris17try_read_int_textIsLb0EEEbRT_RKNS_9StringRefE
Line
Count
Source
107
1.05M
bool try_read_int_text(T& x, const StringRef& buf) {
108
1.05M
    StringParser::ParseResult result;
109
1.05M
    x = StringParser::string_to_int<T, enable_strict_mode>(buf.data, buf.size, &result);
110
111
1.05M
    return result == StringParser::PARSE_SUCCESS;
112
1.05M
}
_ZN5doris17try_read_int_textIiLb0EEEbRT_RKNS_9StringRefE
Line
Count
Source
107
52.2M
bool try_read_int_text(T& x, const StringRef& buf) {
108
52.2M
    StringParser::ParseResult result;
109
52.2M
    x = StringParser::string_to_int<T, enable_strict_mode>(buf.data, buf.size, &result);
110
111
52.2M
    return result == StringParser::PARSE_SUCCESS;
112
52.2M
}
_ZN5doris17try_read_int_textIlLb0EEEbRT_RKNS_9StringRefE
Line
Count
Source
107
74.0M
bool try_read_int_text(T& x, const StringRef& buf) {
108
74.0M
    StringParser::ParseResult result;
109
74.0M
    x = StringParser::string_to_int<T, enable_strict_mode>(buf.data, buf.size, &result);
110
111
74.0M
    return result == StringParser::PARSE_SUCCESS;
112
74.0M
}
Unexecuted instantiation: _ZN5doris17try_read_int_textIjLb0EEEbRT_RKNS_9StringRefE
_ZN5doris17try_read_int_textImLb0EEEbRT_RKNS_9StringRefE
Line
Count
Source
107
4.19k
bool try_read_int_text(T& x, const StringRef& buf) {
108
4.19k
    StringParser::ParseResult result;
109
4.19k
    x = StringParser::string_to_int<T, enable_strict_mode>(buf.data, buf.size, &result);
110
111
4.19k
    return result == StringParser::PARSE_SUCCESS;
112
4.19k
}
113
114
bool read_date_text_impl(VecDateTimeValue& x, const StringRef& buf);
115
116
template <typename T>
117
bool read_date_text_impl(T& x, const StringRef& buf, const cctz::time_zone& local_time_zone) {
118
    static_assert(std::is_same_v<Int64, T>);
119
    auto dv = binary_cast<Int64, VecDateTimeValue>(x);
120
    auto ans = dv.from_date_str(buf.data, buf.size, local_time_zone);
121
    dv.cast_to_date();
122
    x = binary_cast<VecDateTimeValue, Int64>(dv);
123
    return ans;
124
}
125
126
template <typename T>
127
82.9k
bool read_ipv4_text_impl(T& x, const StringRef& buf) {
128
82.9k
    static_assert(std::is_same_v<IPv4, T>);
129
82.9k
    bool res = IPv4Value::from_string(x, buf.data, buf.size);
130
82.9k
    return res;
131
82.9k
}
132
133
template <typename T>
134
59.7k
bool read_ipv6_text_impl(T& x, const StringRef& buf) {
135
59.7k
    static_assert(std::is_same_v<IPv6, T>);
136
59.7k
    bool res = IPv6Value::from_string(x, buf.data, buf.size);
137
59.7k
    return res;
138
59.7k
}
139
140
bool read_datetime_text_impl(VecDateTimeValue& x, const StringRef& buf);
141
142
template <typename T>
143
bool read_datetime_text_impl(T& x, const StringRef& buf, const cctz::time_zone& local_time_zone) {
144
    static_assert(std::is_same_v<Int64, T>);
145
    auto dv = binary_cast<Int64, VecDateTimeValue>(x);
146
    auto ans = dv.from_date_str(buf.data, buf.size, local_time_zone);
147
    dv.to_datetime();
148
    x = binary_cast<VecDateTimeValue, Int64>(dv);
149
    return ans;
150
}
151
152
bool read_date_v2_text_impl(DateV2Value<DateV2ValueType>& x, const StringRef& buf);
153
154
bool read_date_v2_text_impl(DateV2Value<DateV2ValueType>& x, const StringRef& buf,
155
                            const cctz::time_zone& local_time_zone);
156
157
bool read_datetime_v2_text_impl(DateV2Value<DateTimeV2ValueType>& x, const StringRef& buf,
158
                                UInt32 scale = -1);
159
160
bool read_datetime_v2_text_impl(DateV2Value<DateTimeV2ValueType>& x, const StringRef& buf,
161
                                const cctz::time_zone& local_time_zone, UInt32 scale = -1);
162
163
template <PrimitiveType P, typename T>
164
StringParser::ParseResult read_decimal_text_impl(T& x, const StringRef& buf, UInt32 precision,
165
17.6M
                                                 UInt32 scale) {
166
17.6M
    static_assert(IsDecimalNumber<T>);
167
17.6M
    if constexpr (!std::is_same_v<DecimalV2Value, T>) {
168
        // DecimalV3: uses the caller-supplied precision and scale.
169
        // When called from from_olap_string with ignore_scale=true, scale=0 means the
170
        // string is treated as an unscaled integer (e.g. "12345" → internal int 12345).
171
17.6M
        StringParser::ParseResult result = StringParser::PARSE_SUCCESS;
172
17.6M
        x.value = StringParser::string_to_decimal<P>(buf.data, (int)buf.size, precision, scale,
173
17.6M
                                                     &result);
174
17.6M
        return result;
175
17.6M
    } else {
176
        // DecimalV2: IGNORES the caller-supplied precision/scale and hardcodes
177
        // DecimalV2Value::PRECISION (27) and DecimalV2Value::SCALE (9).
178
        // This means from_olap_string's ignore_scale flag has no actual effect on DecimalV2
179
        // parsing today — the string "123.456000000" is always parsed with scale=9.
180
        // Callers should still set ignore_scale=false for DecimalV2 for semantic correctness.
181
12.2k
        StringParser::ParseResult result = StringParser::PARSE_SUCCESS;
182
12.2k
        x = DecimalV2Value(StringParser::string_to_decimal<TYPE_DECIMALV2>(
183
12.2k
                buf.data, (int)buf.size, DecimalV2Value::PRECISION, DecimalV2Value::SCALE,
184
12.2k
                &result));
185
12.2k
        return result;
186
12.2k
    }
187
17.6M
}
_ZN5doris22read_decimal_text_implILNS_13PrimitiveTypeE28ENS_7DecimalIiEEEENS_12StringParser11ParseResultERT0_RKNS_9StringRefEjj
Line
Count
Source
165
336k
                                                 UInt32 scale) {
166
336k
    static_assert(IsDecimalNumber<T>);
167
336k
    if constexpr (!std::is_same_v<DecimalV2Value, T>) {
168
        // DecimalV3: uses the caller-supplied precision and scale.
169
        // When called from from_olap_string with ignore_scale=true, scale=0 means the
170
        // string is treated as an unscaled integer (e.g. "12345" → internal int 12345).
171
336k
        StringParser::ParseResult result = StringParser::PARSE_SUCCESS;
172
336k
        x.value = StringParser::string_to_decimal<P>(buf.data, (int)buf.size, precision, scale,
173
336k
                                                     &result);
174
336k
        return result;
175
    } else {
176
        // DecimalV2: IGNORES the caller-supplied precision/scale and hardcodes
177
        // DecimalV2Value::PRECISION (27) and DecimalV2Value::SCALE (9).
178
        // This means from_olap_string's ignore_scale flag has no actual effect on DecimalV2
179
        // parsing today — the string "123.456000000" is always parsed with scale=9.
180
        // Callers should still set ignore_scale=false for DecimalV2 for semantic correctness.
181
        StringParser::ParseResult result = StringParser::PARSE_SUCCESS;
182
        x = DecimalV2Value(StringParser::string_to_decimal<TYPE_DECIMALV2>(
183
                buf.data, (int)buf.size, DecimalV2Value::PRECISION, DecimalV2Value::SCALE,
184
                &result));
185
        return result;
186
    }
187
336k
}
_ZN5doris22read_decimal_text_implILNS_13PrimitiveTypeE29ENS_7DecimalIlEEEENS_12StringParser11ParseResultERT0_RKNS_9StringRefEjj
Line
Count
Source
165
15.1M
                                                 UInt32 scale) {
166
15.1M
    static_assert(IsDecimalNumber<T>);
167
15.1M
    if constexpr (!std::is_same_v<DecimalV2Value, T>) {
168
        // DecimalV3: uses the caller-supplied precision and scale.
169
        // When called from from_olap_string with ignore_scale=true, scale=0 means the
170
        // string is treated as an unscaled integer (e.g. "12345" → internal int 12345).
171
15.1M
        StringParser::ParseResult result = StringParser::PARSE_SUCCESS;
172
15.1M
        x.value = StringParser::string_to_decimal<P>(buf.data, (int)buf.size, precision, scale,
173
15.1M
                                                     &result);
174
15.1M
        return result;
175
    } else {
176
        // DecimalV2: IGNORES the caller-supplied precision/scale and hardcodes
177
        // DecimalV2Value::PRECISION (27) and DecimalV2Value::SCALE (9).
178
        // This means from_olap_string's ignore_scale flag has no actual effect on DecimalV2
179
        // parsing today — the string "123.456000000" is always parsed with scale=9.
180
        // Callers should still set ignore_scale=false for DecimalV2 for semantic correctness.
181
        StringParser::ParseResult result = StringParser::PARSE_SUCCESS;
182
        x = DecimalV2Value(StringParser::string_to_decimal<TYPE_DECIMALV2>(
183
                buf.data, (int)buf.size, DecimalV2Value::PRECISION, DecimalV2Value::SCALE,
184
                &result));
185
        return result;
186
    }
187
15.1M
}
_ZN5doris22read_decimal_text_implILNS_13PrimitiveTypeE30ENS_12Decimal128V3EEENS_12StringParser11ParseResultERT0_RKNS_9StringRefEjj
Line
Count
Source
165
2.09M
                                                 UInt32 scale) {
166
2.09M
    static_assert(IsDecimalNumber<T>);
167
2.09M
    if constexpr (!std::is_same_v<DecimalV2Value, T>) {
168
        // DecimalV3: uses the caller-supplied precision and scale.
169
        // When called from from_olap_string with ignore_scale=true, scale=0 means the
170
        // string is treated as an unscaled integer (e.g. "12345" → internal int 12345).
171
2.09M
        StringParser::ParseResult result = StringParser::PARSE_SUCCESS;
172
2.09M
        x.value = StringParser::string_to_decimal<P>(buf.data, (int)buf.size, precision, scale,
173
2.09M
                                                     &result);
174
2.09M
        return result;
175
    } else {
176
        // DecimalV2: IGNORES the caller-supplied precision/scale and hardcodes
177
        // DecimalV2Value::PRECISION (27) and DecimalV2Value::SCALE (9).
178
        // This means from_olap_string's ignore_scale flag has no actual effect on DecimalV2
179
        // parsing today — the string "123.456000000" is always parsed with scale=9.
180
        // Callers should still set ignore_scale=false for DecimalV2 for semantic correctness.
181
        StringParser::ParseResult result = StringParser::PARSE_SUCCESS;
182
        x = DecimalV2Value(StringParser::string_to_decimal<TYPE_DECIMALV2>(
183
                buf.data, (int)buf.size, DecimalV2Value::PRECISION, DecimalV2Value::SCALE,
184
                &result));
185
        return result;
186
    }
187
2.09M
}
_ZN5doris22read_decimal_text_implILNS_13PrimitiveTypeE20ENS_14DecimalV2ValueEEENS_12StringParser11ParseResultERT0_RKNS_9StringRefEjj
Line
Count
Source
165
12.2k
                                                 UInt32 scale) {
166
12.2k
    static_assert(IsDecimalNumber<T>);
167
    if constexpr (!std::is_same_v<DecimalV2Value, T>) {
168
        // DecimalV3: uses the caller-supplied precision and scale.
169
        // When called from from_olap_string with ignore_scale=true, scale=0 means the
170
        // string is treated as an unscaled integer (e.g. "12345" → internal int 12345).
171
        StringParser::ParseResult result = StringParser::PARSE_SUCCESS;
172
        x.value = StringParser::string_to_decimal<P>(buf.data, (int)buf.size, precision, scale,
173
                                                     &result);
174
        return result;
175
12.2k
    } else {
176
        // DecimalV2: IGNORES the caller-supplied precision/scale and hardcodes
177
        // DecimalV2Value::PRECISION (27) and DecimalV2Value::SCALE (9).
178
        // This means from_olap_string's ignore_scale flag has no actual effect on DecimalV2
179
        // parsing today — the string "123.456000000" is always parsed with scale=9.
180
        // Callers should still set ignore_scale=false for DecimalV2 for semantic correctness.
181
12.2k
        StringParser::ParseResult result = StringParser::PARSE_SUCCESS;
182
12.2k
        x = DecimalV2Value(StringParser::string_to_decimal<TYPE_DECIMALV2>(
183
12.2k
                buf.data, (int)buf.size, DecimalV2Value::PRECISION, DecimalV2Value::SCALE,
184
12.2k
                &result));
185
12.2k
        return result;
186
12.2k
    }
187
12.2k
}
_ZN5doris22read_decimal_text_implILNS_13PrimitiveTypeE35ENS_7DecimalIN4wide7integerILm256EiEEEEEENS_12StringParser11ParseResultERT0_RKNS_9StringRefEjj
Line
Count
Source
165
130k
                                                 UInt32 scale) {
166
130k
    static_assert(IsDecimalNumber<T>);
167
130k
    if constexpr (!std::is_same_v<DecimalV2Value, T>) {
168
        // DecimalV3: uses the caller-supplied precision and scale.
169
        // When called from from_olap_string with ignore_scale=true, scale=0 means the
170
        // string is treated as an unscaled integer (e.g. "12345" → internal int 12345).
171
130k
        StringParser::ParseResult result = StringParser::PARSE_SUCCESS;
172
130k
        x.value = StringParser::string_to_decimal<P>(buf.data, (int)buf.size, precision, scale,
173
130k
                                                     &result);
174
130k
        return result;
175
    } else {
176
        // DecimalV2: IGNORES the caller-supplied precision/scale and hardcodes
177
        // DecimalV2Value::PRECISION (27) and DecimalV2Value::SCALE (9).
178
        // This means from_olap_string's ignore_scale flag has no actual effect on DecimalV2
179
        // parsing today — the string "123.456000000" is always parsed with scale=9.
180
        // Callers should still set ignore_scale=false for DecimalV2 for semantic correctness.
181
        StringParser::ParseResult result = StringParser::PARSE_SUCCESS;
182
        x = DecimalV2Value(StringParser::string_to_decimal<TYPE_DECIMALV2>(
183
                buf.data, (int)buf.size, DecimalV2Value::PRECISION, DecimalV2Value::SCALE,
184
                &result));
185
        return result;
186
    }
187
130k
}
188
189
template <typename T>
190
4.19k
const char* try_read_first_int_text(T& x, const char* pos, const char* end) {
191
4.19k
    const int64_t len = end - pos;
192
4.19k
    int64_t i = 0;
193
8.58k
    while (i < len) {
194
8.58k
        if (pos[i] >= '0' && pos[i] <= '9') {
195
4.38k
            i++;
196
4.38k
        } else {
197
4.19k
            break;
198
4.19k
        }
199
8.58k
    }
200
4.19k
    const char* int_end = pos + i;
201
4.19k
    StringRef in((char*)pos, int_end - pos);
202
4.19k
    const size_t count = in.size;
203
4.19k
    try_read_int_text(x, in);
204
4.19k
    return pos + count;
205
4.19k
}
_ZN5doris23try_read_first_int_textImEEPKcRT_S2_S2_
Line
Count
Source
190
4.19k
const char* try_read_first_int_text(T& x, const char* pos, const char* end) {
191
4.19k
    const int64_t len = end - pos;
192
4.19k
    int64_t i = 0;
193
8.58k
    while (i < len) {
194
8.58k
        if (pos[i] >= '0' && pos[i] <= '9') {
195
4.38k
            i++;
196
4.38k
        } else {
197
4.19k
            break;
198
4.19k
        }
199
8.58k
    }
200
4.19k
    const char* int_end = pos + i;
201
4.19k
    StringRef in((char*)pos, int_end - pos);
202
4.19k
    const size_t count = in.size;
203
4.19k
    try_read_int_text(x, in);
204
4.19k
    return pos + count;
205
4.19k
}
Unexecuted instantiation: _ZN5doris23try_read_first_int_textIjEEPKcRT_S2_S2_
206
207
template <PrimitiveType P, typename T>
208
StringParser::ParseResult try_read_decimal_text(T& x, const StringRef& in, UInt32 precision,
209
17.4M
                                                UInt32 scale) {
210
17.4M
    return read_decimal_text_impl<P, T>(x, in, precision, scale);
211
17.4M
}
_ZN5doris21try_read_decimal_textILNS_13PrimitiveTypeE28ENS_7DecimalIiEEEENS_12StringParser11ParseResultERT0_RKNS_9StringRefEjj
Line
Count
Source
209
311k
                                                UInt32 scale) {
210
311k
    return read_decimal_text_impl<P, T>(x, in, precision, scale);
211
311k
}
_ZN5doris21try_read_decimal_textILNS_13PrimitiveTypeE29ENS_7DecimalIlEEEENS_12StringParser11ParseResultERT0_RKNS_9StringRefEjj
Line
Count
Source
209
15.0M
                                                UInt32 scale) {
210
15.0M
    return read_decimal_text_impl<P, T>(x, in, precision, scale);
211
15.0M
}
_ZN5doris21try_read_decimal_textILNS_13PrimitiveTypeE30ENS_12Decimal128V3EEENS_12StringParser11ParseResultERT0_RKNS_9StringRefEjj
Line
Count
Source
209
2.03M
                                                UInt32 scale) {
210
2.03M
    return read_decimal_text_impl<P, T>(x, in, precision, scale);
211
2.03M
}
_ZN5doris21try_read_decimal_textILNS_13PrimitiveTypeE20ENS_14DecimalV2ValueEEENS_12StringParser11ParseResultERT0_RKNS_9StringRefEjj
Line
Count
Source
209
95
                                                UInt32 scale) {
210
95
    return read_decimal_text_impl<P, T>(x, in, precision, scale);
211
95
}
_ZN5doris21try_read_decimal_textILNS_13PrimitiveTypeE35ENS_7DecimalIN4wide7integerILm256EiEEEEEENS_12StringParser11ParseResultERT0_RKNS_9StringRefEjj
Line
Count
Source
209
42.7k
                                                UInt32 scale) {
210
42.7k
    return read_decimal_text_impl<P, T>(x, in, precision, scale);
211
42.7k
}
212
213
template <typename T>
214
bool try_read_ipv4_text(T& x, const StringRef& in) {
215
    return read_ipv4_text_impl<T>(x, in);
216
}
217
218
template <typename T>
219
bool try_read_ipv6_text(T& x, const StringRef& in) {
220
    return read_ipv6_text_impl<T>(x, in);
221
}
222
223
template <typename T>
224
bool try_read_datetime_text(T& x, const StringRef& in, const cctz::time_zone& local_time_zone) {
225
    return read_datetime_text_impl<T>(x, in, local_time_zone);
226
}
227
228
template <typename T>
229
bool try_read_date_text(T& x, const StringRef& in, const cctz::time_zone& local_time_zone) {
230
    return read_date_text_impl<T>(x, in, local_time_zone);
231
}
232
233
template <typename T>
234
bool try_read_date_v2_text(T& x, const StringRef& in, const cctz::time_zone& local_time_zone) {
235
    return read_date_v2_text_impl<T>(x, in, local_time_zone);
236
}
237
238
template <typename T>
239
bool try_read_datetime_v2_text(T& x, const StringRef& in, const cctz::time_zone& local_time_zone,
240
                               UInt32 scale) {
241
    return read_datetime_v2_text_impl<T>(x, in, local_time_zone, scale);
242
}
243
244
652k
bool inline try_read_bool_text(UInt8& x, const StringRef& buf) {
245
652k
    StringParser::ParseResult result;
246
652k
    x = StringParser::string_to_bool(buf.data, buf.size, &result);
247
652k
    return result == StringParser::PARSE_SUCCESS;
248
652k
}
249
250
#include "common/compile_check_end.h"
251
252
} // namespace doris