-
Notifications
You must be signed in to change notification settings - Fork 1.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
AVRO-3601: C++ API header contains breaking include #1821
Conversation
Rename CustomFields to CustomAttributes. Rework CustomAttributes to keep a map of string name with a string value. The user application may parse the string to JSON if needed. Add a new step to the CI workflow to prevent problems like this in the future Signed-off-by: Martin Tzvetanov Grigorov <[email protected]>
a4821ef
to
ee2986e
Compare
Just build in Release mode Signed-off-by: Martin Tzvetanov Grigorov <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks great! Thank you for the prompt action.
std::map<std::string, std::string>::const_iterator iter = | ||
attributes_.find(name); | ||
if (iter == attributes_.end()) { | ||
return NULL; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Conversion from nullptr to std::string has undefined behavior. Is there a test case that covers this?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No, there is no such test.
Suggestions how to rework this ? Maybe return Option(al) ?! I have to see which version of C++ supports this.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
std::optional
is available since C++ 17. Avro uses 11
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
boost::optional
is available!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
{ | ||
// 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()) { | ||
customAttributes.addField(entry.first, entry.second); | ||
customAttributes.addAttribute(entry.first, entry.second.stringValue()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Are custom attributes required to have string values? I thought the plan was to store a string in JSON syntax, i.e. including quotation marks if the value is a JSON string.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think the C++ developers here have to step up! :-)
Thanks for the review, @KalleOlaviNiemitalo !
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
074eef4
Looks good ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I commented further in #1826 (comment).
* AVRO-3601: C++ API header contains breaking include Rename CustomFields to CustomAttributes. Rework CustomAttributes to keep a map of string name with a string value. The user application may parse the string to JSON if needed. Add a new step to the CI workflow to prevent problems like this in the future Signed-off-by: Martin Tzvetanov Grigorov <[email protected]> * AVRO-3601: Do not try to install Just build in Release mode Signed-off-by: Martin Tzvetanov Grigorov <[email protected]> Signed-off-by: Martin Tzvetanov Grigorov <[email protected]> (cherry picked from commit 864774b)
Thank you @martin-g for promptly fixing this.
Will the CustomAttribute feature and this fix be part of release?
Regards,
Nilesh
…On Thu, Aug 11, 2022 at 7:01 AM Thiruvalluvan M G ***@***.***> wrote:
Merged #1821 <#1821> into master.
—
Reply to this email directly, view it on GitHub
<#1821 (comment)>, or
unsubscribe
<https://github.com/notifications/unsubscribe-auth/AVR5AVXCG3TTDIMLJNTP26LVYUBSFANCNFSM56H5M4IQ>
.
You are receiving this because you were mentioned.Message ID:
***@***.***>
|
It will be part of 1.11.2 and 1.12.0 when they are released. |
Rename CustomFields to CustomAttributes.
Rework CustomAttributes to keep a map of string name with a string
value. The user application may parse the string to JSON if needed.
Add a new step to the CI workflow to prevent problems like this in the
future
Jira
Tests
Commits
Documentation