emkornfield commented on code in PR #1736:
URL: https://github.com/apache/avro/pull/1736#discussion_r924828452
##########
lang/c++/impl/Compiler.cc:
##########
@@ -256,6 +260,26 @@ static GenericDatum makeGenericDatum(NodePtr n,
}
}
+static const std::unordered_set<std::string>& getKnownFields() {
+ // return known fields
+ static const std::unordered_set<std::string> kKnownFields =
+ {"name", "type", "default", "doc", "size", "logicalType",
+ "values", "precision", "scale", "namespace"};
+ return kKnownFields;
+}
+
+static void getCustomAttributes(const Object& m, CustomFields
&customAttributes)
+{
+ // Don't add known fields on primitive type and fixed type into custom
+ // fields.
+ const std::unordered_set<std::string>& kKnownFields = getKnownFields();
+ for (const auto &entry : m) {
+ if (kKnownFields.find(entry.first) == kKnownFields.end()) {
Review Comment:
actually this is C++20 so probably not portable.
--
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]