-
Notifications
You must be signed in to change notification settings - Fork 3.6k
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
ARROW-194: C++: Allow read-only memory mapped source #72
Conversation
rwmmap->Close(); | ||
|
||
std::shared_ptr<MemoryMappedSource> rommap; | ||
ASSERT_OK(MemoryMappedSource::Open(path, MemorySource::READ_WRITE, &rommap)); |
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.
did you mean to open this read only?
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.
Yes. Sorry for my mistake.
- Added a routine to check the protection flag before writing - Added a unit test to check the error status for protection mode - Improved failure check for mmap()
@emkornfield, thank you for your review. I've addressed your comments. |
Broken ci is fixed. |
@@ -53,10 +53,12 @@ class MemoryMappedSource::Impl { | |||
Status Open(const std::string& path, MemorySource::AccessMode mode) { | |||
if (is_open_) { return Status::IOError("A file is already open"); } | |||
|
|||
path_ = path; |
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.
why are you deleting this?
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.
Because this variable is currently not used anywhere. In addition, current implementation expects a file exists in a given path, which in turn means the file is already created in some other parts of the program. So, I think MemoryMappedSource is not responsible for deleting files used for mmap.
In addition, if path
is required later, we can add it again easily.
A couple of more small comments but otherwise LGTM. |
Thanks for your review. I've changed the type of protection flag and left a comment. |
This also looks good to me -- if you can add a check that trying to write to a read-only file results in error status, that is the last major item. |
@wesm, thank you for your comment. I've already added a check as seen at Line 142 in memory.cc (https://github.com/apache/arrow/pull/72/files#diff-a061f9b82da1c0b5b7ff8905bd134e4fR142), but do you mean that it is not enough? If so, please let me know how I can improve this. |
Please add a test case |
@jihoonson oops, sorry about that, I see it now =) I have a difficult time following code reviews in GitHub, hoping we move to Gerrit soon |
+1, thank you |
@jihoonson I've added you as a contributor on the Arrow JIRA. welcome to the project and thank you! |
No problem. @emkornfield and @wesm, thank you for your review! |
Added support for literals and null for time types.
Added support for literals and null for time types.
Added support for literals and null for time types.
Added support for literals and null for time types.
Added `MemoryAllocator` interface and a default implementation, ensured `MemPool` can use a custom allocator, added `Vector<T>` to replace `std::vector<T>`. Author: Aliaksei Sandryhaila <aliaksei.sandryhaila@hp.com> Closes apache#72 from asandryh/PARQUET-542 and squashes the following commits: a740edb [Aliaksei Sandryhaila] Incorporated PR feedback. 6422e0d [Aliaksei Sandryhaila] Added MemoryAllocator interface and default implementation, ensured MemPool can use a custom allocator, added Vector<T> to replace std::vector<T>.
Added support for literals and null for time types.
Added `MemoryAllocator` interface and a default implementation, ensured `MemPool` can use a custom allocator, added `Vector<T>` to replace `std::vector<T>`. Author: Aliaksei Sandryhaila <aliaksei.sandryhaila@hp.com> Closes apache#72 from asandryh/PARQUET-542 and squashes the following commits: a740edb [Aliaksei Sandryhaila] Incorporated PR feedback. 6422e0d [Aliaksei Sandryhaila] Added MemoryAllocator interface and default implementation, ensured MemPool can use a custom allocator, added Vector<T> to replace std::vector<T>. Change-Id: I1556f3988516e878893744c2c73688c923892b5e
Added `MemoryAllocator` interface and a default implementation, ensured `MemPool` can use a custom allocator, added `Vector<T>` to replace `std::vector<T>`. Author: Aliaksei Sandryhaila <aliaksei.sandryhaila@hp.com> Closes apache#72 from asandryh/PARQUET-542 and squashes the following commits: a740edb [Aliaksei Sandryhaila] Incorporated PR feedback. 6422e0d [Aliaksei Sandryhaila] Added MemoryAllocator interface and default implementation, ensured MemPool can use a custom allocator, added Vector<T> to replace std::vector<T>. Change-Id: I1556f3988516e878893744c2c73688c923892b5e
Added `MemoryAllocator` interface and a default implementation, ensured `MemPool` can use a custom allocator, added `Vector<T>` to replace `std::vector<T>`. Author: Aliaksei Sandryhaila <aliaksei.sandryhaila@hp.com> Closes apache#72 from asandryh/PARQUET-542 and squashes the following commits: a740edb [Aliaksei Sandryhaila] Incorporated PR feedback. 6422e0d [Aliaksei Sandryhaila] Added MemoryAllocator interface and default implementation, ensured MemPool can use a custom allocator, added Vector<T> to replace std::vector<T>. Change-Id: I1556f3988516e878893744c2c73688c923892b5e
Added `MemoryAllocator` interface and a default implementation, ensured `MemPool` can use a custom allocator, added `Vector<T>` to replace `std::vector<T>`. Author: Aliaksei Sandryhaila <aliaksei.sandryhaila@hp.com> Closes apache#72 from asandryh/PARQUET-542 and squashes the following commits: a740edb [Aliaksei Sandryhaila] Incorporated PR feedback. 6422e0d [Aliaksei Sandryhaila] Added MemoryAllocator interface and default implementation, ensured MemPool can use a custom allocator, added Vector<T> to replace std::vector<T>. Change-Id: I1556f3988516e878893744c2c73688c923892b5e
Added support for literals and null for time types.
Added support for literals and null for time types.
* Inital commit * Add ceil function
* Inital commit * Add ceil function
* Add translate expression support (apache#68) * Initial commit * Introduce TranslateHolder * Remove unused header * Return 1 if empty string is given as substring (apache#69) * Add two math operations: floor & ceil (apache#72) * Inital commit * Add ceil function Co-authored-by: PHILO-HE <feilong.he@intel.com>
* Inital commit * Add ceil function
* Inital commit * Add ceil function
* Inital commit * Add ceil function
A simple patch to allow read-only mode. A test is also included.