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/09/26 20:05:13 UTC

[GitHub] [arrow] felipecrv opened a new issue, #37891: [C++] Pass shared_ptr by value to parametric type constructors

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

   ### Describe the enhancement requested
   
   Types like `ListType` and factory functions like `list` take a `const std::shared_ptr<DataType>&` instead of a `std::shared_ptr<DataType>` that could be moved into the newly constructed `ListType` without the need of bumping a refcount and still support cases where caller can only give it a reference.
   
   Currently:
   
   ```cpp
   std::shared_ptr<DataType> list(const std::shared_ptr<DataType>& value_type) {
     return std::make_shared<ListType>(value_type);
   }
   ```
   
   After this issue is fixed:
   
   ```cpp
   std::shared_ptr<DataType> list(std::shared_ptr<DataType> value_type) {
     return std::make_shared<ListType>(std::move(value_type));
   }
   ```
   
   When working on this, we should take the time to go through every callsite and decide if a `std::move()` is possible without breaking correctness — things could break if the parameter is used after it's moved into the new instance of a parametric type.
   
   
   
   ### 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


Re: [I] [C++] Pass shared_ptr by value to parametric type constructors [arrow]

Posted by "kapoisu (via GitHub)" <gi...@apache.org>.
kapoisu commented on issue #37891:
URL: https://github.com/apache/arrow/issues/37891#issuecomment-2845599276

   @felipecrv Should this be applied to other movable classes (e.g. std::string) or to std::shared_ptr only?


-- 
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: github-unsubscribe@arrow.apache.org

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


Re: [I] [C++] Pass shared_ptr by value to parametric type constructors [arrow]

Posted by "chrisxu333 (via GitHub)" <gi...@apache.org>.
chrisxu333 commented on issue #37891:
URL: https://github.com/apache/arrow/issues/37891#issuecomment-2643203012

   #45466 I've make an initial commit that does a similar change to the SliceBuffer function. @felipecrv Could you help check if I understand the intent of this issue correctly? If so I'll go ahead and make other changes accordingly.


-- 
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: github-unsubscribe@arrow.apache.org

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


Re: [I] [C++] Pass shared_ptr by value to parametric type constructors [arrow]

Posted by "mapleFU (via GitHub)" <gi...@apache.org>.
mapleFU commented on issue #37891:
URL: https://github.com/apache/arrow/issues/37891#issuecomment-2777550006

   @singh1203 feel free to check and add some


-- 
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: github-unsubscribe@arrow.apache.org

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


Re: [I] [C++] Pass shared_ptr by value to parametric type constructors [arrow]

Posted by "chrisxu333 (via GitHub)" <gi...@apache.org>.
chrisxu333 commented on issue #37891:
URL: https://github.com/apache/arrow/issues/37891#issuecomment-2609149005

   @felipecrv If nobody is working on this issue and it's still needed, can I take over?


-- 
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: github-unsubscribe@arrow.apache.org

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


Re: [I] [C++] Pass shared_ptr by value to parametric type constructors [arrow]

Posted by "pitrou (via GitHub)" <gi...@apache.org>.
pitrou closed issue #37891: [C++] Pass shared_ptr<DataType> by value to parametric type constructors
URL: https://github.com/apache/arrow/issues/37891


-- 
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


Re: [I] [C++] Pass shared_ptr by value to parametric type constructors [arrow]

Posted by "pitrou (via GitHub)" <gi...@apache.org>.
pitrou commented on issue #37891:
URL: https://github.com/apache/arrow/issues/37891#issuecomment-2988003986

   Issue resolved by pull request 46202
   https://github.com/apache/arrow/pull/46202


-- 
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: github-unsubscribe@arrow.apache.org

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


Re: [I] [C++] Pass shared_ptr by value to parametric type constructors [arrow]

Posted by "pitrou (via GitHub)" <gi...@apache.org>.
pitrou closed issue #37891: [C++] Pass shared_ptr<DataType> by value to parametric type constructors
URL: https://github.com/apache/arrow/issues/37891


-- 
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


Re: [I] [C++] Pass shared_ptr by value to parametric type constructors [arrow]

Posted by "felipecrv (via GitHub)" <gi...@apache.org>.
felipecrv commented on issue #37891:
URL: https://github.com/apache/arrow/issues/37891#issuecomment-2625138873

   Of course. 


-- 
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: github-unsubscribe@arrow.apache.org

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


Re: [I] [C++] Pass shared_ptr by value to parametric type constructors [arrow]

Posted by "singh1203 (via GitHub)" <gi...@apache.org>.
singh1203 commented on issue #37891:
URL: https://github.com/apache/arrow/issues/37891#issuecomment-2754996022

   @felipecrv I would love to work on it as I am new to 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: github-unsubscribe@arrow.apache.org

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


Re: [I] [C++] Pass shared_ptr by value to parametric type constructors [arrow]

Posted by "Shivani622 (via GitHub)" <gi...@apache.org>.
Shivani622 commented on issue #37891:
URL: https://github.com/apache/arrow/issues/37891#issuecomment-2658196208

   @felipecrv Could you please assign this issue to me if it is still open?


-- 
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: github-unsubscribe@arrow.apache.org

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


Re: [I] [C++] Pass shared_ptr by value to parametric type constructors [arrow]

Posted by "chrisxu333 (via GitHub)" <gi...@apache.org>.
chrisxu333 commented on issue #37891:
URL: https://github.com/apache/arrow/issues/37891#issuecomment-2658204258

   @Shivani622 I'm still working on it.


-- 
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: github-unsubscribe@arrow.apache.org

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


Re: [I] [C++] Pass shared_ptr by value to parametric type constructors [arrow]

Posted by "pitrou (via GitHub)" <gi...@apache.org>.
pitrou commented on issue #37891:
URL: https://github.com/apache/arrow/issues/37891#issuecomment-2677960474

   Issue resolved by pull request 45466
   https://github.com/apache/arrow/pull/45466


-- 
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: github-unsubscribe@arrow.apache.org

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


Re: [I] [C++] Pass shared_ptr by value to parametric type constructors [arrow]

Posted by "felipecrv (via GitHub)" <gi...@apache.org>.
felipecrv commented on issue #37891:
URL: https://github.com/apache/arrow/issues/37891#issuecomment-2715817772

   I will re-open this issue because there many occurrences of `const shared_ptr<T> &` in constructors that should change to `shared_ptr<T>`. I don't expect a single PR to fix all of them.


-- 
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: github-unsubscribe@arrow.apache.org

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