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

Method isBuiltInType

src/common/types/types.cpp:700–725  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

698static LogicalType parseDecimalType(const std::string& trimmedStr);
699
700bool LogicalType::isBuiltInType(const std::string& str) {
701 auto trimmedStr = StringUtils::ltrim(StringUtils::rtrim(str));
702 auto upperDataTypeString = StringUtils::getUpper(trimmedStr);
703 auto id = LogicalTypeID::ANY;
704 try {
705 if (upperDataTypeString.ends_with("[]")) {
706 parseListType(trimmedStr);
707 } else if (upperDataTypeString.ends_with("]")) {
708 parseArrayType(trimmedStr);
709 } else if (upperDataTypeString.starts_with("STRUCT")) {
710 parseStructType(trimmedStr);
711 } else if (upperDataTypeString.starts_with("MAP")) {
712 parseMapType(trimmedStr);
713 } else if (upperDataTypeString.starts_with("UNION")) {
714 parseUnionType(trimmedStr);
715 } else if (upperDataTypeString.starts_with("DECIMAL") ||
716 upperDataTypeString.starts_with("NUMERIC")) {
717 parseDecimalType(trimmedStr);
718 } else if (!tryGetIDFromString(upperDataTypeString, id)) {
719 return false;
720 }
721 } catch (...) {
722 return false;
723 }
724 return true;
725}
726
727LogicalType LogicalType::convertFromString(const std::string& str, main::ClientContext* context) {
728 LogicalType type;

Callers

nothing calls this directly

Calls 9

ltrimFunction · 0.85
rtrimFunction · 0.85
parseListTypeFunction · 0.85
parseArrayTypeFunction · 0.85
parseStructTypeFunction · 0.85
parseMapTypeFunction · 0.85
parseUnionTypeFunction · 0.85
parseDecimalTypeFunction · 0.85
tryGetIDFromStringFunction · 0.85

Tested by

no test coverage detected