@@ -63,7 +63,7 @@ class SimpleTable : public Table {
6363 : columns_(std::move(columns)) {
6464 schema_ = std::move (schema);
6565 if (num_rows < 0 ) {
66- if (columns_.size () == 0 || !columns_[ 0 ] ) {
66+ if (columns_.size () == 0 ) {
6767 num_rows_ = 0 ;
6868 } else {
6969 num_rows_ = columns_[0 ]->length ();
@@ -77,7 +77,7 @@ class SimpleTable : public Table {
7777 const std::vector<std::shared_ptr<Array>>& columns, int64_t num_rows = -1 ) {
7878 schema_ = std::move (schema);
7979 if (num_rows < 0 ) {
80- if (columns.size () == 0 || !columns[ 0 ] ) {
80+ if (columns.size () == 0 ) {
8181 num_rows_ = 0 ;
8282 } else {
8383 num_rows_ = columns[0 ]->length ();
@@ -260,12 +260,20 @@ std::vector<std::shared_ptr<Field>> Table::fields() const {
260260std::shared_ptr<Table> Table::Make (std::shared_ptr<Schema> schema,
261261 std::vector<std::shared_ptr<ChunkedArray>> columns,
262262 int64_t num_rows) {
263+ DCHECK_EQ (schema->num_fields (), static_cast <int >(columns.size ()));
264+ for (const auto & column : columns) {
265+ DCHECK (column != nullptr ) << " column should not be null" ;
266+ }
263267 return std::make_shared<SimpleTable>(std::move (schema), std::move (columns), num_rows);
264268}
265269
266270std::shared_ptr<Table> Table::Make (std::shared_ptr<Schema> schema,
267271 const std::vector<std::shared_ptr<Array>>& arrays,
268272 int64_t num_rows) {
273+ DCHECK_EQ (schema->num_fields (), static_cast <int >(arrays.size ()));
274+ for (const auto & array : arrays) {
275+ DCHECK (array != nullptr ) << " array should not be null" ;
276+ }
269277 return std::make_shared<SimpleTable>(std::move (schema), arrays, num_rows);
270278}
271279
0 commit comments