| 1155 | |
| 1156 | template <bool first> |
| 1157 | void executeString(const KeyColumnsType & key_cols, const IColumn * column, typename ColumnVector<ToType>::Container & vec_to) const |
| 1158 | { |
| 1159 | KeyType key{}; |
| 1160 | if constexpr (Keyed) |
| 1161 | key = Impl::getKey(key_cols, 0); |
| 1162 | if (const ColumnString * col_from = checkAndGetColumn<ColumnString>(column)) |
| 1163 | { |
| 1164 | const typename ColumnString::Chars & data = col_from->getChars(); |
| 1165 | const typename ColumnString::Offsets & offsets = col_from->getOffsets(); |
| 1166 | size_t size = offsets.size(); |
| 1167 | |
| 1168 | ColumnString::Offset current_offset = 0; |
| 1169 | for (size_t i = 0; i < size; ++i) |
| 1170 | { |
| 1171 | if constexpr (Keyed) |
| 1172 | if (!key_cols.is_const && i != 0) |
| 1173 | key = Impl::getKey(key_cols, i); |
| 1174 | const ToType hash = apply(key, |
| 1175 | reinterpret_cast<const char *>(&data[current_offset]), |
| 1176 | offsets[i] - current_offset); |
| 1177 | |
| 1178 | if constexpr (first) |
| 1179 | vec_to[i] = hash; |
| 1180 | else |
| 1181 | vec_to[i] = combineHashes(key, vec_to[i], hash); |
| 1182 | |
| 1183 | current_offset = offsets[i]; |
| 1184 | } |
| 1185 | } |
| 1186 | else if (const ColumnFixedString * col_from_fixed = checkAndGetColumn<ColumnFixedString>(column)) |
| 1187 | { |
| 1188 | const typename ColumnString::Chars & data = col_from_fixed->getChars(); |
| 1189 | size_t n = col_from_fixed->getN(); |
| 1190 | size_t size = data.size() / n; |
| 1191 | |
| 1192 | for (size_t i = 0; i < size; ++i) |
| 1193 | { |
| 1194 | if constexpr (Keyed) |
| 1195 | if (!key_cols.is_const && i != 0) |
| 1196 | key = Impl::getKey(key_cols, i); |
| 1197 | const ToType hash = apply(key, reinterpret_cast<const char *>(&data[i * n]), n); |
| 1198 | if constexpr (first) |
| 1199 | vec_to[i] = hash; |
| 1200 | else |
| 1201 | vec_to[i] = combineHashes(key, vec_to[i], hash); |
| 1202 | } |
| 1203 | } |
| 1204 | else if (const ColumnConst * col_from_const = checkAndGetColumnConstStringOrFixedString(column)) |
| 1205 | { |
| 1206 | if constexpr (Keyed) |
| 1207 | { |
| 1208 | if (!key_cols.is_const) |
| 1209 | { |
| 1210 | ColumnPtr full_column = col_from_const->convertToFullColumn(); |
| 1211 | return executeString<first>(key_cols, full_column.get(), vec_to); |
| 1212 | } |
| 1213 | } |
| 1214 | String value = col_from_const->getValue<String>(); |
no test coverage detected