-
Notifications
You must be signed in to change notification settings - Fork 4k
ARROW-1783: [Python] Provide a "component" dict representation of a serialized Python object with minimal allocation #1362
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Closed
Closed
Changes from all commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
598ef33
Tweak
wesm 337e1d2
Draft SerializedPyObject::GetComponents
wesm b1e31a3
Draft GetTensorMessage
wesm 58174dd
More progress, stubs for reconstruction
wesm 50d2fee
Finish componentwise serialization roundtrip
wesm fffc7bb
Typos, add deserialize_components to API
wesm 1d2e0e2
Fix function documentation
wesm e8c76d4
Acquire GIL in GetSerializedFromComponents
wesm 4ec5a89
Add missing decref on error
wesm File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -144,33 +144,20 @@ class ARROW_EXPORT MessageReader { | |
| public: | ||
| virtual ~MessageReader() = default; | ||
|
|
||
| /// \brief Create MessageReader that reads from InputStream | ||
| static std::unique_ptr<MessageReader> Open(io::InputStream* stream); | ||
|
|
||
| /// \brief Create MessageReader that reads from owned InputStream | ||
| static std::unique_ptr<MessageReader> Open( | ||
| const std::shared_ptr<io::InputStream>& owned_stream); | ||
|
|
||
| /// \brief Read next Message from the interface | ||
| /// | ||
| /// \param[out] message an arrow::ipc::Message instance | ||
| /// \return Status | ||
| virtual Status ReadNextMessage(std::unique_ptr<Message>* message) = 0; | ||
| }; | ||
|
|
||
| /// \brief Implementation of MessageReader that reads from InputStream | ||
| /// \since 0.5.0 | ||
| class ARROW_EXPORT InputStreamMessageReader : public MessageReader { | ||
|
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It was never necessary to export this class |
||
| public: | ||
| explicit InputStreamMessageReader(io::InputStream* stream) : stream_(stream) {} | ||
|
|
||
| explicit InputStreamMessageReader(const std::shared_ptr<io::InputStream>& owned_stream) | ||
| : InputStreamMessageReader(owned_stream.get()) { | ||
| owned_stream_ = owned_stream; | ||
| } | ||
|
|
||
| ~InputStreamMessageReader(); | ||
|
|
||
| Status ReadNextMessage(std::unique_ptr<Message>* message) override; | ||
|
|
||
| private: | ||
| io::InputStream* stream_; | ||
| std::shared_ptr<io::InputStream> owned_stream_; | ||
| }; | ||
|
|
||
| /// \brief Read encapulated RPC message from position in file | ||
| /// | ||
| /// Read a length-prefixed message flatbuffer starting at the indicated file | ||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For the record, is there a rationale or convention for the use of unique_ptr vs shared_ptr here? :-)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I try to only use shared_ptr when there is some reasonable expectation that shared ownership may be frequently needed (of course one can always transfer the pointer to a shared_ptr if needed). There are some other places in the library where
shared_ptris returned (or an out-variable) that would be better asunique_ptr