| 1353 | } |
| 1354 | |
| 1355 | LogicalType parseArrayType(const std::string& trimmedStr, main::ClientContext* context) { |
| 1356 | auto leftBracketPos = trimmedStr.find_last_of('['); |
| 1357 | auto rightBracketPos = trimmedStr.find_last_of(']'); |
| 1358 | auto childType = |
| 1359 | LogicalType(LogicalType::convertFromString(trimmedStr.substr(0, leftBracketPos), context)); |
| 1360 | auto numElements = std::strtoll( |
| 1361 | trimmedStr.substr(leftBracketPos + 1, rightBracketPos - leftBracketPos - 1).c_str(), |
| 1362 | nullptr, 0 /* base */); |
| 1363 | if (numElements <= 0) { |
| 1364 | // Note: the parser already guarantees that the number of elements is a non-negative |
| 1365 | // number. However, we still need to check whether the number of elements is 0. |
| 1366 | throw BinderException("The number of elements in an array must be greater than 0. Given: " + |
| 1367 | std::to_string(numElements) + "."); |
| 1368 | } |
| 1369 | return LogicalType::ARRAY(std::move(childType), numElements); |
| 1370 | } |
| 1371 | |
| 1372 | std::vector<StructField> parseStructTypeInfo(const std::string& structTypeStr, |
| 1373 | main::ClientContext* context, std::string defType) { |
no test coverage detected