Skip to content

Commit cff42fc

Browse files
authored
refactor: remove table_url from Snapshot (delta-io#3803)
# Description Our internal checkpoint currently tracks the table URL which is also accessible on the kernel snapshot. This PR just removes the field in favour of accessing it on the snapshot directly. Signed-off-by: Robert Pack <robstar.pack@gmail.com>
1 parent a61ac16 commit cff42fc

2 files changed

Lines changed: 3 additions & 9 deletions

File tree

crates/core/src/kernel/snapshot/mod.rs

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,6 @@ use itertools::Itertools;
3535
use object_store::path::Path;
3636
use object_store::ObjectStore;
3737
use tokio::task::spawn_blocking;
38-
use url::Url;
3938

4039
use super::{Action, CommitInfo, Metadata, Protocol, Remove};
4140
use crate::kernel::arrow::engine_ext::{ScanExt, SnapshotExt};
@@ -69,8 +68,6 @@ pub struct Snapshot {
6968
config: DeltaTableConfig,
7069
/// Logical table schema
7170
schema: SchemaRef,
72-
/// Fully qualified URL of the table
73-
table_url: Url,
7471
}
7572

7673
impl Snapshot {
@@ -118,7 +115,6 @@ impl Snapshot {
118115
inner: snapshot,
119116
config,
120117
schema,
121-
table_url: log_store.config().location.clone(),
122118
})
123119
}
124120

@@ -136,7 +132,7 @@ impl Snapshot {
136132
store.put(&uri, data.into()).await?;
137133
}
138134

139-
let table_url = Url::parse("memory:///").unwrap();
135+
let table_url = url::Url::parse("memory:///").unwrap();
140136

141137
let log_store = default_logstore(
142138
store.clone(),
@@ -154,7 +150,6 @@ impl Snapshot {
154150
inner: snapshot,
155151
config: Default::default(),
156152
schema,
157-
table_url,
158153
},
159154
log_store,
160155
))
@@ -221,7 +216,7 @@ impl Snapshot {
221216

222217
/// Get the table root of the snapshot
223218
pub(crate) fn table_root_path(&self) -> DeltaResult<Path> {
224-
Ok(Path::from_url_path(self.table_url.path())?)
219+
Ok(Path::from_url_path(self.inner.table_root().path())?)
225220
}
226221

227222
/// Well known properties of the table

crates/core/src/kernel/snapshot/serde.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ impl Serialize for Snapshot {
5454
let mut seq = serializer.serialize_seq(None)?;
5555

5656
seq.serialize_element(&self.version())?;
57-
seq.serialize_element(&self.table_url)?;
57+
seq.serialize_element(&self.inner.table_root())?;
5858
seq.serialize_element(&self.protocol())?;
5959
seq.serialize_element(&self.metadata())?;
6060
seq.serialize_element(&ascending_commit_files)?;
@@ -202,7 +202,6 @@ impl<'de> Visitor<'de> for SnapshotVisitor {
202202

203203
Ok(Snapshot {
204204
inner: Arc::new(snapshot),
205-
table_url,
206205
schema: Arc::new(schema),
207206
config,
208207
})

0 commit comments

Comments
 (0)