| 33 | namespace bytedance::bolt { |
| 34 | |
| 35 | TypePtr typeFromString( |
| 36 | const std::string& type, |
| 37 | bool failIfNotRegistered = true) { |
| 38 | auto upper = type; |
| 39 | std::transform(upper.begin(), upper.end(), upper.begin(), ::toupper); |
| 40 | if (upper == "INT") { |
| 41 | upper = "INTEGER"; |
| 42 | } else if (upper == "DOUBLE PRECISION") { |
| 43 | upper = "DOUBLE"; |
| 44 | } |
| 45 | auto inferredType = getType(upper, {}); |
| 46 | if (failIfNotRegistered) { |
| 47 | BOLT_CHECK( |
| 48 | inferredType, "Failed to parse type [{}]. Type not registered.", type); |
| 49 | } |
| 50 | return inferredType; |
| 51 | } |
| 52 | |
| 53 | std::pair<std::string, std::shared_ptr<const Type>> inferTypeWithSpaces( |
| 54 | std::vector<std::string>& words, |
no test coverage detected