Dispatches to the appropriate specialized matcher based on the key column type, then calls findKeyPositions with that matcher.
| 151 | /// Dispatches to the appropriate specialized matcher based on the key column type, |
| 152 | /// then calls findKeyPositions with that matcher. |
| 153 | void findKeyPositionsDispatch( |
| 154 | const IColumn & keys_column, |
| 155 | const ColumnArray::Offsets & offsets, |
| 156 | const IColumn & key, |
| 157 | size_t start, |
| 158 | size_t end, |
| 159 | PaddedPODArray<size_t> & matched_positions) |
| 160 | { |
| 161 | TypeIndex type_id = keys_column.getDataType(); |
| 162 | |
| 163 | /// Try ColumnVector<T> specializations. |
| 164 | switch (type_id) |
| 165 | { |
| 166 | #define DISPATCH_VECTOR(T) \ |
| 167 | case TypeIndex::T: \ |
| 168 | { \ |
| 169 | using ColType = ColumnVector<T>; \ |
| 170 | const auto & typed_col = assert_cast<const ColType &>(keys_column); \ |
| 171 | const auto & key_col = assert_cast<const ColType &>(key); \ |
| 172 | KeyMatcherVector<T> matcher{typed_col.getData(), key_col.getData()[0]}; \ |
| 173 | findKeyPositions(offsets, matcher, start, end, matched_positions); \ |
| 174 | return; \ |
| 175 | } |
| 176 | |
| 177 | DISPATCH_VECTOR(UInt8) |
| 178 | DISPATCH_VECTOR(UInt16) |
| 179 | DISPATCH_VECTOR(UInt32) |
| 180 | DISPATCH_VECTOR(UInt64) |
| 181 | DISPATCH_VECTOR(Int8) |
| 182 | DISPATCH_VECTOR(Int16) |
| 183 | DISPATCH_VECTOR(Int32) |
| 184 | DISPATCH_VECTOR(Int64) |
| 185 | DISPATCH_VECTOR(Float32) |
| 186 | DISPATCH_VECTOR(Float64) |
| 187 | #undef DISPATCH_VECTOR |
| 188 | |
| 189 | case TypeIndex::String: |
| 190 | { |
| 191 | const auto & typed_col = assert_cast<const ColumnString &>(keys_column); |
| 192 | const auto & key_col = assert_cast<const ColumnString &>(key); |
| 193 | auto key_ref = key_col.getDataAt(0); |
| 194 | KeyMatcherString matcher{typed_col.getChars(), typed_col.getOffsets(), key_ref.data(), key_ref.size()}; |
| 195 | findKeyPositions(offsets, matcher, start, end, matched_positions); |
| 196 | return; |
| 197 | } |
| 198 | case TypeIndex::FixedString: |
| 199 | { |
| 200 | const auto & typed_col = assert_cast<const ColumnFixedString &>(keys_column); |
| 201 | const auto & key_col = assert_cast<const ColumnFixedString &>(key); |
| 202 | KeyMatcherFixedString matcher{typed_col.getChars(), typed_col.getN(), key_col.getChars().data()}; |
| 203 | findKeyPositions(offsets, matcher, start, end, matched_positions); |
| 204 | return; |
| 205 | } |
| 206 | default: |
| 207 | { |
| 208 | /// Fallback: generic matcher using virtual compareAt. |
| 209 | KeyMatcherGeneric matcher{keys_column, key}; |
| 210 | findKeyPositions(offsets, matcher, start, end, matched_positions); |
no test coverage detected