Skip to content

Conversation

@pcmoritz
Copy link
Contributor

@pcmoritz pcmoritz commented Feb 6, 2019

No description provided.

@codecov-io
Copy link

Codecov Report

Merging #3570 into master will increase coverage by 0.86%.
The diff coverage is 100%.

Impacted file tree graph

@@            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
Impacted Files Coverage Δ
cpp/src/arrow/python/serialize.cc 85.71% <100%> (+0.08%) ⬆️
cpp/src/arrow/python/deserialize.cc 90.52% <100%> (+0.09%) ⬆️
go/arrow/math/uint64_amd64.go
go/arrow/memory/memory_avx2_amd64.go
js/src/enum.ts
go/arrow/array/builder.go
js/src/Arrow.node.ts
js/src/schema.ts
go/arrow/type_traits_boolean.go
js/src/ipc/node/writer.ts
... and 122 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 4004b72...eeca9d7. Read the comment docs.

@pcmoritz pcmoritz changed the title ARROW-4491: [Python] Use stringstreams instead of std::to_string and std::stoi [WIP] ARROW-4491: [Python] Use stringstreams instead of std::to_string and std::stoi Feb 6, 2019
@xhochy xhochy force-pushed the string-conversions branch from eeca9d7 to 7c8b81d Compare February 8, 2019 21:30
@xhochy
Copy link
Member

xhochy commented Feb 8, 2019

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;
Copy link
Member

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);
Copy link
Member

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.

pitrou pushed a commit that referenced this pull request Feb 26, 2019
…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
@pitrou
Copy link
Member

pitrou commented Feb 26, 2019

Should be superseded by PR #3758.

@pitrou pitrou closed this Feb 26, 2019
QuietCraftsmanship pushed a commit to QuietCraftsmanship/arrow that referenced this pull request Jul 7, 2025
…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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants