rominparekh commented on a change in pull request #134: Adding Drop and Rename
APIs to Tables interface.
URL: https://github.com/apache/incubator-iceberg/pull/134#discussion_r267044365
##########
File path: core/src/main/java/com/netflix/iceberg/hadoop/HadoopTables.java
##########
@@ -66,6 +70,28 @@ public Table load(String location) {
return new BaseTable(ops, location);
}
+ @Override
+ public void drop(String location) {
+ final Path path = new Path(location);
+ final FileSystem fs = Util.getFS(path, conf);
+ try {
+ fs.delete(path, true);
+ } catch (IOException e) {
+ throw new RuntimeIOException(e);
+ }
+ }
+
+ @Override
+ public void rename(String location, String newLoaction) {
+ final Path path = new Path(location);
+ final FileSystem fs = Util.getFS(path, conf);
+ try {
+ fs.rename(path, new Path(path, newLoaction));
Review comment:
The `rename` API returns a boolean. `true` if rename was successful and in
`false` in some cases. For instance, if the parent directory is not present in
`newLocation` then `rename` will return a `false` instead of throwing an
exception. Example:
```
rename `/a/b/c/x` to `/a/b/d/x` will return `false` if `d` does not exist.
----------------------------------------------------------------
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]