| 1345 | } |
| 1346 | |
| 1347 | Status ProcessUnion() { |
| 1348 | RETURN_NOT_OK(f_parser_.CheckHasNext()); |
| 1349 | UnionMode::type mode; |
| 1350 | switch (f_parser_.Next()) { |
| 1351 | case 'd': |
| 1352 | mode = UnionMode::DENSE; |
| 1353 | break; |
| 1354 | case 's': |
| 1355 | mode = UnionMode::SPARSE; |
| 1356 | break; |
| 1357 | default: |
| 1358 | return f_parser_.Invalid(); |
| 1359 | } |
| 1360 | RETURN_NOT_OK(f_parser_.CheckNext(':')); |
| 1361 | ARROW_ASSIGN_OR_RAISE(auto type_codes, f_parser_.ParseInts<int8_t>(f_parser_.Rest())); |
| 1362 | ARROW_ASSIGN_OR_RAISE(auto fields, MakeChildFields()); |
| 1363 | if (fields.size() != type_codes.size()) { |
| 1364 | return Status::Invalid( |
| 1365 | "ArrowArray struct number of children incompatible with format string " |
| 1366 | "(mismatching number of union type codes) ", |
| 1367 | "'", c_struct_->format, "'"); |
| 1368 | } |
| 1369 | for (const auto code : type_codes) { |
| 1370 | if (code < 0) { |
| 1371 | return Status::Invalid("Negative type code in union: format string '", |
| 1372 | c_struct_->format, "'"); |
| 1373 | } |
| 1374 | } |
| 1375 | if (mode == UnionMode::SPARSE) { |
| 1376 | type_ = sparse_union(std::move(fields), std::move(type_codes)); |
| 1377 | } else { |
| 1378 | type_ = dense_union(std::move(fields), std::move(type_codes)); |
| 1379 | } |
| 1380 | return Status::OK(); |
| 1381 | } |
| 1382 | |
| 1383 | Status ProcessREE() { |
| 1384 | RETURN_NOT_OK(f_parser_.CheckAtEnd()); |
nothing calls this directly
no test coverage detected