Coverage Report

Created: 2026-08-28 01:04

next uncovered line (L), next uncovered region (R), next uncovered branch (B)
be/src/exec/common/join_op_utils.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
// Lightweight join-op level types split out of join_utils.h so that
21
// exec/pipeline/dependency.h (which holds JoinOpVariants / AsofIndexVariant
22
// members by value) does not have to see the hash-table machinery.
23
// Everything here depends only on thrift enums and std containers.
24
25
#include <gen_cpp/PlanNodes_types.h>
26
#include <pdqsort.h>
27
28
#include <cstdint>
29
#include <variant>
30
#include <vector>
31
32
#include "common/compiler_util.h"
33
34
namespace doris {
35
36
using JoinOpVariants =
37
        std::variant<std::integral_constant<TJoinOp::type, TJoinOp::INNER_JOIN>,
38
                     std::integral_constant<TJoinOp::type, TJoinOp::LEFT_SEMI_JOIN>,
39
                     std::integral_constant<TJoinOp::type, TJoinOp::LEFT_ANTI_JOIN>,
40
                     std::integral_constant<TJoinOp::type, TJoinOp::LEFT_OUTER_JOIN>,
41
                     std::integral_constant<TJoinOp::type, TJoinOp::FULL_OUTER_JOIN>,
42
                     std::integral_constant<TJoinOp::type, TJoinOp::RIGHT_OUTER_JOIN>,
43
                     std::integral_constant<TJoinOp::type, TJoinOp::CROSS_JOIN>,
44
                     std::integral_constant<TJoinOp::type, TJoinOp::RIGHT_SEMI_JOIN>,
45
                     std::integral_constant<TJoinOp::type, TJoinOp::RIGHT_ANTI_JOIN>,
46
                     std::integral_constant<TJoinOp::type, TJoinOp::NULL_AWARE_LEFT_ANTI_JOIN>,
47
                     std::integral_constant<TJoinOp::type, TJoinOp::NULL_AWARE_LEFT_SEMI_JOIN>,
48
                     std::integral_constant<TJoinOp::type, TJoinOp::ASOF_LEFT_INNER_JOIN>,
49
                     std::integral_constant<TJoinOp::type, TJoinOp::ASOF_LEFT_OUTER_JOIN>>;
50
51
336k
inline bool is_asof_join(TJoinOp::type join_op) {
52
336k
    return join_op == TJoinOp::ASOF_LEFT_INNER_JOIN || join_op == TJoinOp::ASOF_LEFT_OUTER_JOIN;
53
336k
}
54
55
template <int JoinOpType>
56
inline constexpr bool is_asof_join_op_v =
57
        JoinOpType == TJoinOp::ASOF_LEFT_INNER_JOIN || JoinOpType == TJoinOp::ASOF_LEFT_OUTER_JOIN;
58
59
template <int JoinOpType>
60
inline constexpr bool is_asof_outer_join_op_v = JoinOpType == TJoinOp::ASOF_LEFT_OUTER_JOIN;
61
62
// ASOF JOIN index with inline values for cache-friendly branchless binary search.
63
// IntType is the integer representation of the ASOF column value:
64
//   uint32_t for DateV2, uint64_t for DateTimeV2 and TimestampTZ,
65
//   int64_t for TimestampNs, and AsofMixedDateTimeKey for exact mixed
66
//   TimestampNs/DateTimeV2 comparisons.
67
// Rows are sorted by asof_value during build, then materialized into SoA arrays
68
// so probe-side binary search only touches the ASOF values hot path.
69
template <typename IntType>
70
struct AsofIndexGroup {
71
    using int_type = IntType;
72
73
    struct Entry {
74
        IntType asof_value;
75
        uint32_t row_index; // 1-based, 0 = invalid/padding
76
    };
77
78
    std::vector<Entry> entries;
79
    std::vector<IntType> asof_values;
80
    std::vector<uint32_t> row_indexes;
81
82
1.07k
    void add_row(IntType value, uint32_t row_idx) { entries.push_back({value, row_idx}); }
_ZN5doris14AsofIndexGroupIjE7add_rowEjj
Line
Count
Source
82
1.05k
    void add_row(IntType value, uint32_t row_idx) { entries.push_back({value, row_idx}); }
_ZN5doris14AsofIndexGroupImE7add_rowEmj
Line
Count
Source
82
12
    void add_row(IntType value, uint32_t row_idx) { entries.push_back({value, row_idx}); }
_ZN5doris14AsofIndexGroupIoE7add_rowEoj
Line
Count
Source
82
3
    void add_row(IntType value, uint32_t row_idx) { entries.push_back({value, row_idx}); }
_ZN5doris14AsofIndexGroupIlE7add_rowElj
Line
Count
Source
82
2
    void add_row(IntType value, uint32_t row_idx) { entries.push_back({value, row_idx}); }
83
84
27
    void sort_and_finalize() {
85
27
        if (entries.empty()) {
86
4
            return;
87
4
        }
88
23
        if (entries.size() > 1) {
89
18
            pdqsort(entries.begin(), entries.end(),
90
2.07k
                    [](const Entry& a, const Entry& b) { return a.asof_value < b.asof_value; });
_ZZN5doris14AsofIndexGroupIjE17sort_and_finalizeEvENKUlRKNS1_5EntryES4_E_clES4_S4_
Line
Count
Source
90
2.06k
                    [](const Entry& a, const Entry& b) { return a.asof_value < b.asof_value; });
_ZZN5doris14AsofIndexGroupImE17sort_and_finalizeEvENKUlRKNS1_5EntryES4_E_clES4_S4_
Line
Count
Source
90
9
                    [](const Entry& a, const Entry& b) { return a.asof_value < b.asof_value; });
_ZZN5doris14AsofIndexGroupIoE17sort_and_finalizeEvENKUlRKNS1_5EntryES4_E_clES4_S4_
Line
Count
Source
90
1
                    [](const Entry& a, const Entry& b) { return a.asof_value < b.asof_value; });
_ZZN5doris14AsofIndexGroupIlE17sort_and_finalizeEvENKUlRKNS1_5EntryES4_E_clES4_S4_
Line
Count
Source
90
1
                    [](const Entry& a, const Entry& b) { return a.asof_value < b.asof_value; });
91
18
        }
92
93
23
        asof_values.resize(entries.size());
94
23
        row_indexes.resize(entries.size());
95
1.09k
        for (size_t i = 0; i < entries.size(); ++i) {
96
1.07k
            asof_values[i] = entries[i].asof_value;
97
1.07k
            row_indexes[i] = entries[i].row_index;
98
1.07k
        }
99
100
23
        std::vector<Entry>().swap(entries);
101
23
    }
_ZN5doris14AsofIndexGroupIjE17sort_and_finalizeEv
Line
Count
Source
84
20
    void sort_and_finalize() {
85
20
        if (entries.empty()) {
86
4
            return;
87
4
        }
88
16
        if (entries.size() > 1) {
89
13
            pdqsort(entries.begin(), entries.end(),
90
13
                    [](const Entry& a, const Entry& b) { return a.asof_value < b.asof_value; });
91
13
        }
92
93
16
        asof_values.resize(entries.size());
94
16
        row_indexes.resize(entries.size());
95
1.07k
        for (size_t i = 0; i < entries.size(); ++i) {
96
1.05k
            asof_values[i] = entries[i].asof_value;
97
1.05k
            row_indexes[i] = entries[i].row_index;
98
1.05k
        }
99
100
16
        std::vector<Entry>().swap(entries);
101
16
    }
_ZN5doris14AsofIndexGroupImE17sort_and_finalizeEv
Line
Count
Source
84
4
    void sort_and_finalize() {
85
4
        if (entries.empty()) {
86
0
            return;
87
0
        }
88
4
        if (entries.size() > 1) {
89
3
            pdqsort(entries.begin(), entries.end(),
90
3
                    [](const Entry& a, const Entry& b) { return a.asof_value < b.asof_value; });
91
3
        }
92
93
4
        asof_values.resize(entries.size());
94
4
        row_indexes.resize(entries.size());
95
16
        for (size_t i = 0; i < entries.size(); ++i) {
96
12
            asof_values[i] = entries[i].asof_value;
97
12
            row_indexes[i] = entries[i].row_index;
98
12
        }
99
100
4
        std::vector<Entry>().swap(entries);
101
4
    }
_ZN5doris14AsofIndexGroupIoE17sort_and_finalizeEv
Line
Count
Source
84
2
    void sort_and_finalize() {
85
2
        if (entries.empty()) {
86
0
            return;
87
0
        }
88
2
        if (entries.size() > 1) {
89
1
            pdqsort(entries.begin(), entries.end(),
90
1
                    [](const Entry& a, const Entry& b) { return a.asof_value < b.asof_value; });
91
1
        }
92
93
2
        asof_values.resize(entries.size());
94
2
        row_indexes.resize(entries.size());
95
5
        for (size_t i = 0; i < entries.size(); ++i) {
96
3
            asof_values[i] = entries[i].asof_value;
97
3
            row_indexes[i] = entries[i].row_index;
98
3
        }
99
100
2
        std::vector<Entry>().swap(entries);
101
2
    }
_ZN5doris14AsofIndexGroupIlE17sort_and_finalizeEv
Line
Count
Source
84
1
    void sort_and_finalize() {
85
1
        if (entries.empty()) {
86
0
            return;
87
0
        }
88
1
        if (entries.size() > 1) {
89
1
            pdqsort(entries.begin(), entries.end(),
90
1
                    [](const Entry& a, const Entry& b) { return a.asof_value < b.asof_value; });
91
1
        }
92
93
1
        asof_values.resize(entries.size());
94
1
        row_indexes.resize(entries.size());
95
3
        for (size_t i = 0; i < entries.size(); ++i) {
96
2
            asof_values[i] = entries[i].asof_value;
97
2
            row_indexes[i] = entries[i].row_index;
98
2
        }
99
100
1
        std::vector<Entry>().swap(entries);
101
1
    }
102
103
1
    const IntType* values_data() const { return asof_values.data(); }
_ZNK5doris14AsofIndexGroupIjE11values_dataEv
Line
Count
Source
103
1
    const IntType* values_data() const { return asof_values.data(); }
Unexecuted instantiation: _ZNK5doris14AsofIndexGroupImE11values_dataEv
Unexecuted instantiation: _ZNK5doris14AsofIndexGroupIlE11values_dataEv
Unexecuted instantiation: _ZNK5doris14AsofIndexGroupIoE11values_dataEv
104
105
    // Branchless lower_bound: first i where asof_values[i] >= target
106
41
    ALWAYS_INLINE size_t lower_bound(IntType target) const {
107
41
        size_t lo = 0, n = asof_values.size();
108
185
        while (n > 1) {
109
144
            size_t half = n / 2;
110
144
            lo += half * (asof_values[lo + half] < target);
111
144
            n -= half;
112
144
        }
113
41
        if (lo < asof_values.size()) {
114
40
            lo += (asof_values[lo] < target);
115
40
        }
116
41
        return lo;
117
41
    }
_ZNK5doris14AsofIndexGroupIjE11lower_boundEj
Line
Count
Source
106
33
    ALWAYS_INLINE size_t lower_bound(IntType target) const {
107
33
        size_t lo = 0, n = asof_values.size();
108
163
        while (n > 1) {
109
130
            size_t half = n / 2;
110
130
            lo += half * (asof_values[lo + half] < target);
111
130
            n -= half;
112
130
        }
113
33
        if (lo < asof_values.size()) {
114
32
            lo += (asof_values[lo] < target);
115
32
        }
116
33
        return lo;
117
33
    }
_ZNK5doris14AsofIndexGroupImE11lower_boundEm
Line
Count
Source
106
6
    ALWAYS_INLINE size_t lower_bound(IntType target) const {
107
6
        size_t lo = 0, n = asof_values.size();
108
18
        while (n > 1) {
109
12
            size_t half = n / 2;
110
12
            lo += half * (asof_values[lo + half] < target);
111
12
            n -= half;
112
12
        }
113
6
        if (lo < asof_values.size()) {
114
6
            lo += (asof_values[lo] < target);
115
6
        }
116
6
        return lo;
117
6
    }
_ZNK5doris14AsofIndexGroupIoE11lower_boundEo
Line
Count
Source
106
2
    ALWAYS_INLINE size_t lower_bound(IntType target) const {
107
2
        size_t lo = 0, n = asof_values.size();
108
4
        while (n > 1) {
109
2
            size_t half = n / 2;
110
2
            lo += half * (asof_values[lo + half] < target);
111
2
            n -= half;
112
2
        }
113
2
        if (lo < asof_values.size()) {
114
2
            lo += (asof_values[lo] < target);
115
2
        }
116
2
        return lo;
117
2
    }
Unexecuted instantiation: _ZNK5doris14AsofIndexGroupIlE11lower_boundEl
118
119
    // Branchless upper_bound: first i where asof_values[i] > target
120
45
    ALWAYS_INLINE size_t upper_bound(IntType target) const {
121
45
        size_t lo = 0, n = asof_values.size();
122
228
        while (n > 1) {
123
183
            size_t half = n / 2;
124
183
            lo += half * (asof_values[lo + half] <= target);
125
183
            n -= half;
126
183
        }
127
45
        if (lo < asof_values.size()) {
128
44
            lo += (asof_values[lo] <= target);
129
44
        }
130
45
        return lo;
131
45
    }
_ZNK5doris14AsofIndexGroupIjE11upper_boundEj
Line
Count
Source
120
38
    ALWAYS_INLINE size_t upper_bound(IntType target) const {
121
38
        size_t lo = 0, n = asof_values.size();
122
208
        while (n > 1) {
123
170
            size_t half = n / 2;
124
170
            lo += half * (asof_values[lo + half] <= target);
125
170
            n -= half;
126
170
        }
127
38
        if (lo < asof_values.size()) {
128
37
            lo += (asof_values[lo] <= target);
129
37
        }
130
38
        return lo;
131
38
    }
_ZNK5doris14AsofIndexGroupImE11upper_boundEm
Line
Count
Source
120
6
    ALWAYS_INLINE size_t upper_bound(IntType target) const {
121
6
        size_t lo = 0, n = asof_values.size();
122
18
        while (n > 1) {
123
12
            size_t half = n / 2;
124
12
            lo += half * (asof_values[lo + half] <= target);
125
12
            n -= half;
126
12
        }
127
6
        if (lo < asof_values.size()) {
128
6
            lo += (asof_values[lo] <= target);
129
6
        }
130
6
        return lo;
131
6
    }
_ZNK5doris14AsofIndexGroupIoE11upper_boundEo
Line
Count
Source
120
1
    ALWAYS_INLINE size_t upper_bound(IntType target) const {
121
1
        size_t lo = 0, n = asof_values.size();
122
2
        while (n > 1) {
123
1
            size_t half = n / 2;
124
1
            lo += half * (asof_values[lo + half] <= target);
125
1
            n -= half;
126
1
        }
127
1
        if (lo < asof_values.size()) {
128
1
            lo += (asof_values[lo] <= target);
129
1
        }
130
1
        return lo;
131
1
    }
Unexecuted instantiation: _ZNK5doris14AsofIndexGroupIlE11upper_boundEl
132
133
    // Semantics by (is_greater, is_strict):
134
    //   (true,  false): probe >= build  ->  find largest  build value <= probe
135
    //   (true,  true):  probe >  build  ->  find largest  build value <  probe
136
    //   (false, false): probe <= build  ->  find smallest build value >= probe
137
    //   (false, true):  probe <  build  ->  find smallest build value >  probe
138
    // Returns the build row index of the best match, or 0 if no match.
139
    template <bool IsGreater, bool IsStrict>
140
72
    ALWAYS_INLINE uint32_t find_best_match(IntType probe_value) const {
141
72
        if (asof_values.empty()) {
142
4
            return 0;
143
4
        }
144
68
        if constexpr (IsGreater) {
145
36
            size_t pos = IsStrict ? lower_bound(probe_value) : upper_bound(probe_value);
146
36
            return pos > 0 ? row_indexes[pos - 1] : 0;
147
36
        } else {
148
32
            size_t pos = IsStrict ? upper_bound(probe_value) : lower_bound(probe_value);
149
32
            return pos < asof_values.size() ? row_indexes[pos] : 0;
150
32
        }
151
68
    }
_ZNK5doris14AsofIndexGroupIjE15find_best_matchILb1ELb0EEEjj
Line
Count
Source
140
19
    ALWAYS_INLINE uint32_t find_best_match(IntType probe_value) const {
141
19
        if (asof_values.empty()) {
142
1
            return 0;
143
1
        }
144
18
        if constexpr (IsGreater) {
145
18
            size_t pos = IsStrict ? lower_bound(probe_value) : upper_bound(probe_value);
146
18
            return pos > 0 ? row_indexes[pos - 1] : 0;
147
        } else {
148
            size_t pos = IsStrict ? upper_bound(probe_value) : lower_bound(probe_value);
149
            return pos < asof_values.size() ? row_indexes[pos] : 0;
150
        }
151
18
    }
_ZNK5doris14AsofIndexGroupIjE15find_best_matchILb1ELb1EEEjj
Line
Count
Source
140
15
    ALWAYS_INLINE uint32_t find_best_match(IntType probe_value) const {
141
15
        if (asof_values.empty()) {
142
1
            return 0;
143
1
        }
144
14
        if constexpr (IsGreater) {
145
14
            size_t pos = IsStrict ? lower_bound(probe_value) : upper_bound(probe_value);
146
14
            return pos > 0 ? row_indexes[pos - 1] : 0;
147
        } else {
148
            size_t pos = IsStrict ? upper_bound(probe_value) : lower_bound(probe_value);
149
            return pos < asof_values.size() ? row_indexes[pos] : 0;
150
        }
151
14
    }
_ZNK5doris14AsofIndexGroupIjE15find_best_matchILb0ELb0EEEjj
Line
Count
Source
140
15
    ALWAYS_INLINE uint32_t find_best_match(IntType probe_value) const {
141
15
        if (asof_values.empty()) {
142
1
            return 0;
143
1
        }
144
        if constexpr (IsGreater) {
145
            size_t pos = IsStrict ? lower_bound(probe_value) : upper_bound(probe_value);
146
            return pos > 0 ? row_indexes[pos - 1] : 0;
147
14
        } else {
148
14
            size_t pos = IsStrict ? upper_bound(probe_value) : lower_bound(probe_value);
149
14
            return pos < asof_values.size() ? row_indexes[pos] : 0;
150
14
        }
151
14
    }
_ZNK5doris14AsofIndexGroupIjE15find_best_matchILb0ELb1EEEjj
Line
Count
Source
140
16
    ALWAYS_INLINE uint32_t find_best_match(IntType probe_value) const {
141
16
        if (asof_values.empty()) {
142
1
            return 0;
143
1
        }
144
        if constexpr (IsGreater) {
145
            size_t pos = IsStrict ? lower_bound(probe_value) : upper_bound(probe_value);
146
            return pos > 0 ? row_indexes[pos - 1] : 0;
147
15
        } else {
148
15
            size_t pos = IsStrict ? upper_bound(probe_value) : lower_bound(probe_value);
149
15
            return pos < asof_values.size() ? row_indexes[pos] : 0;
150
15
        }
151
15
    }
_ZNK5doris14AsofIndexGroupImE15find_best_matchILb1ELb0EEEjm
Line
Count
Source
140
1
    ALWAYS_INLINE uint32_t find_best_match(IntType probe_value) const {
141
1
        if (asof_values.empty()) {
142
0
            return 0;
143
0
        }
144
1
        if constexpr (IsGreater) {
145
1
            size_t pos = IsStrict ? lower_bound(probe_value) : upper_bound(probe_value);
146
1
            return pos > 0 ? row_indexes[pos - 1] : 0;
147
        } else {
148
            size_t pos = IsStrict ? upper_bound(probe_value) : lower_bound(probe_value);
149
            return pos < asof_values.size() ? row_indexes[pos] : 0;
150
        }
151
1
    }
_ZNK5doris14AsofIndexGroupImE15find_best_matchILb1ELb1EEEjm
Line
Count
Source
140
1
    ALWAYS_INLINE uint32_t find_best_match(IntType probe_value) const {
141
1
        if (asof_values.empty()) {
142
0
            return 0;
143
0
        }
144
1
        if constexpr (IsGreater) {
145
1
            size_t pos = IsStrict ? lower_bound(probe_value) : upper_bound(probe_value);
146
1
            return pos > 0 ? row_indexes[pos - 1] : 0;
147
        } else {
148
            size_t pos = IsStrict ? upper_bound(probe_value) : lower_bound(probe_value);
149
            return pos < asof_values.size() ? row_indexes[pos] : 0;
150
        }
151
1
    }
_ZNK5doris14AsofIndexGroupImE15find_best_matchILb0ELb0EEEjm
Line
Count
Source
140
1
    ALWAYS_INLINE uint32_t find_best_match(IntType probe_value) const {
141
1
        if (asof_values.empty()) {
142
0
            return 0;
143
0
        }
144
        if constexpr (IsGreater) {
145
            size_t pos = IsStrict ? lower_bound(probe_value) : upper_bound(probe_value);
146
            return pos > 0 ? row_indexes[pos - 1] : 0;
147
1
        } else {
148
1
            size_t pos = IsStrict ? upper_bound(probe_value) : lower_bound(probe_value);
149
1
            return pos < asof_values.size() ? row_indexes[pos] : 0;
150
1
        }
151
1
    }
_ZNK5doris14AsofIndexGroupImE15find_best_matchILb0ELb1EEEjm
Line
Count
Source
140
1
    ALWAYS_INLINE uint32_t find_best_match(IntType probe_value) const {
141
1
        if (asof_values.empty()) {
142
0
            return 0;
143
0
        }
144
        if constexpr (IsGreater) {
145
            size_t pos = IsStrict ? lower_bound(probe_value) : upper_bound(probe_value);
146
            return pos > 0 ? row_indexes[pos - 1] : 0;
147
1
        } else {
148
1
            size_t pos = IsStrict ? upper_bound(probe_value) : lower_bound(probe_value);
149
1
            return pos < asof_values.size() ? row_indexes[pos] : 0;
150
1
        }
151
1
    }
_ZNK5doris14AsofIndexGroupIoE15find_best_matchILb1ELb0EEEjo
Line
Count
Source
140
1
    ALWAYS_INLINE uint32_t find_best_match(IntType probe_value) const {
141
1
        if (asof_values.empty()) {
142
0
            return 0;
143
0
        }
144
1
        if constexpr (IsGreater) {
145
1
            size_t pos = IsStrict ? lower_bound(probe_value) : upper_bound(probe_value);
146
1
            return pos > 0 ? row_indexes[pos - 1] : 0;
147
        } else {
148
            size_t pos = IsStrict ? upper_bound(probe_value) : lower_bound(probe_value);
149
            return pos < asof_values.size() ? row_indexes[pos] : 0;
150
        }
151
1
    }
_ZNK5doris14AsofIndexGroupIoE15find_best_matchILb1ELb1EEEjo
Line
Count
Source
140
1
    ALWAYS_INLINE uint32_t find_best_match(IntType probe_value) const {
141
1
        if (asof_values.empty()) {
142
0
            return 0;
143
0
        }
144
1
        if constexpr (IsGreater) {
145
1
            size_t pos = IsStrict ? lower_bound(probe_value) : upper_bound(probe_value);
146
1
            return pos > 0 ? row_indexes[pos - 1] : 0;
147
        } else {
148
            size_t pos = IsStrict ? upper_bound(probe_value) : lower_bound(probe_value);
149
            return pos < asof_values.size() ? row_indexes[pos] : 0;
150
        }
151
1
    }
_ZNK5doris14AsofIndexGroupIoE15find_best_matchILb0ELb0EEEjo
Line
Count
Source
140
1
    ALWAYS_INLINE uint32_t find_best_match(IntType probe_value) const {
141
1
        if (asof_values.empty()) {
142
0
            return 0;
143
0
        }
144
        if constexpr (IsGreater) {
145
            size_t pos = IsStrict ? lower_bound(probe_value) : upper_bound(probe_value);
146
            return pos > 0 ? row_indexes[pos - 1] : 0;
147
1
        } else {
148
1
            size_t pos = IsStrict ? upper_bound(probe_value) : lower_bound(probe_value);
149
1
            return pos < asof_values.size() ? row_indexes[pos] : 0;
150
1
        }
151
1
    }
Unexecuted instantiation: _ZNK5doris14AsofIndexGroupIlE15find_best_matchILb1ELb1EEEjl
Unexecuted instantiation: _ZNK5doris14AsofIndexGroupIlE15find_best_matchILb1ELb0EEEjl
Unexecuted instantiation: _ZNK5doris14AsofIndexGroupIlE15find_best_matchILb0ELb1EEEjl
Unexecuted instantiation: _ZNK5doris14AsofIndexGroupIlE15find_best_matchILb0ELb0EEEjl
Unexecuted instantiation: _ZNK5doris14AsofIndexGroupIoE15find_best_matchILb0ELb1EEEjo
152
};
153
154
using AsofMixedDateTimeKey = unsigned __int128;
155
156
// Type-erased container for all ASOF index groups.
157
// DateV2 -> uint32_t, DateTimeV2/TimestampTZ -> uint64_t, TimestampNs -> int64_t.
158
// Mixed TimestampNs/DateTimeV2 uses a wider packed civil key with three extra
159
// nanosecond digits, so neither side is narrowed to the other's physical type.
160
using AsofIndexVariant =
161
        std::variant<std::monostate, std::vector<AsofIndexGroup<uint32_t>>,
162
                     std::vector<AsofIndexGroup<uint64_t>>, std::vector<AsofIndexGroup<int64_t>>,
163
                     std::vector<AsofIndexGroup<AsofMixedDateTimeKey>>>;
164
165
} // namespace doris