[ 
https://issues.apache.org/jira/browse/ARROW-6180?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16904683#comment-16904683
 ] 

Wes McKinney edited comment on ARROW-6180 at 8/13/19 8:23 PM:
--------------------------------------------------------------

The way I would do this is as follows:

* Add {{RandomAccessFile::GetStream(int64_t offset, int64_t length, 
std::shared_ptr<InputStream>* out)}} (or similarly named -- might need to be a 
top-level function so that it can retain a shared_ptr to the parent file)
* Implement the object returned by this method privately. So no need to add any 
new class to public headers


was (Author: wesmckinn):
The way I would do this is as follows:

* Add {{RandomAccessFile::GetStream(int64_t offset, int64_t length, 
std::shared_ptr<InputStream>* out)}} (or similarly named)
* Implement the object returned by this method privately. So no need to add any 
new class to public headers

> [C++] Create InputStream that references a segment of a RandomAccessFile
> ------------------------------------------------------------------------
>
>                 Key: ARROW-6180
>                 URL: https://issues.apache.org/jira/browse/ARROW-6180
>             Project: Apache Arrow
>          Issue Type: Improvement
>          Components: C++
>            Reporter: Wes McKinney
>            Assignee: Zherui Cao
>            Priority: Major
>
> If different threads wants to do buffered reads over different portions of a 
> file (and they are unable to create their own separate file handles), they 
> may clobber each other. I would propose creating an object that keeps the 
> RandomAccessFile internally and implements the InputStream API in a way that 
> is safe from other threads changing the file position



--
This message was sent by Atlassian JIRA
(v7.6.14#76016)

Reply via email to