Skip to content

Commit f7d1a22

Browse files
committed
[C++] Address maintainer feedback on SimpleTable and fix macOS CI pkg-config error
1 parent d23378d commit f7d1a22

3 files changed

Lines changed: 10 additions & 4 deletions

File tree

.github/workflows/cpp.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -228,7 +228,6 @@ jobs:
228228
# in GitHub Actions runner now. We can remove this once
229229
# pkg-config formula is removed from GitHub Actions runner.
230230
brew uninstall pkg-config || :
231-
brew uninstall pkg-config@0.29.2 || :
232231
brew bundle --file=cpp/Brewfile
233232
- name: Install MinIO
234233
run: |

.github/workflows/python.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -193,7 +193,6 @@ jobs:
193193
# in GitHub Actions runner now. We can remove this once
194194
# pkg-config formula is removed from GitHub Actions runner.
195195
brew uninstall pkg-config || :
196-
brew uninstall pkg-config@0.29.2 || :
197196
brew bundle --file=cpp/Brewfile
198197
199198
python -m pip install \

cpp/src/arrow/table.cc

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -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 {
260260
std::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

266270
std::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

Comments
 (0)