qccash commented on code in PR #1887:
URL: https://github.com/apache/iceberg-python/pull/1887#discussion_r2425543019


##########
pyiceberg/table/__init__.py:
##########
@@ -1378,8 +1379,27 @@ def refresh(self) -> Table:
         """Refresh the current table metadata."""
         raise NotImplementedError("To be implemented")
 
+    @classmethod
+    def _metadata_location_from_version_hint(cls, metadata_location: str, 
properties: Properties = EMPTY_DICT) -> str:
+        version_hint_location = os.path.join(metadata_location, "metadata", 
"version-hint.text")
+        io = load_file_io(properties=properties, 
location=version_hint_location)
+        file = io.new_input(version_hint_location)
+
+        with file.open() as stream:
+            content = stream.read().decode("utf-8")
+
+        if content.endswith(".metadata.json"):
+            return os.path.join(metadata_location, "metadata", content)
+        elif content.isnumeric():
+            return os.path.join(metadata_location, "metadata", 
"v%s.metadata.json").format(content)
+        else:
+            return os.path.join(metadata_location, "metadata", 
"%s.metadata.json").format(content)

Review Comment:
   Here is a syntax error, should be "{}".format.
   In pytest.fixture table_location, the case metadata_filename = 
f"{uuid.uuid4()}.metadata.json" does not cover the faulty code path.



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