You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I encountered a problem: it seems that hdfs.ListDirectory cannot list files on local filesystem.
The following program works when it connects to an HDFS, but failed with "no such file or directory" error when it connects to the local filesystem:
package main
import (
"fmt"
"github.com/zyxar/hdfs"
)
func main() {
// fs, _ := hdfs.Connect("localhost", 9000)
fs, _ := hdfs.Connect("", 0)
fi, _ := fs.GetPathInfo("/") // Work with both HDFS and local filesystem.
fmt.Println(fi)
fis, _ := fs.ListDirectory("/") // Work with only HDFS but not local filesystem.
fmt.Println(fis)
}
I then checked my build of libhdfs by running the following C program. It works with both HDFS and local filesystem:
I encountered a problem: it seems that hdfs.ListDirectory cannot list files on local filesystem.
The following program works when it connects to an HDFS, but failed with "no such file or directory" error when it connects to the local filesystem:
package main
import (
"fmt"
"github.com/zyxar/hdfs"
)
func main() {
// fs, _ := hdfs.Connect("localhost", 9000)
fs, _ := hdfs.Connect("", 0)
fi, _ := fs.GetPathInfo("/") // Work with both HDFS and local filesystem.
fmt.Println(fi)
fis, _ := fs.ListDirectory("/") // Work with only HDFS but not local filesystem.
fmt.Println(fis)
}
I then checked my build of libhdfs by running the following C program. It works with both HDFS and local filesystem:
include "hdfs.h"
int main() {
// hdfsFS fs = hdfsConnect("localhost", 9000);
hdfsFS fs = hdfsConnectAsUser(NULL, 0, NULL);
int numEntries = 0;
hdfsFileInfo* files = hdfsListDirectory(fs, "/", &numEntries);
for (int i = 0; i < numEntries; ++i) {
printf("%s\n", files[i].mName);
}
hdfsFreeFileInfo(files, numEntries);
return hdfsDisconnect(fs);
}
I cannot find any clue in hdfs.go.
The text was updated successfully, but these errors were encountered: