MCPcopy Create free account
hub / github.com/apache/arrow / Make

Method Make

cpp/src/arrow/array/array_nested.cc:1033–1060  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1031}
1032
1033Result<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
1062Result<std::shared_ptr<StructArray>> StructArray::Make(
1063 const std::vector<std::shared_ptr<Array>>& children,

Callers

nothing calls this directly

Calls 15

IndexErrorFunction · 0.85
struct_Function · 0.85
dense_unionFunction · 0.85
sparse_unionFunction · 0.85
push_backMethod · 0.80
MakeFunction · 0.70
InvalidFunction · 0.50
fieldFunction · 0.50
TypeErrorFunction · 0.50
sizeMethod · 0.45
emptyMethod · 0.45
lengthMethod · 0.45

Tested by

no test coverage detected