If we can match child labels and combine their types, then we can combine the struct
| 1534 | // If we can match child labels and combine their types, then we can combine |
| 1535 | // the struct |
| 1536 | static bool tryCombineStructTypes(const LogicalType& left, const LogicalType& right, |
| 1537 | LogicalType& result) { |
| 1538 | const auto& leftFields = StructType::getFields(left); |
| 1539 | const auto& rightFields = StructType::getFields(right); |
| 1540 | if (leftFields.size() != rightFields.size()) { |
| 1541 | return false; |
| 1542 | } |
| 1543 | std::vector<StructField> newFields; |
| 1544 | for (auto i = 0u; i < leftFields.size(); i++) { |
| 1545 | if (leftFields[i].getName() != rightFields[i].getName()) { |
| 1546 | return false; |
| 1547 | } |
| 1548 | LogicalType combinedType; |
| 1549 | if (LogicalTypeUtils::tryGetMaxLogicalType(leftFields[i].getType(), |
| 1550 | rightFields[i].getType(), combinedType)) { |
| 1551 | newFields.push_back(StructField(leftFields[i].getName(), std::move(combinedType))); |
| 1552 | } else { |
| 1553 | return false; |
| 1554 | } |
| 1555 | } |
| 1556 | result = LogicalType::STRUCT(std::move(newFields)); |
| 1557 | return true; |
| 1558 | } |
| 1559 | |
| 1560 | // If we can combine the key and value, then we cna combine the map |
| 1561 | static bool tryCombineMapTypes(const LogicalType& left, const LogicalType& right, |
no test coverage detected