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

Dimitri Vorona commented on ARROW-3662:
---------------------------------------

> The idea of "const" files is a bit murky in itself :)

True in general. I'm not completely sure if mmap'ed files are different enough 
to make an exception, but at least from the technical PoW you could get their 
size as a const operation. Thinking about it, the Read(int, 
shared_ptr<Buffer>*) method could also have a const version. 

It came up when I tried to pass a const MemoryMappedFile& to a function. Surely 
I can just pass a pointer, but it feels strange to do it for a read-only file, 
especially when there isn't any seeking involved.

> [C++] Add a const overload to MemoryMappedFile::GetSize
> -------------------------------------------------------
>
>                 Key: ARROW-3662
>                 URL: https://issues.apache.org/jira/browse/ARROW-3662
>             Project: Apache Arrow
>          Issue Type: New Feature
>    Affects Versions: 0.11.1
>            Reporter: Dimitri Vorona
>            Priority: Minor
>              Labels: pull-request-available
>          Time Spent: 20m
>  Remaining Estimate: 0h
>
>  
> While GetSize in general is not a const function, it can be on a 
> MemoryMappedFile. I propose to add a const override directly to the 
> MemoryMappedFile.
> Alternatively we could add a const version on the RandomAccessFile level 
> which would fail, if a const size getting (e.g. without a seek) isn't 
> possible, but it seems to me to be a potential source of hard-to-debug bugs 
> and spurious failures. At would at least require a careful analysis of the 
> platform support of different size getting options.



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Reply via email to