diff --git a/crates/deltalake-core/tests/command_restore.rs b/crates/deltalake-core/tests/command_restore.rs index 2c1c06cbb6..fd8d77c8b9 100644 --- a/crates/deltalake-core/tests/command_restore.rs +++ b/crates/deltalake-core/tests/command_restore.rs @@ -6,6 +6,7 @@ use arrow_schema::{DataType as ArrowDataType, Field}; use chrono::{DateTime, NaiveDateTime, TimeZone, Utc}; use deltalake_core::kernel::{DataType, PrimitiveType, StructField}; use deltalake_core::protocol::SaveMode; +use deltalake_core::storage::commit_uri_from_version; use deltalake_core::{DeltaOps, DeltaTable}; use rand::Rng; use std::error::Error; @@ -117,9 +118,15 @@ async fn test_restore_by_version() -> Result<(), Box> { #[tokio::test] async fn test_restore_by_datetime() -> Result<(), Box> { let context = setup_test().await?; - let mut table = context.table; - let history = table.history(Some(10)).await?; - let timestamp = history.get(1).unwrap().timestamp.unwrap(); + let table = context.table; + let version = 1; + + // The way we obtain a timestamp for a version will have to change when/if we start using CommitInfo for timestamps + let meta = table + .object_store() + .head(&commit_uri_from_version(version)) + .await?; + let timestamp = meta.last_modified.timestamp_millis(); let naive = NaiveDateTime::from_timestamp_millis(timestamp).unwrap(); let datetime: DateTime = Utc.from_utc_datetime(&naive);