be/src/exprs/function/array/function_arrays_overlap.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 | | #pragma once |
18 | | |
19 | | #include <fmt/format.h> |
20 | | #include <glog/logging.h> |
21 | | #include <sys/types.h> |
22 | | |
23 | | #include <boost/iterator/iterator_facade.hpp> |
24 | | #include <memory> |
25 | | #include <ostream> |
26 | | #include <utility> |
27 | | |
28 | | #include "common/status.h" |
29 | | #include "core/assert_cast.h" |
30 | | #include "core/block/block.h" |
31 | | #include "core/block/column_numbers.h" |
32 | | #include "core/block/column_with_type_and_name.h" |
33 | | #include "core/column/column.h" |
34 | | #include "core/column/column_nullable.h" |
35 | | #include "core/column/column_vector.h" |
36 | | #include "core/data_type/data_type.h" |
37 | | #include "core/data_type/data_type_array.h" |
38 | | #include "core/data_type/data_type_nullable.h" |
39 | | #include "core/data_type/data_type_number.h" |
40 | | #include "core/string_ref.h" |
41 | | #include "core/types.h" |
42 | | #include "exec/common/hash_table/hash.h" |
43 | | #include "exprs/function/array/function_array_index.h" |
44 | | #include "exprs/function/array/function_array_utils.h" |
45 | | #include "exprs/function/function.h" |
46 | | #include "exprs/function/function_helpers.h" |
47 | | |
48 | | namespace doris { |
49 | | class FunctionContext; |
50 | | } // namespace doris |
51 | | template <typename, typename> |
52 | | struct DefaultHash; |
53 | | |
54 | | namespace doris { |
55 | | |
56 | | template <typename T> |
57 | | class ColumnStr; |
58 | | using ColumnString = ColumnStr<UInt32>; |
59 | | |
60 | | template <typename T> |
61 | | struct OverlapSetImpl { |
62 | | using ElementNativeType = typename NativeType<typename T::value_type>::Type; |
63 | | using Set = phmap::flat_hash_set<ElementNativeType, DefaultHash<ElementNativeType>>; |
64 | | Set set; |
65 | | bool has_null = false; |
66 | | |
67 | 4 | void insert_array(const IColumn* column, const UInt8* nullmap, size_t start, size_t size) { |
68 | 4 | const auto& vec = assert_cast<const T&>(*column).get_data(); |
69 | 9 | for (size_t i = start; i < start + size; ++i) { |
70 | 5 | if (nullmap[i]) { |
71 | 0 | has_null = true; |
72 | 0 | continue; |
73 | 0 | } |
74 | 5 | set.insert(vec[i]); |
75 | 5 | } |
76 | 4 | } Unexecuted instantiation: _ZN5doris14OverlapSetImplINS_12ColumnVectorILNS_13PrimitiveTypeE2EEEE12insert_arrayEPKNS_7IColumnEPKhmm Unexecuted instantiation: _ZN5doris14OverlapSetImplINS_12ColumnVectorILNS_13PrimitiveTypeE3EEEE12insert_arrayEPKNS_7IColumnEPKhmm Unexecuted instantiation: _ZN5doris14OverlapSetImplINS_12ColumnVectorILNS_13PrimitiveTypeE4EEEE12insert_arrayEPKNS_7IColumnEPKhmm _ZN5doris14OverlapSetImplINS_12ColumnVectorILNS_13PrimitiveTypeE5EEEE12insert_arrayEPKNS_7IColumnEPKhmm Line | Count | Source | 67 | 2 | void insert_array(const IColumn* column, const UInt8* nullmap, size_t start, size_t size) { | 68 | 2 | const auto& vec = assert_cast<const T&>(*column).get_data(); | 69 | 5 | for (size_t i = start; i < start + size; ++i) { | 70 | 3 | if (nullmap[i]) { | 71 | 0 | has_null = true; | 72 | 0 | continue; | 73 | 0 | } | 74 | 3 | set.insert(vec[i]); | 75 | 3 | } | 76 | 2 | } |
Unexecuted instantiation: _ZN5doris14OverlapSetImplINS_12ColumnVectorILNS_13PrimitiveTypeE6EEEE12insert_arrayEPKNS_7IColumnEPKhmm _ZN5doris14OverlapSetImplINS_12ColumnVectorILNS_13PrimitiveTypeE7EEEE12insert_arrayEPKNS_7IColumnEPKhmm Line | Count | Source | 67 | 1 | void insert_array(const IColumn* column, const UInt8* nullmap, size_t start, size_t size) { | 68 | 1 | const auto& vec = assert_cast<const T&>(*column).get_data(); | 69 | 2 | for (size_t i = start; i < start + size; ++i) { | 70 | 1 | if (nullmap[i]) { | 71 | 0 | has_null = true; | 72 | 0 | continue; | 73 | 0 | } | 74 | 1 | set.insert(vec[i]); | 75 | 1 | } | 76 | 1 | } |
Unexecuted instantiation: _ZN5doris14OverlapSetImplINS_12ColumnVectorILNS_13PrimitiveTypeE8EEEE12insert_arrayEPKNS_7IColumnEPKhmm _ZN5doris14OverlapSetImplINS_12ColumnVectorILNS_13PrimitiveTypeE9EEEE12insert_arrayEPKNS_7IColumnEPKhmm Line | Count | Source | 67 | 1 | void insert_array(const IColumn* column, const UInt8* nullmap, size_t start, size_t size) { | 68 | 1 | const auto& vec = assert_cast<const T&>(*column).get_data(); | 69 | 2 | for (size_t i = start; i < start + size; ++i) { | 70 | 1 | if (nullmap[i]) { | 71 | 0 | has_null = true; | 72 | 0 | continue; | 73 | 0 | } | 74 | 1 | set.insert(vec[i]); | 75 | 1 | } | 76 | 1 | } |
Unexecuted instantiation: _ZN5doris14OverlapSetImplINS_13ColumnDecimalILNS_13PrimitiveTypeE28EEEE12insert_arrayEPKNS_7IColumnEPKhmm Unexecuted instantiation: _ZN5doris14OverlapSetImplINS_13ColumnDecimalILNS_13PrimitiveTypeE29EEEE12insert_arrayEPKNS_7IColumnEPKhmm Unexecuted instantiation: _ZN5doris14OverlapSetImplINS_13ColumnDecimalILNS_13PrimitiveTypeE30EEEE12insert_arrayEPKNS_7IColumnEPKhmm Unexecuted instantiation: _ZN5doris14OverlapSetImplINS_13ColumnDecimalILNS_13PrimitiveTypeE35EEEE12insert_arrayEPKNS_7IColumnEPKhmm Unexecuted instantiation: _ZN5doris14OverlapSetImplINS_12ColumnVectorILNS_13PrimitiveTypeE11EEEE12insert_arrayEPKNS_7IColumnEPKhmm Unexecuted instantiation: _ZN5doris14OverlapSetImplINS_12ColumnVectorILNS_13PrimitiveTypeE25EEEE12insert_arrayEPKNS_7IColumnEPKhmm Unexecuted instantiation: _ZN5doris14OverlapSetImplINS_12ColumnVectorILNS_13PrimitiveTypeE26EEEE12insert_arrayEPKNS_7IColumnEPKhmm Unexecuted instantiation: _ZN5doris14OverlapSetImplINS_12ColumnVectorILNS_13PrimitiveTypeE12EEEE12insert_arrayEPKNS_7IColumnEPKhmm Unexecuted instantiation: _ZN5doris14OverlapSetImplINS_12ColumnVectorILNS_13PrimitiveTypeE27EEEE12insert_arrayEPKNS_7IColumnEPKhmm Unexecuted instantiation: _ZN5doris14OverlapSetImplINS_12ColumnVectorILNS_13PrimitiveTypeE42EEEE12insert_arrayEPKNS_7IColumnEPKhmm Unexecuted instantiation: _ZN5doris14OverlapSetImplINS_12ColumnVectorILNS_13PrimitiveTypeE36EEEE12insert_arrayEPKNS_7IColumnEPKhmm Unexecuted instantiation: _ZN5doris14OverlapSetImplINS_12ColumnVectorILNS_13PrimitiveTypeE37EEEE12insert_arrayEPKNS_7IColumnEPKhmm |
77 | | |
78 | 4 | bool find_any(const IColumn* column, const UInt8* nullmap, size_t start, size_t size) { |
79 | 4 | const auto& vec = assert_cast<const T&>(*column).get_data(); |
80 | 9 | for (size_t i = start; i < start + size; ++i) { |
81 | 8 | if (nullmap[i]) { |
82 | 0 | if (has_null) { |
83 | 0 | return true; |
84 | 0 | } else { |
85 | 0 | continue; |
86 | 0 | } |
87 | 0 | } |
88 | | |
89 | 8 | if (set.contains(vec[i])) { |
90 | 3 | return true; |
91 | 3 | } |
92 | 8 | } |
93 | 1 | return false; |
94 | 4 | } Unexecuted instantiation: _ZN5doris14OverlapSetImplINS_12ColumnVectorILNS_13PrimitiveTypeE2EEEE8find_anyEPKNS_7IColumnEPKhmm Unexecuted instantiation: _ZN5doris14OverlapSetImplINS_12ColumnVectorILNS_13PrimitiveTypeE3EEEE8find_anyEPKNS_7IColumnEPKhmm Unexecuted instantiation: _ZN5doris14OverlapSetImplINS_12ColumnVectorILNS_13PrimitiveTypeE4EEEE8find_anyEPKNS_7IColumnEPKhmm _ZN5doris14OverlapSetImplINS_12ColumnVectorILNS_13PrimitiveTypeE5EEEE8find_anyEPKNS_7IColumnEPKhmm Line | Count | Source | 78 | 2 | bool find_any(const IColumn* column, const UInt8* nullmap, size_t start, size_t size) { | 79 | 2 | const auto& vec = assert_cast<const T&>(*column).get_data(); | 80 | 7 | for (size_t i = start; i < start + size; ++i) { | 81 | 6 | if (nullmap[i]) { | 82 | 0 | if (has_null) { | 83 | 0 | return true; | 84 | 0 | } else { | 85 | 0 | continue; | 86 | 0 | } | 87 | 0 | } | 88 | | | 89 | 6 | if (set.contains(vec[i])) { | 90 | 1 | return true; | 91 | 1 | } | 92 | 6 | } | 93 | 1 | return false; | 94 | 2 | } |
Unexecuted instantiation: _ZN5doris14OverlapSetImplINS_12ColumnVectorILNS_13PrimitiveTypeE6EEEE8find_anyEPKNS_7IColumnEPKhmm _ZN5doris14OverlapSetImplINS_12ColumnVectorILNS_13PrimitiveTypeE7EEEE8find_anyEPKNS_7IColumnEPKhmm Line | Count | Source | 78 | 1 | bool find_any(const IColumn* column, const UInt8* nullmap, size_t start, size_t size) { | 79 | 1 | const auto& vec = assert_cast<const T&>(*column).get_data(); | 80 | 1 | for (size_t i = start; i < start + size; ++i) { | 81 | 1 | if (nullmap[i]) { | 82 | 0 | if (has_null) { | 83 | 0 | return true; | 84 | 0 | } else { | 85 | 0 | continue; | 86 | 0 | } | 87 | 0 | } | 88 | | | 89 | 1 | if (set.contains(vec[i])) { | 90 | 1 | return true; | 91 | 1 | } | 92 | 1 | } | 93 | 0 | return false; | 94 | 1 | } |
Unexecuted instantiation: _ZN5doris14OverlapSetImplINS_12ColumnVectorILNS_13PrimitiveTypeE8EEEE8find_anyEPKNS_7IColumnEPKhmm _ZN5doris14OverlapSetImplINS_12ColumnVectorILNS_13PrimitiveTypeE9EEEE8find_anyEPKNS_7IColumnEPKhmm Line | Count | Source | 78 | 1 | bool find_any(const IColumn* column, const UInt8* nullmap, size_t start, size_t size) { | 79 | 1 | const auto& vec = assert_cast<const T&>(*column).get_data(); | 80 | 1 | for (size_t i = start; i < start + size; ++i) { | 81 | 1 | if (nullmap[i]) { | 82 | 0 | if (has_null) { | 83 | 0 | return true; | 84 | 0 | } else { | 85 | 0 | continue; | 86 | 0 | } | 87 | 0 | } | 88 | | | 89 | 1 | if (set.contains(vec[i])) { | 90 | 1 | return true; | 91 | 1 | } | 92 | 1 | } | 93 | 0 | return false; | 94 | 1 | } |
Unexecuted instantiation: _ZN5doris14OverlapSetImplINS_13ColumnDecimalILNS_13PrimitiveTypeE28EEEE8find_anyEPKNS_7IColumnEPKhmm Unexecuted instantiation: _ZN5doris14OverlapSetImplINS_13ColumnDecimalILNS_13PrimitiveTypeE29EEEE8find_anyEPKNS_7IColumnEPKhmm Unexecuted instantiation: _ZN5doris14OverlapSetImplINS_13ColumnDecimalILNS_13PrimitiveTypeE30EEEE8find_anyEPKNS_7IColumnEPKhmm Unexecuted instantiation: _ZN5doris14OverlapSetImplINS_13ColumnDecimalILNS_13PrimitiveTypeE35EEEE8find_anyEPKNS_7IColumnEPKhmm Unexecuted instantiation: _ZN5doris14OverlapSetImplINS_12ColumnVectorILNS_13PrimitiveTypeE11EEEE8find_anyEPKNS_7IColumnEPKhmm Unexecuted instantiation: _ZN5doris14OverlapSetImplINS_12ColumnVectorILNS_13PrimitiveTypeE25EEEE8find_anyEPKNS_7IColumnEPKhmm Unexecuted instantiation: _ZN5doris14OverlapSetImplINS_12ColumnVectorILNS_13PrimitiveTypeE26EEEE8find_anyEPKNS_7IColumnEPKhmm Unexecuted instantiation: _ZN5doris14OverlapSetImplINS_12ColumnVectorILNS_13PrimitiveTypeE12EEEE8find_anyEPKNS_7IColumnEPKhmm Unexecuted instantiation: _ZN5doris14OverlapSetImplINS_12ColumnVectorILNS_13PrimitiveTypeE27EEEE8find_anyEPKNS_7IColumnEPKhmm Unexecuted instantiation: _ZN5doris14OverlapSetImplINS_12ColumnVectorILNS_13PrimitiveTypeE42EEEE8find_anyEPKNS_7IColumnEPKhmm Unexecuted instantiation: _ZN5doris14OverlapSetImplINS_12ColumnVectorILNS_13PrimitiveTypeE36EEEE8find_anyEPKNS_7IColumnEPKhmm Unexecuted instantiation: _ZN5doris14OverlapSetImplINS_12ColumnVectorILNS_13PrimitiveTypeE37EEEE8find_anyEPKNS_7IColumnEPKhmm |
95 | | }; |
96 | | |
97 | | template <> |
98 | | struct OverlapSetImpl<ColumnDecimal128V2> { |
99 | | using ElementNativeType = Int128; |
100 | | using Set = phmap::flat_hash_set<ElementNativeType, DefaultHash<ElementNativeType>>; |
101 | | Set set; |
102 | | bool has_null = false; |
103 | | |
104 | 10 | void insert_array(const IColumn* column, const UInt8* nullmap, size_t start, size_t size) { |
105 | 10 | const auto& vec = assert_cast<const ColumnDecimal128V2&>(*column).get_data(); |
106 | 20 | for (size_t i = start; i < start + size; ++i) { |
107 | 10 | if (nullmap[i]) { |
108 | 0 | has_null = true; |
109 | 0 | continue; |
110 | 0 | } |
111 | 10 | set.insert(vec[i].value()); |
112 | 10 | } |
113 | 10 | } |
114 | | |
115 | 10 | bool find_any(const IColumn* column, const UInt8* nullmap, size_t start, size_t size) { |
116 | 10 | const auto& vec = assert_cast<const ColumnDecimal128V2&>(*column).get_data(); |
117 | 24 | for (size_t i = start; i < start + size; ++i) { |
118 | 20 | if (nullmap[i]) { |
119 | 2 | if (has_null) { |
120 | 0 | return true; |
121 | 2 | } else { |
122 | 2 | continue; |
123 | 2 | } |
124 | 2 | } |
125 | | |
126 | 18 | if (set.contains(vec[i].value())) { |
127 | 6 | return true; |
128 | 6 | } |
129 | 18 | } |
130 | 4 | return false; |
131 | 10 | } |
132 | | }; |
133 | | |
134 | | template <> |
135 | | struct OverlapSetImpl<ColumnString> { |
136 | | using Set = phmap::flat_hash_set<StringRef, DefaultHash<StringRef>>; |
137 | | Set set; |
138 | | bool has_null = false; |
139 | | |
140 | 13 | void insert_array(const IColumn* column, const UInt8* nullmap, size_t start, size_t size) { |
141 | 31 | for (size_t i = start; i < start + size; ++i) { |
142 | 18 | if (nullmap[i]) { |
143 | 5 | has_null = true; |
144 | 5 | continue; |
145 | 5 | } |
146 | 13 | set.insert(column->get_data_at(i)); |
147 | 13 | } |
148 | 13 | } |
149 | | |
150 | 13 | bool find_any(const IColumn* column, const UInt8* nullmap, size_t start, size_t size) { |
151 | 27 | for (size_t i = start; i < start + size; ++i) { |
152 | 23 | if (nullmap[i]) { |
153 | 0 | if (has_null) { |
154 | 0 | return true; |
155 | 0 | } else { |
156 | 0 | continue; |
157 | 0 | } |
158 | 0 | } |
159 | | |
160 | 23 | if (set.contains(column->get_data_at(i))) { |
161 | 9 | return true; |
162 | 9 | } |
163 | 23 | } |
164 | 4 | return false; |
165 | 13 | } |
166 | | }; |
167 | | |
168 | | class FunctionArraysOverlap : public IFunction { |
169 | | public: |
170 | | static constexpr auto name = "arrays_overlap"; |
171 | 9 | static FunctionPtr create() { return std::make_shared<FunctionArraysOverlap>(); } |
172 | | |
173 | | /// Get function name. |
174 | 8 | String get_name() const override { return name; } |
175 | | |
176 | 14 | bool use_default_implementation_for_nulls() const override { return false; } |
177 | | |
178 | 8 | bool is_variadic() const override { return false; } |
179 | | |
180 | 7 | size_t get_number_of_arguments() const override { return 2; } |
181 | | |
182 | 7 | DataTypePtr get_return_type_impl(const DataTypes& arguments) const override { |
183 | 7 | auto left_data_type = remove_nullable(arguments[0]); |
184 | 7 | auto right_data_type = remove_nullable(arguments[1]); |
185 | 7 | DCHECK(left_data_type->get_primitive_type() == TYPE_ARRAY) << arguments[0]->get_name(); |
186 | 7 | DCHECK(right_data_type->get_primitive_type() == TYPE_ARRAY) << arguments[1]->get_name(); |
187 | 7 | auto left_nested_type = remove_nullable( |
188 | 7 | assert_cast<const DataTypeArray&>(*left_data_type).get_nested_type()); |
189 | 7 | auto right_nested_type = remove_nullable( |
190 | 7 | assert_cast<const DataTypeArray&>(*right_data_type).get_nested_type()); |
191 | 7 | DCHECK(left_nested_type->equals_ignore_precision(*right_nested_type)) |
192 | 0 | << "data type " << arguments[0]->get_name() << " not equal with " |
193 | 0 | << arguments[1]->get_name(); |
194 | 7 | return make_nullable(std::make_shared<DataTypeUInt8>()); |
195 | 7 | } |
196 | | |
197 | | /** |
198 | | * eval inverted index. we can filter array rows with inverted index iter |
199 | | * array_overlap(array, []) -> array_overlap(array, const value) |
200 | | */ |
201 | | Status evaluate_inverted_index( |
202 | | const ColumnsWithTypeAndName& arguments, |
203 | | const std::vector<IndexFieldNameAndTypePair>& data_type_with_names, |
204 | | std::vector<segment_v2::IndexIterator*> iterators, uint32_t num_rows, |
205 | | const InvertedIndexAnalyzerCtx* analyzer_ctx, |
206 | 0 | segment_v2::InvertedIndexResultBitmap& bitmap_result) const override { |
207 | 0 | DCHECK(arguments.size() == 1); |
208 | 0 | DCHECK(data_type_with_names.size() == 1); |
209 | 0 | DCHECK(iterators.size() == 1); |
210 | 0 | auto* iter = iterators[0]; |
211 | 0 | if (iter == nullptr) { |
212 | 0 | return Status::OK(); |
213 | 0 | } |
214 | 0 | auto data_type_with_name = data_type_with_names[0]; |
215 | 0 | if (!segment_v2::IndexReaderHelper::has_string_or_bkd_index(iter)) { |
216 | 0 | return Status::Error<ErrorCode::INVERTED_INDEX_EVALUATE_SKIPPED>( |
217 | 0 | "Inverted index evaluate skipped, no inverted index reader can not support " |
218 | 0 | "array_overlap"); |
219 | 0 | } |
220 | | // in arrays_overlap param is array Field and const Field |
221 | 0 | ColumnPtr arg_column = arguments[0].column; |
222 | 0 | DataTypePtr arg_type = arguments[0].type; |
223 | 0 | if ((is_column_nullable(*arg_column) && !is_column_const(*remove_nullable(arg_column))) || |
224 | 0 | (!is_column_nullable(*arg_column) && !is_column_const(*arg_column))) { |
225 | | // if not we should skip inverted index and evaluate in expression |
226 | 0 | return Status::Error<ErrorCode::INVERTED_INDEX_EVALUATE_SKIPPED>( |
227 | 0 | "Inverted index evaluate skipped, array_overlap only support const value"); |
228 | 0 | } |
229 | | |
230 | 0 | Field param_value; |
231 | 0 | arguments[0].column->get(0, param_value); |
232 | 0 | DCHECK(arguments[0].type->get_primitive_type() == TYPE_ARRAY); |
233 | 0 | auto nested_param_type = |
234 | 0 | check_and_get_data_type<DataTypeArray>(remove_nullable(arguments[0].type).get()) |
235 | 0 | ->get_nested_type() |
236 | 0 | ->get_primitive_type(); |
237 | | // The current implementation for the inverted index of arrays cannot handle cases where the array contains null values, |
238 | | // meaning an item in the array is null. |
239 | 0 | if (param_value.is_null()) { |
240 | 0 | return Status::OK(); |
241 | 0 | } |
242 | 0 | std::shared_ptr<roaring::Roaring> roaring = std::make_shared<roaring::Roaring>(); |
243 | 0 | std::shared_ptr<roaring::Roaring> null_bitmap = std::make_shared<roaring::Roaring>(); |
244 | 0 | if (iter->has_null()) { |
245 | 0 | segment_v2::InvertedIndexQueryCacheHandle null_bitmap_cache_handle; |
246 | 0 | RETURN_IF_ERROR(iter->read_null_bitmap(&null_bitmap_cache_handle)); |
247 | 0 | null_bitmap = null_bitmap_cache_handle.get_bitmap(); |
248 | 0 | } |
249 | 0 | std::unique_ptr<InvertedIndexQueryParamFactory> query_param = nullptr; |
250 | 0 | const Array& query_val = param_value.get<TYPE_ARRAY>(); |
251 | |
|
252 | 0 | InvertedIndexParam param; |
253 | 0 | param.column_name = data_type_with_name.first; |
254 | 0 | param.column_type = data_type_with_name.second; |
255 | 0 | param.query_type = segment_v2::InvertedIndexQueryType::EQUAL_QUERY; |
256 | 0 | param.num_rows = num_rows; |
257 | 0 | for (auto nested_query_val : query_val) { |
258 | | // any element inside array is NULL, return NULL |
259 | | // by current arrays_overlap execute logic. |
260 | 0 | if (nested_query_val.is_null()) { |
261 | 0 | return Status::OK(); |
262 | 0 | } |
263 | 0 | RETURN_IF_ERROR(InvertedIndexQueryParamFactory::create_query_value( |
264 | 0 | nested_param_type, &nested_query_val, query_param)); |
265 | 0 | param.query_value = query_param->get_value(); |
266 | 0 | param.roaring = std::make_shared<roaring::Roaring>(); |
267 | 0 | param.analyzer_ctx = analyzer_ctx; |
268 | 0 | RETURN_IF_ERROR(iter->read_from_index(segment_v2::IndexParam {¶m})); |
269 | 0 | *roaring |= *param.roaring; |
270 | 0 | } |
271 | | |
272 | 0 | segment_v2::InvertedIndexResultBitmap result(roaring, null_bitmap); |
273 | 0 | bitmap_result = result; |
274 | 0 | bitmap_result.mask_out_null(); |
275 | |
|
276 | 0 | return Status::OK(); |
277 | 0 | } |
278 | | |
279 | | Status execute_impl(FunctionContext* context, Block& block, const ColumnNumbers& arguments, |
280 | 7 | uint32_t result, size_t input_rows_count) const override { |
281 | 7 | DBUG_EXECUTE_IF("array_func.arrays_overlap", { |
282 | 7 | auto req_id = DebugPoints::instance()->get_debug_param_or_default<int32_t>( |
283 | 7 | "array_func.arrays_overlap", "req_id", 0); |
284 | 7 | return Status::Error<ErrorCode::INTERNAL_ERROR>( |
285 | 7 | "{} has already execute inverted index req_id {} , should not execute expr " |
286 | 7 | "with rows: {}", |
287 | 7 | get_name(), req_id, input_rows_count); |
288 | 7 | }); |
289 | 7 | auto left_column = |
290 | 7 | block.get_by_position(arguments[0]).column->convert_to_full_column_if_const(); |
291 | 7 | auto right_column = |
292 | 7 | block.get_by_position(arguments[1]).column->convert_to_full_column_if_const(); |
293 | 7 | ColumnArrayExecutionData left_exec_data; |
294 | 7 | ColumnArrayExecutionData right_exec_data; |
295 | | |
296 | 7 | Status ret = Status::InvalidArgument( |
297 | 7 | "execute failed, unsupported types for function {}({}, {})", get_name(), |
298 | 7 | block.get_by_position(arguments[0]).type->get_name(), |
299 | 7 | block.get_by_position(arguments[1]).type->get_name()); |
300 | | |
301 | | // extract array column |
302 | 7 | if (!extract_column_array_info(*left_column, left_exec_data) || |
303 | 7 | !extract_column_array_info(*right_column, right_exec_data)) { |
304 | 0 | return ret; |
305 | 0 | } |
306 | | // prepare return column |
307 | 7 | auto dst_nested_col = ColumnUInt8::create(input_rows_count, 0); |
308 | 7 | auto dst_null_map = ColumnUInt8::create(input_rows_count, 0); |
309 | 7 | UInt8* dst_null_map_data = dst_null_map->get_data().data(); |
310 | | |
311 | 7 | RETURN_IF_ERROR(_execute_nullable(left_exec_data, dst_null_map_data)); |
312 | 7 | RETURN_IF_ERROR(_execute_nullable(right_exec_data, dst_null_map_data)); |
313 | | |
314 | | // execute overlap check |
315 | 7 | auto array_type = remove_nullable(block.get_by_position(arguments[0]).type); |
316 | 7 | auto left_element_type = |
317 | 7 | remove_nullable(assert_cast<const DataTypeArray&>(*array_type).get_nested_type()); |
318 | | |
319 | 7 | auto call = [&](const auto& type) -> bool { |
320 | 7 | using DispatchType = std::decay_t<decltype(type)>; |
321 | 7 | ret = _execute_internal<typename DispatchType::ColumnType>( |
322 | 7 | left_exec_data, right_exec_data, dst_null_map_data, |
323 | 7 | dst_nested_col->get_data().data()); |
324 | 7 | return true; |
325 | 7 | }; Unexecuted instantiation: _ZZNK5doris21FunctionArraysOverlap12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmENKUlRKT_E_clINS_16DispatchDataTypeILNS_13PrimitiveTypeE2EEEEEbSC_ Unexecuted instantiation: _ZZNK5doris21FunctionArraysOverlap12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmENKUlRKT_E_clINS_16DispatchDataTypeILNS_13PrimitiveTypeE3EEEEEbSC_ Unexecuted instantiation: _ZZNK5doris21FunctionArraysOverlap12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmENKUlRKT_E_clINS_16DispatchDataTypeILNS_13PrimitiveTypeE4EEEEEbSC_ _ZZNK5doris21FunctionArraysOverlap12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmENKUlRKT_E_clINS_16DispatchDataTypeILNS_13PrimitiveTypeE5EEEEEbSC_ Line | Count | Source | 319 | 1 | auto call = [&](const auto& type) -> bool { | 320 | 1 | using DispatchType = std::decay_t<decltype(type)>; | 321 | 1 | ret = _execute_internal<typename DispatchType::ColumnType>( | 322 | 1 | left_exec_data, right_exec_data, dst_null_map_data, | 323 | 1 | dst_nested_col->get_data().data()); | 324 | 1 | return true; | 325 | 1 | }; |
Unexecuted instantiation: _ZZNK5doris21FunctionArraysOverlap12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmENKUlRKT_E_clINS_16DispatchDataTypeILNS_13PrimitiveTypeE6EEEEEbSC_ _ZZNK5doris21FunctionArraysOverlap12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmENKUlRKT_E_clINS_16DispatchDataTypeILNS_13PrimitiveTypeE7EEEEEbSC_ Line | Count | Source | 319 | 1 | auto call = [&](const auto& type) -> bool { | 320 | 1 | using DispatchType = std::decay_t<decltype(type)>; | 321 | 1 | ret = _execute_internal<typename DispatchType::ColumnType>( | 322 | 1 | left_exec_data, right_exec_data, dst_null_map_data, | 323 | 1 | dst_nested_col->get_data().data()); | 324 | 1 | return true; | 325 | 1 | }; |
Unexecuted instantiation: _ZZNK5doris21FunctionArraysOverlap12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmENKUlRKT_E_clINS_16DispatchDataTypeILNS_13PrimitiveTypeE8EEEEEbSC_ _ZZNK5doris21FunctionArraysOverlap12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmENKUlRKT_E_clINS_16DispatchDataTypeILNS_13PrimitiveTypeE9EEEEEbSC_ Line | Count | Source | 319 | 1 | auto call = [&](const auto& type) -> bool { | 320 | 1 | using DispatchType = std::decay_t<decltype(type)>; | 321 | 1 | ret = _execute_internal<typename DispatchType::ColumnType>( | 322 | 1 | left_exec_data, right_exec_data, dst_null_map_data, | 323 | 1 | dst_nested_col->get_data().data()); | 324 | 1 | return true; | 325 | 1 | }; |
Unexecuted instantiation: _ZZNK5doris21FunctionArraysOverlap12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmENKUlRKT_E_clINS_16DispatchDataTypeILNS_13PrimitiveTypeE28EEEEEbSC_ Unexecuted instantiation: _ZZNK5doris21FunctionArraysOverlap12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmENKUlRKT_E_clINS_16DispatchDataTypeILNS_13PrimitiveTypeE29EEEEEbSC_ _ZZNK5doris21FunctionArraysOverlap12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmENKUlRKT_E_clINS_16DispatchDataTypeILNS_13PrimitiveTypeE20EEEEEbSC_ Line | Count | Source | 319 | 2 | auto call = [&](const auto& type) -> bool { | 320 | 2 | using DispatchType = std::decay_t<decltype(type)>; | 321 | 2 | ret = _execute_internal<typename DispatchType::ColumnType>( | 322 | 2 | left_exec_data, right_exec_data, dst_null_map_data, | 323 | 2 | dst_nested_col->get_data().data()); | 324 | 2 | return true; | 325 | 2 | }; |
Unexecuted instantiation: _ZZNK5doris21FunctionArraysOverlap12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmENKUlRKT_E_clINS_16DispatchDataTypeILNS_13PrimitiveTypeE30EEEEEbSC_ Unexecuted instantiation: _ZZNK5doris21FunctionArraysOverlap12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmENKUlRKT_E_clINS_16DispatchDataTypeILNS_13PrimitiveTypeE35EEEEEbSC_ Unexecuted instantiation: _ZZNK5doris21FunctionArraysOverlap12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmENKUlRKT_E_clINS_16DispatchDataTypeILNS_13PrimitiveTypeE11EEEEEbSC_ Unexecuted instantiation: _ZZNK5doris21FunctionArraysOverlap12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmENKUlRKT_E_clINS_16DispatchDataTypeILNS_13PrimitiveTypeE25EEEEEbSC_ Unexecuted instantiation: _ZZNK5doris21FunctionArraysOverlap12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmENKUlRKT_E_clINS_16DispatchDataTypeILNS_13PrimitiveTypeE26EEEEEbSC_ Unexecuted instantiation: _ZZNK5doris21FunctionArraysOverlap12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmENKUlRKT_E_clINS_16DispatchDataTypeILNS_13PrimitiveTypeE12EEEEEbSC_ Unexecuted instantiation: _ZZNK5doris21FunctionArraysOverlap12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmENKUlRKT_E_clINS_16DispatchDataTypeILNS_13PrimitiveTypeE27EEEEEbSC_ Unexecuted instantiation: _ZZNK5doris21FunctionArraysOverlap12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmENKUlRKT_E_clINS_16DispatchDataTypeILNS_13PrimitiveTypeE42EEEEEbSC_ Unexecuted instantiation: _ZZNK5doris21FunctionArraysOverlap12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmENKUlRKT_E_clINS_16DispatchDataTypeILNS_13PrimitiveTypeE36EEEEEbSC_ Unexecuted instantiation: _ZZNK5doris21FunctionArraysOverlap12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmENKUlRKT_E_clINS_16DispatchDataTypeILNS_13PrimitiveTypeE37EEEEEbSC_ _ZZNK5doris21FunctionArraysOverlap12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmENKUlRKT_E_clINS_16DispatchDataTypeILNS_13PrimitiveTypeE23EEEEEbSC_ Line | Count | Source | 319 | 2 | auto call = [&](const auto& type) -> bool { | 320 | 2 | using DispatchType = std::decay_t<decltype(type)>; | 321 | 2 | ret = _execute_internal<typename DispatchType::ColumnType>( | 322 | 2 | left_exec_data, right_exec_data, dst_null_map_data, | 323 | 2 | dst_nested_col->get_data().data()); | 324 | 2 | return true; | 325 | 2 | }; |
|
326 | | |
327 | 7 | if (!dispatch_switch_all(left_element_type->get_primitive_type(), call)) { |
328 | 0 | ret = Status::InvalidArgument("execute failed, not support type {} in function {}", |
329 | 0 | left_element_type->get_name(), get_name()); |
330 | 0 | } |
331 | | |
332 | 7 | RETURN_IF_ERROR(ret); |
333 | | |
334 | 7 | block.replace_by_position( |
335 | 7 | result, ColumnNullable::create(std::move(dst_nested_col), std::move(dst_null_map))); |
336 | | |
337 | 7 | return Status::OK(); |
338 | 7 | } |
339 | | |
340 | | private: |
341 | 14 | static Status _execute_nullable(const ColumnArrayExecutionData& data, UInt8* dst_nullmap_data) { |
342 | 94 | for (ssize_t row = 0; row < data.offsets_ptr->size(); ++row) { |
343 | 80 | if (dst_nullmap_data[row]) { |
344 | 5 | continue; |
345 | 5 | } |
346 | | |
347 | 75 | if (data.array_nullmap_data && data.array_nullmap_data[row]) { |
348 | 6 | dst_nullmap_data[row] = 1; |
349 | 6 | continue; |
350 | 6 | } |
351 | 75 | } |
352 | 14 | return Status::OK(); |
353 | 14 | } |
354 | | |
355 | | template <typename T> |
356 | | Status _execute_internal(const ColumnArrayExecutionData& left_data, |
357 | | const ColumnArrayExecutionData& right_data, UInt8* dst_nullmap_data, |
358 | 7 | UInt8* dst_data) const { |
359 | 7 | using ExecutorImpl = OverlapSetImpl<T>; |
360 | 47 | for (ssize_t row = 0; row < left_data.offsets_ptr->size(); ++row) { |
361 | | // arrays_overlap(null, null) -> null |
362 | 40 | if (dst_nullmap_data[row]) { |
363 | 6 | continue; |
364 | 6 | } |
365 | 34 | dst_nullmap_data[row] = 0; |
366 | 34 | ssize_t left_start = (*left_data.offsets_ptr)[row - 1]; |
367 | 34 | ssize_t left_size = (*left_data.offsets_ptr)[row] - left_start; |
368 | 34 | ssize_t right_start = (*right_data.offsets_ptr)[row - 1]; |
369 | 34 | ssize_t right_size = (*right_data.offsets_ptr)[row] - right_start; |
370 | 34 | if (left_size == 0 || right_size == 0) { |
371 | 7 | dst_data[row] = 0; |
372 | 7 | continue; |
373 | 7 | } |
374 | | |
375 | 27 | const auto* small_data = &left_data; |
376 | 27 | const auto* large_data = &right_data; |
377 | | |
378 | 27 | ssize_t small_start = left_start; |
379 | 27 | ssize_t large_start = right_start; |
380 | 27 | ssize_t small_size = left_size; |
381 | 27 | ssize_t large_size = right_size; |
382 | 27 | if (right_size < left_size) { |
383 | 19 | std::swap(small_data, large_data); |
384 | 19 | std::swap(small_start, large_start); |
385 | 19 | std::swap(small_size, large_size); |
386 | 19 | } |
387 | | |
388 | 27 | ExecutorImpl impl; |
389 | 27 | impl.insert_array(small_data->nested_col.get(), small_data->nested_nullmap_data, |
390 | 27 | small_start, small_size); |
391 | 27 | dst_data[row] = impl.find_any(large_data->nested_col.get(), |
392 | 27 | large_data->nested_nullmap_data, large_start, large_size); |
393 | 27 | } |
394 | 7 | return Status::OK(); |
395 | 7 | } Unexecuted instantiation: _ZNK5doris21FunctionArraysOverlap17_execute_internalINS_12ColumnVectorILNS_13PrimitiveTypeE2EEEEENS_6StatusERKNS_24ColumnArrayExecutionDataES8_PhS9_ Unexecuted instantiation: _ZNK5doris21FunctionArraysOverlap17_execute_internalINS_12ColumnVectorILNS_13PrimitiveTypeE3EEEEENS_6StatusERKNS_24ColumnArrayExecutionDataES8_PhS9_ Unexecuted instantiation: _ZNK5doris21FunctionArraysOverlap17_execute_internalINS_12ColumnVectorILNS_13PrimitiveTypeE4EEEEENS_6StatusERKNS_24ColumnArrayExecutionDataES8_PhS9_ _ZNK5doris21FunctionArraysOverlap17_execute_internalINS_12ColumnVectorILNS_13PrimitiveTypeE5EEEEENS_6StatusERKNS_24ColumnArrayExecutionDataES8_PhS9_ Line | Count | Source | 358 | 1 | UInt8* dst_data) const { | 359 | 1 | using ExecutorImpl = OverlapSetImpl<T>; | 360 | 5 | for (ssize_t row = 0; row < left_data.offsets_ptr->size(); ++row) { | 361 | | // arrays_overlap(null, null) -> null | 362 | 4 | if (dst_nullmap_data[row]) { | 363 | 1 | continue; | 364 | 1 | } | 365 | 3 | dst_nullmap_data[row] = 0; | 366 | 3 | ssize_t left_start = (*left_data.offsets_ptr)[row - 1]; | 367 | 3 | ssize_t left_size = (*left_data.offsets_ptr)[row] - left_start; | 368 | 3 | ssize_t right_start = (*right_data.offsets_ptr)[row - 1]; | 369 | 3 | ssize_t right_size = (*right_data.offsets_ptr)[row] - right_start; | 370 | 3 | if (left_size == 0 || right_size == 0) { | 371 | 1 | dst_data[row] = 0; | 372 | 1 | continue; | 373 | 1 | } | 374 | | | 375 | 2 | const auto* small_data = &left_data; | 376 | 2 | const auto* large_data = &right_data; | 377 | | | 378 | 2 | ssize_t small_start = left_start; | 379 | 2 | ssize_t large_start = right_start; | 380 | 2 | ssize_t small_size = left_size; | 381 | 2 | ssize_t large_size = right_size; | 382 | 2 | if (right_size < left_size) { | 383 | 2 | std::swap(small_data, large_data); | 384 | 2 | std::swap(small_start, large_start); | 385 | 2 | std::swap(small_size, large_size); | 386 | 2 | } | 387 | | | 388 | 2 | ExecutorImpl impl; | 389 | 2 | impl.insert_array(small_data->nested_col.get(), small_data->nested_nullmap_data, | 390 | 2 | small_start, small_size); | 391 | 2 | dst_data[row] = impl.find_any(large_data->nested_col.get(), | 392 | 2 | large_data->nested_nullmap_data, large_start, large_size); | 393 | 2 | } | 394 | 1 | return Status::OK(); | 395 | 1 | } |
Unexecuted instantiation: _ZNK5doris21FunctionArraysOverlap17_execute_internalINS_12ColumnVectorILNS_13PrimitiveTypeE6EEEEENS_6StatusERKNS_24ColumnArrayExecutionDataES8_PhS9_ _ZNK5doris21FunctionArraysOverlap17_execute_internalINS_12ColumnVectorILNS_13PrimitiveTypeE7EEEEENS_6StatusERKNS_24ColumnArrayExecutionDataES8_PhS9_ Line | Count | Source | 358 | 1 | UInt8* dst_data) const { | 359 | 1 | using ExecutorImpl = OverlapSetImpl<T>; | 360 | 4 | for (ssize_t row = 0; row < left_data.offsets_ptr->size(); ++row) { | 361 | | // arrays_overlap(null, null) -> null | 362 | 3 | if (dst_nullmap_data[row]) { | 363 | 1 | continue; | 364 | 1 | } | 365 | 2 | dst_nullmap_data[row] = 0; | 366 | 2 | ssize_t left_start = (*left_data.offsets_ptr)[row - 1]; | 367 | 2 | ssize_t left_size = (*left_data.offsets_ptr)[row] - left_start; | 368 | 2 | ssize_t right_start = (*right_data.offsets_ptr)[row - 1]; | 369 | 2 | ssize_t right_size = (*right_data.offsets_ptr)[row] - right_start; | 370 | 2 | if (left_size == 0 || right_size == 0) { | 371 | 1 | dst_data[row] = 0; | 372 | 1 | continue; | 373 | 1 | } | 374 | | | 375 | 1 | const auto* small_data = &left_data; | 376 | 1 | const auto* large_data = &right_data; | 377 | | | 378 | 1 | ssize_t small_start = left_start; | 379 | 1 | ssize_t large_start = right_start; | 380 | 1 | ssize_t small_size = left_size; | 381 | 1 | ssize_t large_size = right_size; | 382 | 1 | if (right_size < left_size) { | 383 | 1 | std::swap(small_data, large_data); | 384 | 1 | std::swap(small_start, large_start); | 385 | 1 | std::swap(small_size, large_size); | 386 | 1 | } | 387 | | | 388 | 1 | ExecutorImpl impl; | 389 | 1 | impl.insert_array(small_data->nested_col.get(), small_data->nested_nullmap_data, | 390 | 1 | small_start, small_size); | 391 | 1 | dst_data[row] = impl.find_any(large_data->nested_col.get(), | 392 | 1 | large_data->nested_nullmap_data, large_start, large_size); | 393 | 1 | } | 394 | 1 | return Status::OK(); | 395 | 1 | } |
Unexecuted instantiation: _ZNK5doris21FunctionArraysOverlap17_execute_internalINS_12ColumnVectorILNS_13PrimitiveTypeE8EEEEENS_6StatusERKNS_24ColumnArrayExecutionDataES8_PhS9_ _ZNK5doris21FunctionArraysOverlap17_execute_internalINS_12ColumnVectorILNS_13PrimitiveTypeE9EEEEENS_6StatusERKNS_24ColumnArrayExecutionDataES8_PhS9_ Line | Count | Source | 358 | 1 | UInt8* dst_data) const { | 359 | 1 | using ExecutorImpl = OverlapSetImpl<T>; | 360 | 4 | for (ssize_t row = 0; row < left_data.offsets_ptr->size(); ++row) { | 361 | | // arrays_overlap(null, null) -> null | 362 | 3 | if (dst_nullmap_data[row]) { | 363 | 1 | continue; | 364 | 1 | } | 365 | 2 | dst_nullmap_data[row] = 0; | 366 | 2 | ssize_t left_start = (*left_data.offsets_ptr)[row - 1]; | 367 | 2 | ssize_t left_size = (*left_data.offsets_ptr)[row] - left_start; | 368 | 2 | ssize_t right_start = (*right_data.offsets_ptr)[row - 1]; | 369 | 2 | ssize_t right_size = (*right_data.offsets_ptr)[row] - right_start; | 370 | 2 | if (left_size == 0 || right_size == 0) { | 371 | 1 | dst_data[row] = 0; | 372 | 1 | continue; | 373 | 1 | } | 374 | | | 375 | 1 | const auto* small_data = &left_data; | 376 | 1 | const auto* large_data = &right_data; | 377 | | | 378 | 1 | ssize_t small_start = left_start; | 379 | 1 | ssize_t large_start = right_start; | 380 | 1 | ssize_t small_size = left_size; | 381 | 1 | ssize_t large_size = right_size; | 382 | 1 | if (right_size < left_size) { | 383 | 1 | std::swap(small_data, large_data); | 384 | 1 | std::swap(small_start, large_start); | 385 | 1 | std::swap(small_size, large_size); | 386 | 1 | } | 387 | | | 388 | 1 | ExecutorImpl impl; | 389 | 1 | impl.insert_array(small_data->nested_col.get(), small_data->nested_nullmap_data, | 390 | 1 | small_start, small_size); | 391 | 1 | dst_data[row] = impl.find_any(large_data->nested_col.get(), | 392 | 1 | large_data->nested_nullmap_data, large_start, large_size); | 393 | 1 | } | 394 | 1 | return Status::OK(); | 395 | 1 | } |
Unexecuted instantiation: _ZNK5doris21FunctionArraysOverlap17_execute_internalINS_13ColumnDecimalILNS_13PrimitiveTypeE28EEEEENS_6StatusERKNS_24ColumnArrayExecutionDataES8_PhS9_ Unexecuted instantiation: _ZNK5doris21FunctionArraysOverlap17_execute_internalINS_13ColumnDecimalILNS_13PrimitiveTypeE29EEEEENS_6StatusERKNS_24ColumnArrayExecutionDataES8_PhS9_ _ZNK5doris21FunctionArraysOverlap17_execute_internalINS_13ColumnDecimalILNS_13PrimitiveTypeE20EEEEENS_6StatusERKNS_24ColumnArrayExecutionDataES8_PhS9_ Line | Count | Source | 358 | 2 | UInt8* dst_data) const { | 359 | 2 | using ExecutorImpl = OverlapSetImpl<T>; | 360 | 16 | for (ssize_t row = 0; row < left_data.offsets_ptr->size(); ++row) { | 361 | | // arrays_overlap(null, null) -> null | 362 | 14 | if (dst_nullmap_data[row]) { | 363 | 2 | continue; | 364 | 2 | } | 365 | 12 | dst_nullmap_data[row] = 0; | 366 | 12 | ssize_t left_start = (*left_data.offsets_ptr)[row - 1]; | 367 | 12 | ssize_t left_size = (*left_data.offsets_ptr)[row] - left_start; | 368 | 12 | ssize_t right_start = (*right_data.offsets_ptr)[row - 1]; | 369 | 12 | ssize_t right_size = (*right_data.offsets_ptr)[row] - right_start; | 370 | 12 | if (left_size == 0 || right_size == 0) { | 371 | 2 | dst_data[row] = 0; | 372 | 2 | continue; | 373 | 2 | } | 374 | | | 375 | 10 | const auto* small_data = &left_data; | 376 | 10 | const auto* large_data = &right_data; | 377 | | | 378 | 10 | ssize_t small_start = left_start; | 379 | 10 | ssize_t large_start = right_start; | 380 | 10 | ssize_t small_size = left_size; | 381 | 10 | ssize_t large_size = right_size; | 382 | 10 | if (right_size < left_size) { | 383 | 6 | std::swap(small_data, large_data); | 384 | 6 | std::swap(small_start, large_start); | 385 | 6 | std::swap(small_size, large_size); | 386 | 6 | } | 387 | | | 388 | 10 | ExecutorImpl impl; | 389 | 10 | impl.insert_array(small_data->nested_col.get(), small_data->nested_nullmap_data, | 390 | 10 | small_start, small_size); | 391 | 10 | dst_data[row] = impl.find_any(large_data->nested_col.get(), | 392 | 10 | large_data->nested_nullmap_data, large_start, large_size); | 393 | 10 | } | 394 | 2 | return Status::OK(); | 395 | 2 | } |
Unexecuted instantiation: _ZNK5doris21FunctionArraysOverlap17_execute_internalINS_13ColumnDecimalILNS_13PrimitiveTypeE30EEEEENS_6StatusERKNS_24ColumnArrayExecutionDataES8_PhS9_ Unexecuted instantiation: _ZNK5doris21FunctionArraysOverlap17_execute_internalINS_13ColumnDecimalILNS_13PrimitiveTypeE35EEEEENS_6StatusERKNS_24ColumnArrayExecutionDataES8_PhS9_ Unexecuted instantiation: _ZNK5doris21FunctionArraysOverlap17_execute_internalINS_12ColumnVectorILNS_13PrimitiveTypeE11EEEEENS_6StatusERKNS_24ColumnArrayExecutionDataES8_PhS9_ Unexecuted instantiation: _ZNK5doris21FunctionArraysOverlap17_execute_internalINS_12ColumnVectorILNS_13PrimitiveTypeE25EEEEENS_6StatusERKNS_24ColumnArrayExecutionDataES8_PhS9_ Unexecuted instantiation: _ZNK5doris21FunctionArraysOverlap17_execute_internalINS_12ColumnVectorILNS_13PrimitiveTypeE26EEEEENS_6StatusERKNS_24ColumnArrayExecutionDataES8_PhS9_ Unexecuted instantiation: _ZNK5doris21FunctionArraysOverlap17_execute_internalINS_12ColumnVectorILNS_13PrimitiveTypeE12EEEEENS_6StatusERKNS_24ColumnArrayExecutionDataES8_PhS9_ Unexecuted instantiation: _ZNK5doris21FunctionArraysOverlap17_execute_internalINS_12ColumnVectorILNS_13PrimitiveTypeE27EEEEENS_6StatusERKNS_24ColumnArrayExecutionDataES8_PhS9_ Unexecuted instantiation: _ZNK5doris21FunctionArraysOverlap17_execute_internalINS_12ColumnVectorILNS_13PrimitiveTypeE42EEEEENS_6StatusERKNS_24ColumnArrayExecutionDataES8_PhS9_ Unexecuted instantiation: _ZNK5doris21FunctionArraysOverlap17_execute_internalINS_12ColumnVectorILNS_13PrimitiveTypeE36EEEEENS_6StatusERKNS_24ColumnArrayExecutionDataES8_PhS9_ Unexecuted instantiation: _ZNK5doris21FunctionArraysOverlap17_execute_internalINS_12ColumnVectorILNS_13PrimitiveTypeE37EEEEENS_6StatusERKNS_24ColumnArrayExecutionDataES8_PhS9_ _ZNK5doris21FunctionArraysOverlap17_execute_internalINS_9ColumnStrIjEEEENS_6StatusERKNS_24ColumnArrayExecutionDataES7_PhS8_ Line | Count | Source | 358 | 2 | UInt8* dst_data) const { | 359 | 2 | using ExecutorImpl = OverlapSetImpl<T>; | 360 | 18 | for (ssize_t row = 0; row < left_data.offsets_ptr->size(); ++row) { | 361 | | // arrays_overlap(null, null) -> null | 362 | 16 | if (dst_nullmap_data[row]) { | 363 | 1 | continue; | 364 | 1 | } | 365 | 15 | dst_nullmap_data[row] = 0; | 366 | 15 | ssize_t left_start = (*left_data.offsets_ptr)[row - 1]; | 367 | 15 | ssize_t left_size = (*left_data.offsets_ptr)[row] - left_start; | 368 | 15 | ssize_t right_start = (*right_data.offsets_ptr)[row - 1]; | 369 | 15 | ssize_t right_size = (*right_data.offsets_ptr)[row] - right_start; | 370 | 15 | if (left_size == 0 || right_size == 0) { | 371 | 2 | dst_data[row] = 0; | 372 | 2 | continue; | 373 | 2 | } | 374 | | | 375 | 13 | const auto* small_data = &left_data; | 376 | 13 | const auto* large_data = &right_data; | 377 | | | 378 | 13 | ssize_t small_start = left_start; | 379 | 13 | ssize_t large_start = right_start; | 380 | 13 | ssize_t small_size = left_size; | 381 | 13 | ssize_t large_size = right_size; | 382 | 13 | if (right_size < left_size) { | 383 | 9 | std::swap(small_data, large_data); | 384 | 9 | std::swap(small_start, large_start); | 385 | 9 | std::swap(small_size, large_size); | 386 | 9 | } | 387 | | | 388 | 13 | ExecutorImpl impl; | 389 | 13 | impl.insert_array(small_data->nested_col.get(), small_data->nested_nullmap_data, | 390 | 13 | small_start, small_size); | 391 | 13 | dst_data[row] = impl.find_any(large_data->nested_col.get(), | 392 | 13 | large_data->nested_nullmap_data, large_start, large_size); | 393 | 13 | } | 394 | 2 | return Status::OK(); | 395 | 2 | } |
|
396 | | }; |
397 | | |
398 | | } // namespace doris |