Process wildcard(*) in value selection. path_idx is the index after the wildcard in path_str. Return next unprocessed index in path_str. Return -1 for errors.
| 207 | /// Process wildcard(*) in value selection. path_idx is the index after the wildcard in |
| 208 | /// path_str. Return next unprocessed index in path_str. Return -1 for errors. |
| 209 | static int ProcessWildcardKey(FunctionContext* ctx, const StringVal& path_str, |
| 210 | int path_idx, JsonUdfValue* queue, JsonUdfAllocator* allocator) { |
| 211 | DCHECK(queue->IsArray()); |
| 212 | const uint8_t* path = path_str.ptr; |
| 213 | while (path_idx < path_str.len) { |
| 214 | if (path[path_idx] == '[' || path[path_idx] == '.') break; |
| 215 | if (path[path_idx] != ' ') { |
| 216 | string msg = Substitute("Failed to parse json path '$0': " |
| 217 | "Encountered '$1' in position $2, expects ' ', '[' or '.'", |
| 218 | AnyValUtil::ToString(path_str), static_cast<char>(path[path_idx]), path_idx); |
| 219 | ctx->SetError(msg.c_str()); |
| 220 | return -1; |
| 221 | } |
| 222 | ++path_idx; |
| 223 | } |
| 224 | RETURN_IF_OOM(ExtractValues(queue, allocator), -1); |
| 225 | return path_idx; |
| 226 | } |
| 227 | |
| 228 | /// Process wildcard(*) in array selection. path_idx is the index after the wildcard in |
| 229 | /// path_str. Return next unprocessed index in path_str. Return -1 for errors. |
no test coverage detected