rdblue commented on code in PR #5096:
URL: https://github.com/apache/iceberg/pull/5096#discussion_r902050353
##########
core/src/main/java/org/apache/iceberg/hadoop/HadoopFileIO.java:
##########
@@ -89,4 +97,62 @@ public Configuration getConf() {
public void serializeConfWith(Function<Configuration,
SerializableSupplier<Configuration>> confSerializer) {
this.hadoopConf = confSerializer.apply(getConf());
}
+
+ @Override
+ public Stream<FileInfo> listPrefix(String prefix) {
+ Path prefixToList = new Path(prefix);
+ FileSystem fs = Util.getFs(prefixToList, hadoopConf.get());
+
+ try {
+ return Streams.stream(new AdaptingIterator<>(fs.listFiles(prefixToList,
true)))
+ .map(fileStatus -> new FileInfo(fileStatus.getPath().toString(),
fileStatus.getLen(),
+ Instant.ofEpochMilli(fileStatus.getModificationTime())));
+ } catch (IOException e) {
+ throw new UncheckedIOException(e);
+ }
+ }
+
+ @Override
+ public void deletePrefix(String prefix) {
+ Path prefixToDelete = new Path(prefix);
+ FileSystem fs = Util.getFs(prefixToDelete, hadoopConf.get());
+
+ try {
+ fs.delete(prefixToDelete, true);
Review Comment:
Same here: `fs.delete(prefixToDelete, true /* recursive */);`
--
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]