| 220 | } |
| 221 | |
| 222 | static bool hasImplicitCastUnion(const LogicalType& srcType, const LogicalType& dstType) { |
| 223 | if (srcType.getLogicalTypeID() == LogicalTypeID::UNION) { |
| 224 | auto numFieldsSrc = UnionType::getNumFields(srcType); |
| 225 | for (auto i = 0u; i < numFieldsSrc; ++i) { |
| 226 | const auto& fieldName = UnionType::getFieldName(srcType, i); |
| 227 | const auto& fieldType = UnionType::getFieldType(srcType, i); |
| 228 | if (!UnionType::hasField(dstType, fieldName) || |
| 229 | !CastFunction::hasImplicitCast(fieldType, |
| 230 | UnionType::getFieldType(dstType, fieldName))) { |
| 231 | return false; |
| 232 | } |
| 233 | } |
| 234 | return true; |
| 235 | } else { |
| 236 | auto numFields = UnionType::getNumFields(dstType); |
| 237 | for (auto i = 0u; i < numFields; ++i) { |
| 238 | const auto& fieldType = UnionType::getFieldType(dstType, i); |
| 239 | if (CastFunction::hasImplicitCast(srcType, fieldType)) { |
| 240 | return true; |
| 241 | } |
| 242 | } |
| 243 | return false; |
| 244 | } |
| 245 | } |
| 246 | |
| 247 | static bool hasImplicitCastMap(const LogicalType& srcType, const LogicalType& dstType) { |
| 248 | const auto& srcKeyType = MapType::getKeyType(srcType); |
no test coverage detected