You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@arrow.apache.org by "felipecrv (via GitHub)" <gi...@apache.org> on 2023/01/26 00:52:23 UTC

[GitHub] [arrow] felipecrv opened a new issue, #33872: Replace shared_ptr creation hack before AppendScalarImpl instantiation

felipecrv opened a new issue, #33872:
URL: https://github.com/apache/arrow/issues/33872

   ### Describe the enhancement requested
   
   `AppendScalarImpl` was created for appending scalars based on a contiguous array of `std::shared_ptr<Scalar>`, so when a single `Scalar` reference is passed, a dummy `shared_ptr` is created before the instantiation of `AppendScalarImpl`.
   
   ```cpp
     std::shared_ptr<Scalar> shared{const_cast<Scalar*>(&scalar), [](Scalar*) {}};
     return AppendScalarImpl{&shared, &shared + 1, n_repeats, this}.Convert();
   ```
   
   This seems non-idiomatic [1] and likely inefficient as a control block needs to be heap-allocated for the `shared_ptr`. An alternative way (that simplifies `AppendScalarImpl` as well) is a custom iterator class the wraps the source iterator with an extra dereference operation.
   
   [1] Pointers to `shared_ptr` as class members are a bad precedent
   
   ### Component(s)
   
   C++


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@arrow.apache.org.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [arrow] lidavidm closed issue #33872: [C++] Replace shared_ptr creation hack before AppendScalarImpl instantiation

Posted by "lidavidm (via GitHub)" <gi...@apache.org>.
lidavidm closed issue #33872: [C++] Replace shared_ptr creation hack before AppendScalarImpl instantiation
URL: https://github.com/apache/arrow/issues/33872


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@arrow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org