[ 
https://issues.apache.org/jira/browse/ARROW-2351?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16419940#comment-16419940
 ] 

ASF GitHub Bot commented on ARROW-2351:
---------------------------------------

wesm commented on a change in pull request #1803: ARROW-2351 [C++] 
StringBuilder::append(vector<string>...) not impleme…
URL: https://github.com/apache/arrow/pull/1803#discussion_r178207724
 
 

 ##########
 File path: cpp/src/arrow/builder.cc
 ##########
 @@ -1385,6 +1385,28 @@ 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) {
+  std::size_t total_length = std::accumulate(
+      values.begin(), values.end(), 0ULL,
+      [](uint64_t sum, const std::string& str) { return sum + str.size(); });
 
 Review comment:
   Is using `std::accumulate` with a lambda the same speed as a for loop? 

----------------------------------------------------------------
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:
us...@infra.apache.org


> [C++] StringBuilder::append(vector<string>...) not implemented
> --------------------------------------------------------------
>
>                 Key: ARROW-2351
>                 URL: https://issues.apache.org/jira/browse/ARROW-2351
>             Project: Apache Arrow
>          Issue Type: Bug
>          Components: C++
>    Affects Versions: 0.9.0
>            Reporter: Rares Vernica
>            Priority: Major
>              Labels: pull-request-available
>             Fix For: 0.10.0
>
>
> For {{StringBuilder}} an {{append(vector<string>, uint8_t*)}} function is 
> [declared|https://github.com/apache/arrow/blob/7b2c79765cf92760e1f8cca079159d9613b86412/cpp/src/arrow/builder.h#L721]
>  and 
> [documented|http://arrow.apache.org/docs/cpp/classarrow_1_1_string_builder.html#a59be34b5e11017a392b4ee019d90da3c]
>  but it does not seem to be implemented.
> {code:java}
> undefined reference to `arrow::StringBuilder::Append(std::vector<std::string, 
> std::allocator<std::string> > const&, unsigned char*)'
> collect2: error: ld returned 1 exit status
> {code}
> Also worth noting is that the similar function in {{NumericBuilder}} uses 
> {{vector<bool>}} for the null values instead of {{uint8_t*}}. It might be 
> worth making them consistent.
>  



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Reply via email to