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

Function hasImplicitCastUnion

src/function/vector_cast_functions.cpp:222–245  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

220}
221
222static 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
247static bool hasImplicitCastMap(const LogicalType& srcType, const LogicalType& dstType) {
248 const auto& srcKeyType = MapType::getKeyType(srcType);

Callers 1

hasImplicitCastMethod · 0.85

Calls 1

getLogicalTypeIDMethod · 0.80

Tested by

no test coverage detected