Skip to content

Commit

Permalink
apacheGH-41317: [C++] TableBatchReader constructor: add a Validate() …
Browse files Browse the repository at this point in the history
…debug check
  • Loading branch information
rouault committed Apr 24, 2024
1 parent 0a134e3 commit 90f2c07
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 0 deletions.
2 changes: 2 additions & 0 deletions cpp/src/arrow/table.cc
Original file line number Diff line number Diff line change
Expand Up @@ -619,6 +619,7 @@ TableBatchReader::TableBatchReader(const Table& table)
for (int i = 0; i < table.num_columns(); ++i) {
column_data_[i] = table.column(i).get();
}
DCHECK(table_.Validate().ok());
}

TableBatchReader::TableBatchReader(std::shared_ptr<Table> table)
Expand All @@ -632,6 +633,7 @@ TableBatchReader::TableBatchReader(std::shared_ptr<Table> table)
for (int i = 0; i < owned_table_->num_columns(); ++i) {
column_data_[i] = owned_table_->column(i).get();
}
DCHECK(table_.Validate().ok());
}

std::shared_ptr<Schema> TableBatchReader::schema() const { return table_.schema(); }
Expand Down
3 changes: 3 additions & 0 deletions cpp/src/arrow/table.h
Original file line number Diff line number Diff line change
Expand Up @@ -241,6 +241,9 @@ class ARROW_EXPORT Table {
///
/// The conversion is zero-copy: each record batch is a view over a slice
/// of the table's columns.
///
/// The table is expected to be valid prior to using it with the batch reader.
///
class ARROW_EXPORT TableBatchReader : public RecordBatchReader {
public:
/// \brief Construct a TableBatchReader for the given table
Expand Down

0 comments on commit 90f2c07

Please sign in to comment.