qccash opened a new issue, #2608:
URL: https://github.com/apache/iceberg-python/issues/2608

   ### Apache Iceberg version
   
   0.10.0 (latest release)
   
   ### Please describe the bug 🐞
   
   https://github.com/apache/iceberg-python/pull/1887#discussion_r2425543019
   
   If the content in version-hint.text is not endswith 'metadata.json'.
   The ERROR stack should be like;
   ```
   Traceback (most recent call last):
     File "<stdin>", line 1, in <module>
     File 
"/home/xxxxxx/python-env/pyiceberg/lib/python3.11/site-packages/pyiceberg/table/__init__.py",
 line 1599, in from_metadata
       metadata = FromInputFile.table_metadata(file)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
     File 
"/home/xxxxxx/python-env/pyiceberg/lib/python3.11/site-packages/pyiceberg/serializers.py",
 line 113, in table_metadata
       with input_file.open() as input_stream:
            ^^^^^^^^^^^^^^^^^
     File 
"/home/xxxxxx/python-env/pyiceberg/lib/python3.11/site-packages/pyiceberg/io/pyarrow.py",
 line 333, in open
       input_file = self._filesystem.open_input_file(self._path)
                    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
     File "pyarrow/_fs.pyx", line 814, in pyarrow._fs.FileSystem.open_input_file
     File "pyarrow/error.pxi", line 155, in 
pyarrow.lib.pyarrow_internal_check_status
     File "pyarrow/error.pxi", line 92, in pyarrow.lib.check_status
   FileNotFoundError: [Errno 2] Path does not exist 
'static/table/path/metadata/v%s.metadata.json'. Detail: [errno 2] No such file 
or directory
   ```
   
   Here is a syntax error in StaticTable._metadata_location_from_version_hint, 
should be 
   ```python
           if content.endswith(".metadata.json"):
               return os.path.join(metadata_location, "metadata", content)
           elif content.isnumeric():
               return os.path.join(metadata_location, "metadata", 
"v{}.metadata.json").format(content)
           else:
               return os.path.join(metadata_location, "metadata", 
"{}.metadata.json").format(content)
   ```
   In pytest.fixture table_location, the case metadata_filename = 
f"{uuid.uuid4()}.metadata.json" does not cover the faulty code path.
   
   ### Willingness to contribute
   
   - [ ] I can contribute a fix for this bug independently
   - [x] I would be willing to contribute a fix for this bug with guidance from 
the Iceberg community
   - [ ] I cannot contribute a fix for this bug at this time


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

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to