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

Method Make

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

Source from the content-addressed store, hash-verified

1071}
1072
1073Result<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
1102Result<std::shared_ptr<StructArray>> StructArray::Make(
1103 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