| 1071 | } |
| 1072 | |
| 1073 | Result<std::shared_ptr<StructArray>> StructArray::Make( |
| 1074 | const std::vector<std::shared_ptr<Array>>& children, |
| 1075 | const std::vector<std::shared_ptr<Field>>& fields, |
| 1076 | std::shared_ptr<Buffer> null_bitmap, int64_t null_count, int64_t offset) { |
| 1077 | if (children.size() != fields.size()) { |
| 1078 | return Status::Invalid("Mismatching number of fields and child arrays"); |
| 1079 | } |
| 1080 | if (children.empty()) { |
| 1081 | return Status::Invalid("Can't infer struct array length with 0 child arrays"); |
| 1082 | } |
| 1083 | const int64_t length = children.front()->length(); |
| 1084 | for (const auto& child : children) { |
| 1085 | if (length != child->length()) { |
| 1086 | return Status::Invalid("Mismatching child array lengths"); |
| 1087 | } |
| 1088 | } |
| 1089 | if (offset > length) { |
| 1090 | return Status::IndexError("Offset greater than length of child arrays"); |
| 1091 | } |
| 1092 | if (null_bitmap == nullptr) { |
| 1093 | if (null_count > 0) { |
| 1094 | return Status::Invalid("null_count = ", null_count, " but no null bitmap given"); |
| 1095 | } |
| 1096 | null_count = 0; |
| 1097 | } |
| 1098 | return std::make_shared<StructArray>(struct_(fields), length - offset, children, |
| 1099 | std::move(null_bitmap), null_count, offset); |
| 1100 | } |
| 1101 | |
| 1102 | Result<std::shared_ptr<StructArray>> StructArray::Make( |
| 1103 | const std::vector<std::shared_ptr<Array>>& children, |
nothing calls this directly
no test coverage detected