Coverage Report

Created: 2026-09-28 17:01

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
672k
inline bool is_asof_join(TJoinOp::type join_op) {
52
672k
    return join_op == TJoinOp::ASOF_LEFT_INNER_JOIN || join_op == TJoinOp::ASOF_LEFT_OUTER_JOIN;
53
672k
}
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
2.14k
    void add_row(IntType value, uint32_t row_idx) { entries.push_back({value, row_idx}); }
_ZN5doris14AsofIndexGroupIjE7add_rowEjj
Line
Count
Source
82
2.11k
    void add_row(IntType value, uint32_t row_idx) { entries.push_back({value, row_idx}); }
_ZN5doris14AsofIndexGroupImE7add_rowEmj
Line
Count
Source
82
24
    void add_row(IntType value, uint32_t row_idx) { entries.push_back({value, row_idx}); }
_ZN5doris14AsofIndexGroupIoE7add_rowEoj
Line
Count
Source
82
6
    void add_row(IntType value, uint32_t row_idx) { entries.push_back({value, row_idx}); }
_ZN5doris14AsofIndexGroupIlE7add_rowElj
Line
Count
Source
82
4
    void add_row(IntType value, uint32_t row_idx) { entries.push_back({value, row_idx}); }
83
84
54
    void sort_and_finalize() {
85
54
        if (entries.empty()) {
86
8
            return;
87
8
        }
88
46
        if (entries.size() > 1) {
89
36
            pdqsort(entries.begin(), entries.end(),
90
4.14k
                    [](const Entry& a, const Entry& b) { return a.asof_value < b.asof_value; });
_ZZN5doris14AsofIndexGroupIjE17sort_and_finalizeEvENKUlRKNS1_5EntryES4_E_clES4_S4_
Line
Count
Source
90
4.12k
                    [](const Entry& a, const Entry& b) { return a.asof_value < b.asof_value; });
_ZZN5doris14AsofIndexGroupImE17sort_and_finalizeEvENKUlRKNS1_5EntryES4_E_clES4_S4_
Line
Count
Source
90
18
                    [](const Entry& a, const Entry& b) { return a.asof_value < b.asof_value; });
_ZZN5doris14AsofIndexGroupIoE17sort_and_finalizeEvENKUlRKNS1_5EntryES4_E_clES4_S4_
Line
Count
Source
90
2
                    [](const Entry& a, const Entry& b) { return a.asof_value < b.asof_value; });
_ZZN5doris14AsofIndexGroupIlE17sort_and_finalizeEvENKUlRKNS1_5EntryES4_E_clES4_S4_
Line
Count
Source
90
2
                    [](const Entry& a, const Entry& b) { return a.asof_value < b.asof_value; });
91
36
        }
92
93
46
        asof_values.resize(entries.size());
94
46
        row_indexes.resize(entries.size());
95
2.19k
        for (size_t i = 0; i < entries.size(); ++i) {
96
2.14k
            asof_values[i] = entries[i].asof_value;
97
2.14k
            row_indexes[i] = entries[i].row_index;
98
2.14k
        }
99
100
46
        std::vector<Entry>().swap(entries);
101
46
    }
_ZN5doris14AsofIndexGroupIjE17sort_and_finalizeEv
Line
Count
Source
84
40
    void sort_and_finalize() {
85
40
        if (entries.empty()) {
86
8
            return;
87
8
        }
88
32
        if (entries.size() > 1) {
89
26
            pdqsort(entries.begin(), entries.end(),
90
26
                    [](const Entry& a, const Entry& b) { return a.asof_value < b.asof_value; });
91
26
        }
92
93
32
        asof_values.resize(entries.size());
94
32
        row_indexes.resize(entries.size());
95
2.14k
        for (size_t i = 0; i < entries.size(); ++i) {
96
2.11k
            asof_values[i] = entries[i].asof_value;
97
2.11k
            row_indexes[i] = entries[i].row_index;
98
2.11k
        }
99
100
32
        std::vector<Entry>().swap(entries);
101
32
    }
_ZN5doris14AsofIndexGroupImE17sort_and_finalizeEv
Line
Count
Source
84
8
    void sort_and_finalize() {
85
8
        if (entries.empty()) {
86
0
            return;
87
0
        }
88
8
        if (entries.size() > 1) {
89
6
            pdqsort(entries.begin(), entries.end(),
90
6
                    [](const Entry& a, const Entry& b) { return a.asof_value < b.asof_value; });
91
6
        }
92
93
8
        asof_values.resize(entries.size());
94
8
        row_indexes.resize(entries.size());
95
32
        for (size_t i = 0; i < entries.size(); ++i) {
96
24
            asof_values[i] = entries[i].asof_value;
97
24
            row_indexes[i] = entries[i].row_index;
98
24
        }
99
100
8
        std::vector<Entry>().swap(entries);
101
8
    }
_ZN5doris14AsofIndexGroupIoE17sort_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
2
            pdqsort(entries.begin(), entries.end(),
90
2
                    [](const Entry& a, const Entry& b) { return a.asof_value < b.asof_value; });
91
2
        }
92
93
4
        asof_values.resize(entries.size());
94
4
        row_indexes.resize(entries.size());
95
10
        for (size_t i = 0; i < entries.size(); ++i) {
96
6
            asof_values[i] = entries[i].asof_value;
97
6
            row_indexes[i] = entries[i].row_index;
98
6
        }
99
100
4
        std::vector<Entry>().swap(entries);
101
4
    }
_ZN5doris14AsofIndexGroupIlE17sort_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
2
            pdqsort(entries.begin(), entries.end(),
90
2
                    [](const Entry& a, const Entry& b) { return a.asof_value < b.asof_value; });
91
2
        }
92
93
2
        asof_values.resize(entries.size());
94
2
        row_indexes.resize(entries.size());
95
6
        for (size_t i = 0; i < entries.size(); ++i) {
96
4
            asof_values[i] = entries[i].asof_value;
97
4
            row_indexes[i] = entries[i].row_index;
98
4
        }
99
100
2
        std::vector<Entry>().swap(entries);
101
2
    }
102
103
2
    const IntType* values_data() const { return asof_values.data(); }
_ZNK5doris14AsofIndexGroupIjE11values_dataEv
Line
Count
Source
103
2
    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
82
    ALWAYS_INLINE size_t lower_bound(IntType target) const {
107
82
        size_t lo = 0, n = asof_values.size();
108
370
        while (n > 1) {
109
288
            size_t half = n / 2;
110
288
            lo += half * (asof_values[lo + half] < target);
111
288
            n -= half;
112
288
        }
113
82
        if (lo < asof_values.size()) {
114
80
            lo += (asof_values[lo] < target);
115
80
        }
116
82
        return lo;
117
82
    }
_ZNK5doris14AsofIndexGroupIjE11lower_boundEj
Line
Count
Source
106
66
    ALWAYS_INLINE size_t lower_bound(IntType target) const {
107
66
        size_t lo = 0, n = asof_values.size();
108
326
        while (n > 1) {
109
260
            size_t half = n / 2;
110
260
            lo += half * (asof_values[lo + half] < target);
111
260
            n -= half;
112
260
        }
113
66
        if (lo < asof_values.size()) {
114
64
            lo += (asof_values[lo] < target);
115
64
        }
116
66
        return lo;
117
66
    }
_ZNK5doris14AsofIndexGroupImE11lower_boundEm
Line
Count
Source
106
12
    ALWAYS_INLINE size_t lower_bound(IntType target) const {
107
12
        size_t lo = 0, n = asof_values.size();
108
36
        while (n > 1) {
109
24
            size_t half = n / 2;
110
24
            lo += half * (asof_values[lo + half] < target);
111
24
            n -= half;
112
24
        }
113
12
        if (lo < asof_values.size()) {
114
12
            lo += (asof_values[lo] < target);
115
12
        }
116
12
        return lo;
117
12
    }
_ZNK5doris14AsofIndexGroupIoE11lower_boundEo
Line
Count
Source
106
4
    ALWAYS_INLINE size_t lower_bound(IntType target) const {
107
4
        size_t lo = 0, n = asof_values.size();
108
8
        while (n > 1) {
109
4
            size_t half = n / 2;
110
4
            lo += half * (asof_values[lo + half] < target);
111
4
            n -= half;
112
4
        }
113
4
        if (lo < asof_values.size()) {
114
4
            lo += (asof_values[lo] < target);
115
4
        }
116
4
        return lo;
117
4
    }
Unexecuted instantiation: _ZNK5doris14AsofIndexGroupIlE11lower_boundEl
118
119
    // Branchless upper_bound: first i where asof_values[i] > target
120
90
    ALWAYS_INLINE size_t upper_bound(IntType target) const {
121
90
        size_t lo = 0, n = asof_values.size();
122
456
        while (n > 1) {
123
366
            size_t half = n / 2;
124
366
            lo += half * (asof_values[lo + half] <= target);
125
366
            n -= half;
126
366
        }
127
90
        if (lo < asof_values.size()) {
128
88
            lo += (asof_values[lo] <= target);
129
88
        }
130
90
        return lo;
131
90
    }
_ZNK5doris14AsofIndexGroupIjE11upper_boundEj
Line
Count
Source
120
76
    ALWAYS_INLINE size_t upper_bound(IntType target) const {
121
76
        size_t lo = 0, n = asof_values.size();
122
416
        while (n > 1) {
123
340
            size_t half = n / 2;
124
340
            lo += half * (asof_values[lo + half] <= target);
125
340
            n -= half;
126
340
        }
127
76
        if (lo < asof_values.size()) {
128
74
            lo += (asof_values[lo] <= target);
129
74
        }
130
76
        return lo;
131
76
    }
_ZNK5doris14AsofIndexGroupImE11upper_boundEm
Line
Count
Source
120
12
    ALWAYS_INLINE size_t upper_bound(IntType target) const {
121
12
        size_t lo = 0, n = asof_values.size();
122
36
        while (n > 1) {
123
24
            size_t half = n / 2;
124
24
            lo += half * (asof_values[lo + half] <= target);
125
24
            n -= half;
126
24
        }
127
12
        if (lo < asof_values.size()) {
128
12
            lo += (asof_values[lo] <= target);
129
12
        }
130
12
        return lo;
131
12
    }
_ZNK5doris14AsofIndexGroupIoE11upper_boundEo
Line
Count
Source
120
2
    ALWAYS_INLINE size_t upper_bound(IntType target) const {
121
2
        size_t lo = 0, n = asof_values.size();
122
4
        while (n > 1) {
123
2
            size_t half = n / 2;
124
2
            lo += half * (asof_values[lo + half] <= target);
125
2
            n -= half;
126
2
        }
127
2
        if (lo < asof_values.size()) {
128
2
            lo += (asof_values[lo] <= target);
129
2
        }
130
2
        return lo;
131
2
    }
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
144
    ALWAYS_INLINE uint32_t find_best_match(IntType probe_value) const {
141
144
        if (asof_values.empty()) {
142
8
            return 0;
143
8
        }
144
136
        if constexpr (IsGreater) {
145
72
            size_t pos = IsStrict ? lower_bound(probe_value) : upper_bound(probe_value);
146
72
            return pos > 0 ? row_indexes[pos - 1] : 0;
147
72
        } else {
148
64
            size_t pos = IsStrict ? upper_bound(probe_value) : lower_bound(probe_value);
149
64
            return pos < asof_values.size() ? row_indexes[pos] : 0;
150
64
        }
151
136
    }
_ZNK5doris14AsofIndexGroupIjE15find_best_matchILb1ELb0EEEjj
Line
Count
Source
140
38
    ALWAYS_INLINE uint32_t find_best_match(IntType probe_value) const {
141
38
        if (asof_values.empty()) {
142
2
            return 0;
143
2
        }
144
36
        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
        } 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
36
    }
_ZNK5doris14AsofIndexGroupIjE15find_best_matchILb1ELb1EEEjj
Line
Count
Source
140
30
    ALWAYS_INLINE uint32_t find_best_match(IntType probe_value) const {
141
30
        if (asof_values.empty()) {
142
2
            return 0;
143
2
        }
144
28
        if constexpr (IsGreater) {
145
28
            size_t pos = IsStrict ? lower_bound(probe_value) : upper_bound(probe_value);
146
28
            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
28
    }
_ZNK5doris14AsofIndexGroupIjE15find_best_matchILb0ELb0EEEjj
Line
Count
Source
140
30
    ALWAYS_INLINE uint32_t find_best_match(IntType probe_value) const {
141
30
        if (asof_values.empty()) {
142
2
            return 0;
143
2
        }
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
28
        } else {
148
28
            size_t pos = IsStrict ? upper_bound(probe_value) : lower_bound(probe_value);
149
28
            return pos < asof_values.size() ? row_indexes[pos] : 0;
150
28
        }
151
28
    }
_ZNK5doris14AsofIndexGroupIjE15find_best_matchILb0ELb1EEEjj
Line
Count
Source
140
32
    ALWAYS_INLINE uint32_t find_best_match(IntType probe_value) const {
141
32
        if (asof_values.empty()) {
142
2
            return 0;
143
2
        }
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
30
        } else {
148
30
            size_t pos = IsStrict ? upper_bound(probe_value) : lower_bound(probe_value);
149
30
            return pos < asof_values.size() ? row_indexes[pos] : 0;
150
30
        }
151
30
    }
_ZNK5doris14AsofIndexGroupImE15find_best_matchILb1ELb0EEEjm
Line
Count
Source
140
2
    ALWAYS_INLINE uint32_t find_best_match(IntType probe_value) const {
141
2
        if (asof_values.empty()) {
142
0
            return 0;
143
0
        }
144
2
        if constexpr (IsGreater) {
145
2
            size_t pos = IsStrict ? lower_bound(probe_value) : upper_bound(probe_value);
146
2
            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
2
    }
_ZNK5doris14AsofIndexGroupImE15find_best_matchILb1ELb1EEEjm
Line
Count
Source
140
2
    ALWAYS_INLINE uint32_t find_best_match(IntType probe_value) const {
141
2
        if (asof_values.empty()) {
142
0
            return 0;
143
0
        }
144
2
        if constexpr (IsGreater) {
145
2
            size_t pos = IsStrict ? lower_bound(probe_value) : upper_bound(probe_value);
146
2
            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
2
    }
_ZNK5doris14AsofIndexGroupImE15find_best_matchILb0ELb0EEEjm
Line
Count
Source
140
2
    ALWAYS_INLINE uint32_t find_best_match(IntType probe_value) const {
141
2
        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
2
        } else {
148
2
            size_t pos = IsStrict ? upper_bound(probe_value) : lower_bound(probe_value);
149
2
            return pos < asof_values.size() ? row_indexes[pos] : 0;
150
2
        }
151
2
    }
_ZNK5doris14AsofIndexGroupImE15find_best_matchILb0ELb1EEEjm
Line
Count
Source
140
2
    ALWAYS_INLINE uint32_t find_best_match(IntType probe_value) const {
141
2
        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
2
        } else {
148
2
            size_t pos = IsStrict ? upper_bound(probe_value) : lower_bound(probe_value);
149
2
            return pos < asof_values.size() ? row_indexes[pos] : 0;
150
2
        }
151
2
    }
_ZNK5doris14AsofIndexGroupIoE15find_best_matchILb1ELb0EEEjo
Line
Count
Source
140
2
    ALWAYS_INLINE uint32_t find_best_match(IntType probe_value) const {
141
2
        if (asof_values.empty()) {
142
0
            return 0;
143
0
        }
144
2
        if constexpr (IsGreater) {
145
2
            size_t pos = IsStrict ? lower_bound(probe_value) : upper_bound(probe_value);
146
2
            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
2
    }
_ZNK5doris14AsofIndexGroupIoE15find_best_matchILb1ELb1EEEjo
Line
Count
Source
140
2
    ALWAYS_INLINE uint32_t find_best_match(IntType probe_value) const {
141
2
        if (asof_values.empty()) {
142
0
            return 0;
143
0
        }
144
2
        if constexpr (IsGreater) {
145
2
            size_t pos = IsStrict ? lower_bound(probe_value) : upper_bound(probe_value);
146
2
            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
2
    }
_ZNK5doris14AsofIndexGroupIoE15find_best_matchILb0ELb0EEEjo
Line
Count
Source
140
2
    ALWAYS_INLINE uint32_t find_best_match(IntType probe_value) const {
141
2
        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
2
        } else {
148
2
            size_t pos = IsStrict ? upper_bound(probe_value) : lower_bound(probe_value);
149
2
            return pos < asof_values.size() ? row_indexes[pos] : 0;
150
2
        }
151
2
    }
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