danielcweeks commented on a change in pull request #277: Moving/Renaming hadoop
module to filesystem
URL: https://github.com/apache/incubator-iceberg/pull/277#discussion_r309466972
##########
File path: python/iceberg/core/filesystem/local_filesystem.py
##########
@@ -51,34 +63,19 @@ def fix_path(path):
path = str(path[7:])
return path
- # def ls(self, path):
- # return os.listdir(path)
- #
- # def delete(self, path, recursive=False):
- # return os.remove(path)
- #
-
- #
- # def rename(self, path, new_path):
- # return os.rename(path, new_path)
- #
- # def mkdir(self, path, create_parents=True):
- # if create_parents:
- # return os.makedirs(path)
- #
- # return os.mkdir(path)
- #
- # def exists(self, path):
- # return os.path.isfile(path)
- #
- # def isdir(self, path):
- # return os.path.isdir(path)
- #
- # def isfile(self, path):
- # return os.path.isfile(path)
- #
- # def _isfilestore(self):
- # return True
- #
- # def open(self, path, mode='rb'):
- # return open(path, mode=mode)
+ def create(self, path, overwrite=False):
+ if os.path.exists(path) and not overwrite:
+ raise RuntimeError("Path %s already exists" % path)
+
+ return open(path, "w")
+
+ def rename(self, src, dest):
+ try:
+ os.rename(src, dest)
+ except OSError:
+ return False
+
+ return True
+
+ def exists(self, path):
+ return os.path.isfile(path)
Review comment:
I think you want `os.path.exists` here otherwise we're not particularly
clear about the semantics of what we are checking for existence.
----------------------------------------------------------------
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:
[email protected]
With regards,
Apache Git Services
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]