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-1849 Fix C++ schema to JSON converter #97
Conversation
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.
Hey Simon,
I noticed your pull request in the issue, it is a pity that it went unnoticed for so long. Thanks for the fix, if you are still willing to go forward with it, please see the suggestion in my comment.
Thanks,
Zoltan
std::ostringstream os; | ||
compiledSchema.toJson(os); | ||
std::string result = os.str(); | ||
result.erase( std::remove_if( result.begin(), result.end(), ::isspace ), result.end() ); // Remove whitespace |
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.
Instead of removing all whitespaces, consecutive whitespaces should be collapsed into a single space. It is true that it doesn't matter how many whitespaces there are, but it does matter whether there is or isn't whitespace between specific characters. A slight modification will give the desired result as described in http://stackoverflow.com/a/8362145/5613485
Additionally this line uses a different style than the other lines, there should be no spaces after '('-s or before ')'-s.
Thanks Zoltan. With regards whitespace in general, the reason for eradicating whitespace But if you think it's a change worth making, I'm happy to make it. With regards the length of time it took to pick up this Jira, obviously I Thanks and regards On Wed, Sep 21, 2016 at 12:49 PM, Zoltan Ivanfi notifications@github.com
|
Regarding the mixture of different whitespaces, my suggestion was meant to include replacing all of them with spaces before collapsing them. I should have mentioned it explicitly, sorry. On the other hand, your argument is valid as well, and what's more, there are cases where the existence of a whitespace doesn't make a difference - for example "[{" vs. "[ {". I haven't noticed it yesterday, but your test cases do not contain spaces in any location where their removal would matter. As such, apart from the minor styling difference, the current implementation is fine by me. Regarding your question about specific mailing lists for different programming languages, I don't believe they exist. |
"{\"name\":\"f2\",\"type\":\"int\"}]}", | ||
/* Avro-C++ cannot do a round-trip on error schemas. | ||
* "{\"type\":\"error\",\"name\":\"Test\",\"fields\":" | ||
"[{\"name\":\"f1\",\"type\":\"long\"}," |
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.
Nit: Comment style is inconsistent, some lines start with a *, while others don't.
Thanks for flagging up these style issues. I believe I've fixed them all now. |
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.
Hi Simon,
I added a minor comment regarding BOOST_CHECKPOINT.
I also noticed that avro/lang/c++/build.sh doesn't run SchemaTests. I know that you only added one test case to this already existing test, but if it doesn't take too much of your time could you please update the shell script to actually run the test you extended? If you argue that it is out of scope, I can also do it in a follow-up change.
Thanks,
Zoltan
// used to construct it, apart from whitespace changes. | ||
static void testRoundTrip(const char* schema) | ||
{ | ||
BOOST_CHECKPOINT(schema); |
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.
Other tests have been updated to use BOOST_TEST_CHECKPOINT, please update this as well.
…ELinux (see Jira 1925). lang/c++/build.sh refers to the lang/c++/build directory which is empty. These are now fixed.
Hi Zoltan, I'm glad you asked for the fix to lang/c++/build.sh - I was going to start I've also committed a minor change to the root level build.sh script. When Thanks On Fri, Sep 23, 2016 at 7:33 PM, Zoltan Ivanfi notifications@github.com
|
Hi Simon, I feel that your fix for AVRO-1925 in the top-level Your change to ~/git/avro/lang/c++ $ git pull github pull/97/head Updating fcd0a65..f7826c6 4 files changed, 82 insertions(+), 19 deletions(-) ~/git/avro/lang/c++ $ ./build.sh test -- Configuring done -- Generating done -- Build files have been written to: /home/zi/git/avro/lang/c++/build make: *** No targets specified and no makefile found. Stop. Based on your description in AVRO-1926 it seems to me that things work differently on your computer: Your makefiles are not generated in Zoltan |
…SchemaTests to the list of tests. Also revert SELinux changes to build.sh as these should be committed separately
Hi Zoltan, I've reverted the changes to the build.sh and lang/c++/build.sh files. I'm Apologies for the multiple changes - I hope this is converging on something On Mon, Sep 26, 2016 at 2:13 PM, Zoltan Ivanfi notifications@github.com
|
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.
Hi Simon,
No problem, multiple rounds are normal in code reviews. Your contribution is definitely useful, thanks for your time!
Zoltan
Hi Simon, Tom committed your change, could you please close the pull request? Thanks, Zoltan |
…ity based on parsing canonical form (#97) I noticed that we were deriving PartialEq for Schema while my understanding is that the spec asserts that equality between schemas has to rely on parsing canonical form. So I manually impemented PartialEq and Eq based on that. I also created a bunch of issues to follow with the tests that I had to comment because they were failing.
https://docs.gradle.org/current/userguide/task_configuration_avoidance.html Thanks to [dcabasson](https://github.com/dcabasson) for the collaboration
A ValidSchema with no records produced invalid JSON when converting to JSON in C++. This is now fixed.