Skip to content
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

Closed
wants to merge 6 commits into from

Conversation

jihoonson
Copy link
Contributor

A simple patch to allow read-only mode. A test is also included.

rwmmap->Close();

std::shared_ptr<MemoryMappedSource> rommap;
ASSERT_OK(MemoryMappedSource::Open(path, MemorySource::READ_WRITE, &rommap));
Copy link
Contributor

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?

Copy link
Contributor Author

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()
@jihoonson
Copy link
Contributor Author

@emkornfield, thank you for your review. I've addressed your comments.

@jihoonson
Copy link
Contributor Author

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;
Copy link
Contributor

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?

Copy link
Contributor Author

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.

@emkornfield
Copy link
Contributor

A couple of more small comments but otherwise LGTM.

@jihoonson
Copy link
Contributor Author

Thanks for your review. I've changed the type of protection flag and left a comment.

@wesm
Copy link
Member

wesm commented May 9, 2016

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.

@jihoonson
Copy link
Contributor Author

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

@wesm
Copy link
Member

wesm commented May 9, 2016

Please add a test case

@jihoonson
Copy link
Contributor Author

@wesm
Copy link
Member

wesm commented May 9, 2016

@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

@wesm
Copy link
Member

wesm commented May 9, 2016

+1, thank you

@asfgit asfgit closed this in c9ffe54 May 9, 2016
@wesm
Copy link
Member

wesm commented May 9, 2016

@jihoonson I've added you as a contributor on the Arrow JIRA. welcome to the project and thank you!

@jihoonson
Copy link
Contributor Author

No problem. @emkornfield and @wesm, thank you for your review!

praveenbingo added a commit to praveenbingo/arrow that referenced this pull request Aug 30, 2018
Added support for literals and null for time types.
praveenbingo added a commit to praveenbingo/arrow that referenced this pull request Aug 30, 2018
Added support for literals and null for time types.
praveenbingo added a commit to praveenbingo/arrow that referenced this pull request Aug 30, 2018
Added support for literals and null for time types.
praveenbingo added a commit to praveenbingo/arrow that referenced this pull request Aug 30, 2018
Added support for literals and null for time types.
wesm pushed a commit to wesm/arrow that referenced this pull request Sep 2, 2018
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>.
praveenbingo added a commit to praveenbingo/arrow that referenced this pull request Sep 4, 2018
Added support for literals and null for time types.
wesm pushed a commit to wesm/arrow that referenced this pull request Sep 4, 2018
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
wesm pushed a commit to wesm/arrow that referenced this pull request Sep 6, 2018
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
wesm pushed a commit to wesm/arrow that referenced this pull request Sep 7, 2018
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
wesm pushed a commit to wesm/arrow that referenced this pull request Sep 8, 2018
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
praveenbingo added a commit to praveenbingo/arrow that referenced this pull request Sep 10, 2018
Added support for literals and null for time types.
praveenbingo added a commit to praveenbingo/arrow that referenced this pull request Sep 10, 2018
Added support for literals and null for time types.
zhouyuan pushed a commit to zhouyuan/arrow that referenced this pull request Jan 7, 2022
* Inital commit

* Add ceil function
zhztheplayer pushed a commit to zhztheplayer/arrow-1 that referenced this pull request Jan 7, 2022
* Inital commit

* Add ceil function
zhouyuan added a commit to zhouyuan/arrow that referenced this pull request Jan 9, 2022
* 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>
zhztheplayer pushed a commit to zhztheplayer/arrow-1 that referenced this pull request Feb 8, 2022
* Inital commit

* Add ceil function
zhztheplayer pushed a commit to zhztheplayer/arrow-1 that referenced this pull request Mar 3, 2022
* Inital commit

* Add ceil function
rui-mo pushed a commit to rui-mo/arrow-1 that referenced this pull request Mar 23, 2022
* Inital commit

* Add ceil function
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants