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

Method ValidateMeta

cpp/src/arrow/table.cc:211–244  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

209
210 protected:
211 Status ValidateMeta() const {
212 // Make sure columns and schema are consistent
213 if (static_cast<int>(columns_.size()) != schema_->num_fields()) {
214 return Status::Invalid("Number of columns did not match schema");
215 }
216 for (int i = 0; i < num_columns(); ++i) {
217 const ChunkedArray* col = columns_[i].get();
218 if (col == nullptr) {
219 return Status::Invalid("Column ", i, " was null");
220 }
221 if (!col->type()->Equals(*schema_->field(i)->type())) {
222 return Status::Invalid("Column data for field ", i, " with type ",
223 col->type()->ToString(), " is inconsistent with schema ",
224 schema_->field(i)->type()->ToString());
225 }
226 }
227
228 // Make sure columns are all the same length, and validate them
229 for (int i = 0; i < num_columns(); ++i) {
230 const ChunkedArray* col = columns_[i].get();
231 if (col->length() != num_rows_) {
232 return Status::Invalid("Column ", i, " named ", field(i)->name(),
233 " expected length ", num_rows_, " but got length ",
234 col->length());
235 }
236 Status st = col->Validate();
237 if (!st.ok()) {
238 std::stringstream ss;
239 ss << "Column " << i << ": " << st.message();
240 return st.WithMessage(ss.str());
241 }
242 }
243 return Status::OK();
244 }
245
246 private:
247 std::vector<std::shared_ptr<ChunkedArray>> columns_;

Callers

nothing calls this directly

Calls 15

strMethod · 0.80
InvalidFunction · 0.70
num_columnsFunction · 0.70
fieldFunction · 0.70
OKFunction · 0.70
sizeMethod · 0.45
num_fieldsMethod · 0.45
getMethod · 0.45
EqualsMethod · 0.45
typeMethod · 0.45
fieldMethod · 0.45
ToStringMethod · 0.45

Tested by

no test coverage detected