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
What happened:
New folder created at the beginning of deltalake::open_table("./tests/data/folder_doesnt_exist").await? which isn't expected and only then it fails with NotATable error which is expected. It uses ensure_table_uri function in the build_storage function during load of Delta Table. And ensure_table_uri creates new folder (recursively) if folder doesn't exist. Moreover it doesn't remove that folder at the end so you end up with failed function call and new folder. What you expected to happen:
I guess it will be nice to fail fast in case user is trying to load some path which isn't even exists not to mention it can't be a table 🙂... How to reproduce it: deltalake::open_table("./tests/data/folder_doesnt_exist").await? and you will see that folder_not_exists will be created. More details:
crates/deltalake-core/src/lib.rs
#[tokio::test()]
#[should_panic(expected = "NotATable(\"No snapshot or version 0 found")]
async fn test_load_non_existing_folder() {
use std::path::Path as FolderPath;
use std::fs;
let path_str = "./tests/data/folder_doesnt_exist";
// Check that there is no such path at the beginning
let path_doesnt_exist = !FolderPath::new(path_str).exists();
assert!(path_doesnt_exist);
let result = match crate::open_table(path_str).await {
Ok(table) => Ok(table),
Err(e) => {
let newly_created_folder_path = FolderPath::new(path_str);
assert!(newly_created_folder_path.exists());
// This needs because it actually creates a folder and we need to remove it at the end of the test 😁
fs::remove_dir(newly_created_folder_path)
.expect("can't remove folder for some reason");
Err(e)
}
};
result.unwrap();
}
The text was updated successfully, but these errors were encountered:
# Description
Save user from ending up with failed `load` function call and new folder created - failing fast in case user is trying to load some path that doesn't exist
# Related Issue(s)
- closesdelta-io#1916
# Description
Save user from ending up with failed `load` function call and new folder created - failing fast in case user is trying to load some path that doesn't exist
# Related Issue(s)
- closes#1916
ion-elgreco
pushed a commit
to ion-elgreco/delta-rs
that referenced
this issue
Dec 1, 2023
# Description
Save user from ending up with failed `load` function call and new folder created - failing fast in case user is trying to load some path that doesn't exist
# Related Issue(s)
- closesdelta-io#1916
Environment
Delta-rs version: 0.17.0
Binding: rust
Environment:
Bug
What happened:
New folder created at the beginning of
deltalake::open_table("./tests/data/folder_doesnt_exist").await?
which isn't expected and only then it fails withNotATable
error which is expected. It usesensure_table_uri
function in thebuild_storage
function during load of Delta Table. Andensure_table_uri
creates new folder (recursively) if folder doesn't exist. Moreover it doesn't remove that folder at the end so you end up with failed function call and new folder.What you expected to happen:
I guess it will be nice to fail fast in case user is trying to load some path which isn't even exists not to mention it can't be a table 🙂...
How to reproduce it:
deltalake::open_table("./tests/data/folder_doesnt_exist").await?
and you will see thatfolder_not_exists
will be created.More details:
crates/deltalake-core/src/lib.rs
The text was updated successfully, but these errors were encountered: