mchades commented on code in PR #7215:
URL: https://github.com/apache/gravitino/pull/7215#discussion_r2105737964
##########
catalogs/catalog-hadoop/src/main/java/org/apache/gravitino/catalog/hadoop/HadoopCatalogOperations.java:
##########
@@ -237,6 +242,48 @@ public Fileset loadFileset(NameIdentifier ident) throws
NoSuchFilesetException {
});
}
+ @Override
+ public FileInfo[] listFiles(NameIdentifier ident, String locationName,
String subPath)
+ throws NoSuchFilesetException, IOException {
+ if (disableFSOps) {
+ LOG.warn("Filesystem operations disabled, rejecting listFiles for {}",
ident);
+ throw new UnsupportedOperationException("Filesystem operations are
disabled on this server");
+ }
+
+ String decodedSubPath = subPath;
+ if (StringUtils.isNotBlank(subPath)) {
+ decodedSubPath = URLDecoder.decode(subPath,
StandardCharsets.UTF_8.name());
+ }
+ String actualPath = getFileLocation(ident, decodedSubPath, locationName);
+ Path formalizedPath = formalizePath(new Path(actualPath), conf);
+
+ FileSystem fs = getFileSystem(formalizedPath, conf);
+ if (!fs.exists(formalizedPath)) {
+ return new FileInfo[0];
+ }
+
+ try {
+ FileStatus[] fileStatuses = fs.listStatus(formalizedPath);
+ FileInfo[] fileInfos = new FileInfo[fileStatuses.length];
+ for (int i = 0; i < fileStatuses.length; i++) {
+ FileStatus status = fileStatuses[i];
+ fileInfos[i] =
+ FileInfoDTO.builder()
+ .name(status.getPath().getName())
+ .isDir(status.isDirectory())
+ .size(status.getLen())
+ .lastModified(status.getModificationTime())
+ .path(status.getPath().toString())
Review Comment:
the path should be a gvfs path, such as
`/fileset/catalog1/schema1/fileset1/1.txt`
--
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]