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

Method ValidateChildData

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

Source from the content-addressed store, hash-verified

890}
891
892Status MapArray::ValidateChildData(
893 const std::vector<std::shared_ptr<ArrayData>>& child_data) {
894 if (child_data.size() != 1) {
895 return Status::Invalid("Expected one child array for map array");
896 }
897 const auto& pair_data = child_data[0];
898 if (pair_data->type->id() != Type::STRUCT) {
899 return Status::Invalid("Map array child array should have struct type");
900 }
901 if (pair_data->GetNullCount() != 0) {
902 return Status::Invalid("Map array child array should have no nulls");
903 }
904 if (pair_data->child_data.size() != 2) {
905 return Status::Invalid("Map array child array should have two fields");
906 }
907 if (pair_data->child_data[0]->GetNullCount() != 0) {
908 return Status::Invalid("Map array keys array should have no nulls");
909 }
910 return Status::OK();
911}
912
913void MapArray::SetData(const std::shared_ptr<ArrayData>& data) {
914 ARROW_CHECK_OK(ValidateChildData(data->child_data));

Callers

nothing calls this directly

Calls 5

GetNullCountMethod · 0.80
InvalidFunction · 0.50
OKFunction · 0.50
sizeMethod · 0.45
idMethod · 0.45

Tested by

no test coverage detected