HuaHuaY commented on code in PR #49086:
URL: https://github.com/apache/arrow/pull/49086#discussion_r2758101680
##########
cpp/src/arrow/table.cc:
##########
@@ -257,15 +261,33 @@ std::vector<std::shared_ptr<Field>> Table::fields() const
{
return result;
}
-std::shared_ptr<Table> Table::Make(std::shared_ptr<Schema> schema,
- std::vector<std::shared_ptr<ChunkedArray>>
columns,
- int64_t num_rows) {
+Result<std::shared_ptr<Table>> Table::Make(std::shared_ptr<Schema> schema,
+
std::vector<std::shared_ptr<ChunkedArray>> columns,
+ int64_t num_rows) {
+ if (schema->num_fields() != static_cast<int>(columns.size())) {
+ return Status::Invalid("Schema and columns have different number of
fields: ",
+ schema->num_fields(), " vs ", columns.size());
+ }
+ for (const auto& column : columns) {
Review Comment:
You can use `std::ranges::any_of`(I suggest to use it but I didn't check
whether the version of arrow's C++20 compiler provides this method) or
`std::any_of`.
--
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]