From f285be95a165134b416f7a1685eba0c55cc38a39 Mon Sep 17 00:00:00 2001 From: Wes McKinney Date: Sun, 1 Oct 2017 19:56:25 -0400 Subject: [PATCH] Restore code paths for empty chunked arrays for backwards compat Change-Id: Icb0567eef9f2fac5284171c4371e3c3d22b91fc5 --- cpp/src/arrow/table.cc | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/cpp/src/arrow/table.cc b/cpp/src/arrow/table.cc index 51c026c06abd5..009b5cf6373de 100644 --- a/cpp/src/arrow/table.cc +++ b/cpp/src/arrow/table.cc @@ -34,7 +34,6 @@ namespace arrow { // ChunkedArray and Column methods ChunkedArray::ChunkedArray(const ArrayVector& chunks) : chunks_(chunks) { - DCHECK_GT(chunks.size(), 0); length_ = 0; null_count_ = 0; for (const std::shared_ptr& chunk : chunks) { @@ -108,8 +107,11 @@ Column::Column(const std::shared_ptr& field, const ArrayVector& chunks) Column::Column(const std::shared_ptr& field, const std::shared_ptr& data) : field_(field) { - DCHECK(data); - data_ = std::make_shared(ArrayVector({data})); + if (!data) { + data_ = std::make_shared(ArrayVector({})); + } else { + data_ = std::make_shared(ArrayVector({data})); + } } Column::Column(const std::string& name, const std::shared_ptr& data)