kou commented on PR #49086:
URL: https://github.com/apache/arrow/pull/49086#issuecomment-3830377042
I think that we must not accept `columns[0] == nullptr`. Caller must provide
all valid chunked arrays or arrays.
If we want to check `nullptr`, we should do it in `Table::Make()` something
like the following:
```diff
diff --git a/cpp/src/arrow/table.cc b/cpp/src/arrow/table.cc
index 68a8a1951f..2fd51d858e 100644
--- a/cpp/src/arrow/table.cc
+++ b/cpp/src/arrow/table.cc
@@ -260,12 +260,18 @@ std::vector<std::shared_ptr<Field>> Table::fields()
const {
std::shared_ptr<Table> Table::Make(std::shared_ptr<Schema> schema,
std::vector<std::shared_ptr<ChunkedArray>> columns,
int64_t num_rows) {
+ if (std::any_of(columns.begin(), columns.end(), [](const auto& column)
{return bool(column);})) {
+ return Status::Invalid(...);
+ }
return std::make_shared<SimpleTable>(std::move(schema),
std::move(columns), num_rows);
}
std::shared_ptr<Table> Table::Make(std::shared_ptr<Schema> schema,
const
std::vector<std::shared_ptr<Array>>& arrays,
int64_t num_rows) {
+ if (std::any_of(arrays.begin(), arrays.end(), [](const auto& array)
{return bool(array);})) {
+ return Status::Invalid(...);
+ }
return std::make_shared<SimpleTable>(std::move(schema), arrays, num_rows);
}
```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]