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