jsjtxietian commented on code in PR #36915:
URL: https://github.com/apache/arrow/pull/36915#discussion_r1277151668
##########
cpp/src/arrow/type.cc:
##########
@@ -2090,17 +2090,39 @@ Status SchemaBuilder::AreCompatible(const
std::vector<std::shared_ptr<Schema>>&
return Merge(schemas, policy).status();
}
+std::vector<std::shared_ptr<Field>> make_fields(
+ const std::initializer_list<std::pair<std::string,
std::shared_ptr<DataType>>>& init_list) {
+ std::vector<std::shared_ptr<Field>> fields;
+ fields.reserve(init_list.size());
+ for (const auto& pair : init_list) {
+ fields.push_back(std::make_shared<Field>(pair.first, pair.second));
+ }
+ return fields;
+}
+
std::shared_ptr<Schema> schema(std::vector<std::shared_ptr<Field>> fields,
std::shared_ptr<const KeyValueMetadata>
metadata) {
return std::make_shared<Schema>(std::move(fields), std::move(metadata));
}
+std::shared_ptr<Schema> schema(const
std::initializer_list<std::pair<std::string, std::shared_ptr<DataType>>>&
fields,
+ std::shared_ptr<const KeyValueMetadata>
metadata) {
+ return std::make_shared<Schema>(std::move(make_fields(fields)),
std::move(metadata));
Review Comment:
indeed, thank you
--
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]