From d38b58b3da016cec51e0aaea04abd34d6d7bbb5f Mon Sep 17 00:00:00 2001 From: Dmitry Suvorov Date: Sun, 19 Nov 2023 17:05:34 +0200 Subject: [PATCH] [#1831]: Testing loading Delta table According to the issue test should fail to load table without snapshot (version 0) but test is written to test that it is possible to read and load Delta Table with version 0 into the Rust (functions `open_table` and `open_table_with_version` work) --- crates/deltalake-core/src/lib.rs | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/crates/deltalake-core/src/lib.rs b/crates/deltalake-core/src/lib.rs index 37a6316af5..a14a89c33e 100644 --- a/crates/deltalake-core/src/lib.rs +++ b/crates/deltalake-core/src/lib.rs @@ -690,6 +690,25 @@ mod tests { ); } + #[tokio::test()] + async fn test_version_zero_table_load() { + let path = "./tests/data/COVID-19_NYT"; + let mut latest_table: DeltaTable = crate::open_table(path).await.unwrap(); + + let mut version_0_table = crate::open_table_with_version(path, 0).await.unwrap(); + + let version_0_history = version_0_table + .history(None) + .await + .expect("Cannot get table history"); + let latest_table_history = latest_table + .history(None) + .await + .expect("Cannot get table history"); + + assert_eq!(latest_table_history, version_0_history); + } + #[tokio::test()] #[should_panic(expected = "does not exist or you don't have access!")] async fn test_fail_fast_on_not_existing_path() {