[
https://issues.apache.org/jira/browse/ARROW-2388?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16425090#comment-16425090
]
ASF GitHub Bot commented on ARROW-2388:
---------------------------------------
xhochy commented on a change in pull request #1833: ARROW-2388: [C++] Use
valid_bytes API for StringBuilder::Append
URL: https://github.com/apache/arrow/pull/1833#discussion_r179041616
##########
File path: cpp/src/arrow/builder.cc
##########
@@ -1386,24 +1386,30 @@ const uint8_t* BinaryBuilder::GetValue(int64_t i,
int32_t* out_length) const {
StringBuilder::StringBuilder(MemoryPool* pool) : BinaryBuilder(utf8(), pool) {}
Status StringBuilder::Append(const std::vector<std::string>& values,
- uint8_t* null_bytes) {
+ const uint8_t* valid_bytes) {
std::size_t total_length = std::accumulate(
values.begin(), values.end(), 0ULL,
[](uint64_t sum, const std::string& str) { return sum + str.size(); });
RETURN_NOT_OK(Reserve(values.size()));
RETURN_NOT_OK(value_data_builder_.Reserve(total_length));
RETURN_NOT_OK(offsets_builder_.Reserve(values.size()));
- for (std::size_t i = 0; i < values.size(); ++i) {
- RETURN_NOT_OK(AppendNextOffset());
- if (null_bytes[i]) {
- UnsafeAppendToBitmap(false);
- } else {
+ if (valid_bytes) {
+ for (std::size_t i = 0; i < values.size(); ++i) {
+ RETURN_NOT_OK(AppendNextOffset());
+ if (valid_bytes[i]) {
+ RETURN_NOT_OK(value_data_builder_.Append(
+ reinterpret_cast<const uint8_t*>(values[i].data()),
values[i].size()));
Review comment:
This line and the one 7 lines below are too long. Can you run `make format`
again to fix this?
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
> [C++] Arrow::StringBuilder::Append() uses null_bytes not valid_bytes
> --------------------------------------------------------------------
>
> Key: ARROW-2388
> URL: https://issues.apache.org/jira/browse/ARROW-2388
> Project: Apache Arrow
> Issue Type: Improvement
> Components: C++
> Affects Versions: 0.10.0
> Reporter: Kouhei Sutou
> Assignee: Kouhei Sutou
> Priority: Minor
> Labels: pull-request-available
> Fix For: 0.10.0
>
>
> Append of other builders use valid_bytes not null_bytes.
--
This message was sent by Atlassian JIRA
(v7.6.3#76005)