You are viewing a plain text version of this content. The canonical link for it is here.
Posted to github@arrow.apache.org by GitBox <gi...@apache.org> on 2021/04/26 15:23:04 UTC

[GitHub] [arrow] jorisvandenbossche commented on pull request #10054: ARROW-10910: [Python] Provide better error message when trying to read from None source

jorisvandenbossche commented on pull request #10054:
URL: https://github.com/apache/arrow/pull/10054#issuecomment-826926941


   Personally, I still find it worth it to provide a better error message. Yes, it's not typical to pass `None` as the file source, but it can accidentally happen, and then the current message is not that helpful (it doesn't give any indication which is incorrectly being passed as None, but just showing a later error about None not having some attribute)
   
   For example adding a simple `not None` to ParquetReader:
   
   ```diff
   --- a/python/pyarrow/_parquet.pyx
   +++ b/python/pyarrow/_parquet.pyx
   @@ -927,7 +927,7 @@ cdef class ParquetReader(_Weakrefable):
            self.pool = maybe_unbox_memory_pool(memory_pool)
            self._metadata = None
    
   -    def open(self, object source, bint use_memory_map=True,
   +    def open(self, object source not None, bint use_memory_map=True,
                 read_dictionary=None, FileMetaData metadata=None,
                 int buffer_size=0):
   ```
   
   could also help if we don't want to add an explicit `if .. is None: ..` check.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org