MCPcopy Create free account
hub / github.com/LadybugDB/ladybug / tryCombineMapTypes

Function tryCombineMapTypes

src/common/types/types.cpp:1561–1574  ·  view source on GitHub ↗

If we can combine the key and value, then we cna combine the map

Source from the content-addressed store, hash-verified

1559
1560// If we can combine the key and value, then we cna combine the map
1561static bool tryCombineMapTypes(const LogicalType& left, const LogicalType& right,
1562 LogicalType& result) {
1563 const auto& leftKeyType = MapType::getKeyType(left);
1564 const auto& leftValueType = MapType::getValueType(left);
1565 const auto& rightKeyType = MapType::getKeyType(right);
1566 const auto& rightValueType = MapType::getValueType(right);
1567 LogicalType resultKeyType, resultValueType;
1568 if (!LogicalTypeUtils::tryGetMaxLogicalType(leftKeyType, rightKeyType, resultKeyType) ||
1569 !LogicalTypeUtils::tryGetMaxLogicalType(leftValueType, rightValueType, resultValueType)) {
1570 return false;
1571 }
1572 result = LogicalType::MAP(std::move(resultKeyType), std::move(resultValueType));
1573 return true;
1574}
1575
1576/*
1577// If one of the unions labels is a subset of the other labels, and we can

Callers 1

tryGetMaxLogicalTypeMethod · 0.85

Calls 1

getKeyTypeFunction · 0.85

Tested by

no test coverage detected