Skip to content

Commit

Permalink
Add column name to validation error message, check for null, per apac…
Browse files Browse the repository at this point in the history
  • Loading branch information
wesm committed Mar 19, 2016
1 parent d350139 commit 4d9adf6
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions cpp/src/arrow/table.cc
Original file line number Diff line number Diff line change
Expand Up @@ -57,16 +57,19 @@ Status Table::ValidateColumns() const {
return Status::Invalid("Number of columns did not match schema");
}

if (columns_.size() == 0) {
return Status::OK();
}

// Make sure columns are all the same length
for (size_t i = 0; i < columns_.size(); ++i) {
const Column* col = columns_[i].get();
if (col == nullptr) {
std::stringstream ss;
ss << "Column " << i << " named " << col->name()
<< " was null";
return Status::Invalid(ss.str());
}
if (col->length() != num_rows_) {
std::stringstream ss;
ss << "Column " << i << " expected length "
ss << "Column " << i << " named " << col->name()
<< " expected length "
<< num_rows_
<< " but got length "
<< col->length();
Expand Down

0 comments on commit 4d9adf6

Please sign in to comment.