-
Notifications
You must be signed in to change notification settings - Fork 4k
[WIP] ARROW-4491: [Python] Use stringstreams instead of std::to_string and std::stoi #3570
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
Conversation
Codecov Report
@@ Coverage Diff @@
## master #3570 +/- ##
==========================================
+ Coverage 87.82% 88.68% +0.86%
==========================================
Files 666 537 -129
Lines 82371 73408 -8963
Branches 1069 0 -1069
==========================================
- Hits 72341 65102 -7239
+ Misses 9919 8306 -1613
+ Partials 111 0 -111
Continue to review full report at Codecov.
|
eeca9d7 to
7c8b81d
Compare
|
Rebased. |
| result.push_back(static_cast<int8_t>(std::stoi(type->child(i)->name()))); | ||
| std::istringstream convert(type->child(i)->name()); | ||
| int tag; | ||
| convert >> tag; |
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.
This will have the same problem as std::stoi. Have you looked at utils/parsing.h? The various StringConverter classes there could help ;-)
| // std::to_string is locale dependent, but should be ok for small integers | ||
| type_map_[tag] = builder_->AppendChild(*child_builder, std::to_string(tag)); | ||
| std::ostringstream convert; | ||
| convert << static_cast<int>(tag); |
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.
Like above, the << operator is also locale-dependent by default.
One way to avoid this is to call the imbue method to change to the C locale, for example stream.imbue(std::locale::classic()). Also note this isn't very fast.
…std::stoi and std::to_string @pcmoritz Asked me to continue this PR #3570, but I don't have the right to change the his repro. Author: Philipp Moritz <[email protected]> Author: Yuhong Guo <[email protected]> Author: Antoine Pitrou <[email protected]> Closes #3758 from guoyuhong/string-conversions and squashes the following commits: 6fb7a1b <Antoine Pitrou> Make arrow_python depend on Arrow dependencies, so that dependent includes are available. 4fbda2e <Yuhong Guo> Use StringConverter c7367fa <Philipp Moritz> update bb9db84 <Philipp Moritz> use stringstreams instead of std::to_string and std::stoi
|
Should be superseded by PR #3758. |
…std::stoi and std::to_string @pcmoritz Asked me to continue this PR apache/arrow#3570, but I don't have the right to change the his repro. Author: Philipp Moritz <[email protected]> Author: Yuhong Guo <[email protected]> Author: Antoine Pitrou <[email protected]> Closes #3758 from guoyuhong/string-conversions and squashes the following commits: 6fb7a1b6b <Antoine Pitrou> Make arrow_python depend on Arrow dependencies, so that dependent includes are available. 4fbda2e96 <Yuhong Guo> Use StringConverter c7367fa04 <Philipp Moritz> update bb9db84ed <Philipp Moritz> use stringstreams instead of std::to_string and std::stoi
No description provided.