| 1250 | DataTypePtr getReturnTypeImpl(const ColumnsWithTypeAndName &) const override { return std::make_shared<DataTypeUInt8>(); } |
| 1251 | |
| 1252 | bool tupleContains(const ColumnsWithTypeAndName & compare_columns) const |
| 1253 | { |
| 1254 | auto target_column = compare_columns[0]; |
| 1255 | auto candidate_column = compare_columns[1]; |
| 1256 | |
| 1257 | if (isTuple(target_column.type) && isTuple(candidate_column.type)) |
| 1258 | { |
| 1259 | const auto & target_tuple_column = assert_cast<const ColumnTuple &>(*target_column.column); |
| 1260 | const auto & target_tuple_type = assert_cast<const DataTypeTuple &>(*target_column.type); |
| 1261 | |
| 1262 | |
| 1263 | const auto & candidate_tuple_column = assert_cast<const ColumnTuple &>(*candidate_column.column); |
| 1264 | const auto & candidate_type_tuple = assert_cast<const DataTypeTuple &>(*candidate_column.type); |
| 1265 | |
| 1266 | const auto & candidate_tuple_element_names = candidate_type_tuple.getElementNames(); |
| 1267 | const auto & candidate_tuple_elements = candidate_type_tuple.getElements(); |
| 1268 | |
| 1269 | const auto & target_tuple_element_names = target_tuple_type.getElementNames(); |
| 1270 | const auto & target_tuple_elements = target_tuple_type.getElements(); |
| 1271 | |
| 1272 | bool contains_all = false; |
| 1273 | for (size_t i = 0; i < candidate_tuple_element_names.size(); i++) |
| 1274 | { |
| 1275 | auto candidate_tuple_element_name = candidate_tuple_element_names[i]; |
| 1276 | bool contains = false; |
| 1277 | for (size_t j = 0; j < target_tuple_element_names.size(); j++) |
| 1278 | { |
| 1279 | auto target_tuple_element_name = target_tuple_element_names[j]; |
| 1280 | if (candidate_tuple_element_name == target_tuple_element_name) |
| 1281 | { |
| 1282 | contains = tupleContains( |
| 1283 | {{target_tuple_column.getColumnPtr(j), target_tuple_elements[j], "_dummy"}, |
| 1284 | {candidate_tuple_column.getColumnPtr(i), candidate_tuple_elements[i], "_dummy"}}); |
| 1285 | } |
| 1286 | } |
| 1287 | |
| 1288 | if (!contains) |
| 1289 | { |
| 1290 | contains_all = false; |
| 1291 | break; |
| 1292 | } |
| 1293 | else |
| 1294 | { |
| 1295 | contains_all = true; |
| 1296 | } |
| 1297 | } |
| 1298 | |
| 1299 | return contains_all; |
| 1300 | } |
| 1301 | else if ( |
| 1302 | (isArray(target_column.type) && isArray(candidate_column.type)) |
| 1303 | || (isNumberOrString(target_column.type) && isNumberOrString(candidate_column.type))) |
| 1304 | { |
| 1305 | auto compare_result_column |
| 1306 | = func_compare->build(compare_columns)->execute(compare_columns, std::make_shared<DataTypeUInt8>(), 1); |
| 1307 | return compare_result_column->getBool(0); |
| 1308 | } |
| 1309 |
nothing calls this directly
no test coverage detected