Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix the error that when execute client.list_status_iter(&source_file_path, true); in windows paltform,throw file not found error because of the path separator is not '/' but '\' #196

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

awol2005ex
Copy link
Contributor

fix the error that when execute client.list_status_iter(&source_file_path, true); in windows paltform,throw file not found error because of the path separator is not '/' but ''

…_path, true); in windows paltform,throw file not found error because of the path separator is not '/' but '\'
@Kimahriman
Copy link
Owner

Where is the \ coming from? Passed into list_status_iter? Or some internal part of that generates it even though / is used as the input?

@awol2005ex
Copy link
Contributor Author

When I use list_status in windows 10, the path of the folder always ends withs '' , for example I list /xxx ,It show /xxx\a1 ,/xxx\a2 ,/xxx\s3

@Kimahriman
Copy link
Owner

Can you write up an issue with some examples? This is likely due to the use of PathBuf which is trying to use a different separator when run on Windows. Should probably be fixed in a more general way than just trying to replace \ with / manually

@awol2005ex
Copy link
Contributor Author

Can you write up an issue with some examples? This is likely due to the use of PathBuf which is trying to use a different separator when run on Windows. Should probably be fixed in a more general way than just trying to replace \ with / manually

`let config = HashMap::from([
(
"dfs.namenode.servicerpc-address".to_string(),
"xxxxx:8022".to_string(),
),
(
"dfs.namenode.keytab.file".to_string(),
"/tmp/xxx.keytab".to_string(),
),
(
"dfs.namenode.keytab.enabled".to_string(),
"true".to_string(),
),
(
"dfs.namenode.kerberos.principal".to_string(),
"[email protected]".to_string(),
),
]);
let client = Client::new_with_config("hdfs://xxxxx:8020", config)?;

let files = client.list_status("/user", false).await?;
for file in files {
    println!("{}", file.path);
}`

result:
/user\flink
/user\hdfs
/user\history
/user\hdfs
/user\gip
/user\history

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants