[ https://issues.apache.org/jira/browse/ARROW-2118?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16395540#comment-16395540 ]
ASF GitHub Bot commented on ARROW-2118: --------------------------------------- wesm commented on a change in pull request #1735: ARROW-2118: [C++] Fix misleading error when memory mapping a zero-length file URL: https://github.com/apache/arrow/pull/1735#discussion_r173877848 ########## File path: cpp/src/arrow/io/file.cc ########## @@ -624,16 +624,22 @@ class MemoryMappedFile::MemoryMap : public MutableBuffer { is_mutable_ = false; } - void* result = mmap(nullptr, static_cast<size_t>(file_->size()), prot_flags, map_mode, - file_->fd(), 0); - if (result == MAP_FAILED) { - std::stringstream ss; - ss << "Memory mapping file failed, errno: " << errno; - return Status::IOError(ss.str()); + size_ = file_->size(); + + void* result = nullptr; + + // Memory mapping fails when file size is 0 Review comment: In theory, if the length is zero, this `data_` member should never be used for anything, so I might argue that having an ASAN / valgrind failure for passing nullptr someplace it shouldn't go would be a good thing ---------------------------------------------------------------- This is an automated message from the Apache Git Service. To respond to the message, please log on GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org > [Python] Improve error message when calling parquet.read_table on an empty > file > ------------------------------------------------------------------------------- > > Key: ARROW-2118 > URL: https://issues.apache.org/jira/browse/ARROW-2118 > Project: Apache Arrow > Issue Type: Improvement > Components: Python > Reporter: Wes McKinney > Assignee: Wes McKinney > Priority: Major > Labels: pull-request-available > Fix For: 0.9.0 > > > Currently it raises an exception about memory mapping failing -- This message was sent by Atlassian JIRA (v7.6.3#76005)