| 1031 | } |
| 1032 | |
| 1033 | Result<std::shared_ptr<StructArray>> StructArray::Make( |
| 1034 | const std::vector<std::shared_ptr<Array>>& children, |
| 1035 | const std::vector<std::shared_ptr<Field>>& fields, |
| 1036 | std::shared_ptr<Buffer> null_bitmap, int64_t null_count, int64_t offset) { |
| 1037 | if (children.size() != fields.size()) { |
| 1038 | return Status::Invalid("Mismatching number of fields and child arrays"); |
| 1039 | } |
| 1040 | if (children.empty()) { |
| 1041 | return Status::Invalid("Can't infer struct array length with 0 child arrays"); |
| 1042 | } |
| 1043 | const int64_t length = children.front()->length(); |
| 1044 | for (const auto& child : children) { |
| 1045 | if (length != child->length()) { |
| 1046 | return Status::Invalid("Mismatching child array lengths"); |
| 1047 | } |
| 1048 | } |
| 1049 | if (offset > length) { |
| 1050 | return Status::IndexError("Offset greater than length of child arrays"); |
| 1051 | } |
| 1052 | if (null_bitmap == nullptr) { |
| 1053 | if (null_count > 0) { |
| 1054 | return Status::Invalid("null_count = ", null_count, " but no null bitmap given"); |
| 1055 | } |
| 1056 | null_count = 0; |
| 1057 | } |
| 1058 | return std::make_shared<StructArray>(struct_(fields), length - offset, children, |
| 1059 | std::move(null_bitmap), null_count, offset); |
| 1060 | } |
| 1061 | |
| 1062 | Result<std::shared_ptr<StructArray>> StructArray::Make( |
| 1063 | const std::vector<std::shared_ptr<Array>>& children, |
nothing calls this directly
no test coverage detected