Skip to content

Commit 3ea6f47

Browse files
Revert "feat: Introduce snapshot summary properties (#1336)" (#1390)
1 parent 91a1e3a commit 3ea6f47

File tree

4 files changed

+0
-120
lines changed

4 files changed

+0
-120
lines changed

crates/iceberg/src/catalog/mod.rs

Lines changed: 0 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -495,12 +495,6 @@ pub enum TableUpdate {
495495
/// Schema IDs to remove.
496496
schema_ids: Vec<i32>,
497497
},
498-
/// Add snapshot summary properties.
499-
#[serde(rename_all = "kebab-case")]
500-
AddSnapshotSummaryProperties {
501-
/// Additional properties to add.
502-
properties: HashMap<String, String>,
503-
},
504498
}
505499

506500
impl TableUpdate {
@@ -545,9 +539,6 @@ impl TableUpdate {
545539
Ok(builder.remove_partition_statistics(snapshot_id))
546540
}
547541
TableUpdate::RemoveSchemas { schema_ids } => builder.remove_schemas(&schema_ids),
548-
TableUpdate::AddSnapshotSummaryProperties { properties } => {
549-
builder.add_snapshot_summary_properties(properties)
550-
}
551542
}
552543
}
553544
}
@@ -2107,24 +2098,4 @@ mod tests {
21072098
},
21082099
);
21092100
}
2110-
2111-
#[test]
2112-
fn test_add_snapshot_summary_properties() {
2113-
let mut expected_properties = HashMap::new();
2114-
expected_properties.insert("prop-key".to_string(), "prop-value".to_string());
2115-
2116-
test_serde_json(
2117-
r#"
2118-
{
2119-
"action": "add-snapshot-summary-properties",
2120-
"properties": {
2121-
"prop-key": "prop-value"
2122-
}
2123-
}
2124-
"#,
2125-
TableUpdate::AddSnapshotSummaryProperties {
2126-
properties: expected_properties,
2127-
},
2128-
);
2129-
}
21302101
}

crates/iceberg/src/spec/snapshot.rs

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -205,11 +205,6 @@ impl Snapshot {
205205
snapshot_id: self.snapshot_id,
206206
}
207207
}
208-
209-
/// Add the given properties map to snapshot summary.
210-
pub(crate) fn add_summary_properties(&mut self, props: HashMap<String, String>) {
211-
self.summary.additional_properties.extend(props);
212-
}
213208
}
214209

215210
pub(super) mod _serde {

crates/iceberg/src/spec/table_metadata_builder.rs

Lines changed: 0 additions & 74 deletions
Original file line numberDiff line numberDiff line change
@@ -1244,33 +1244,6 @@ impl TableMetadataBuilder {
12441244

12451245
Ok(self)
12461246
}
1247-
1248-
/// Add summary properties to the latest snapshot for the table metadata.
1249-
pub fn add_snapshot_summary_properties(
1250-
mut self,
1251-
properties: HashMap<String, String>,
1252-
) -> Result<Self> {
1253-
if properties.is_empty() {
1254-
return Ok(self);
1255-
}
1256-
1257-
let snapshot_id = self.metadata.current_snapshot_id.unwrap();
1258-
let mut cur_snapshot = self
1259-
.metadata
1260-
.snapshots
1261-
.remove(&snapshot_id)
1262-
.unwrap()
1263-
.as_ref()
1264-
.clone();
1265-
cur_snapshot.add_summary_properties(properties.clone());
1266-
self.metadata
1267-
.snapshots
1268-
.insert(snapshot_id, Arc::new(cur_snapshot));
1269-
self.changes
1270-
.push(TableUpdate::AddSnapshotSummaryProperties { properties });
1271-
1272-
Ok(self)
1273-
}
12741247
}
12751248

12761249
impl From<TableMetadataBuildResult> for TableMetadata {
@@ -2523,51 +2496,4 @@ mod tests {
25232496
};
25242497
assert_eq!(remove_schema_ids, &[0]);
25252498
}
2526-
2527-
#[test]
2528-
fn test_add_snapshot_summary_properties() {
2529-
let file = File::open(format!(
2530-
"{}/testdata/table_metadata/{}",
2531-
env!("CARGO_MANIFEST_DIR"),
2532-
"TableMetadataV2Valid.json"
2533-
))
2534-
.unwrap();
2535-
let reader = BufReader::new(file);
2536-
let resp = serde_json::from_reader::<_, TableMetadata>(reader).unwrap();
2537-
2538-
let table = Table::builder()
2539-
.metadata(resp)
2540-
.metadata_location("s3://bucket/test/location/metadata/v1.json".to_string())
2541-
.identifier(TableIdent::from_strs(["ns1", "test1"]).unwrap())
2542-
.file_io(FileIOBuilder::new("memory").build().unwrap())
2543-
.build()
2544-
.unwrap();
2545-
assert!(
2546-
table
2547-
.metadata()
2548-
.current_snapshot()
2549-
.unwrap()
2550-
.summary()
2551-
.additional_properties
2552-
.is_empty()
2553-
);
2554-
2555-
let mut new_properties = HashMap::new();
2556-
new_properties.insert("prop-key".to_string(), "prop-value".to_string());
2557-
2558-
let mut meta_data_builder = table.metadata().clone().into_builder(None);
2559-
meta_data_builder = meta_data_builder
2560-
.add_snapshot_summary_properties(new_properties.clone())
2561-
.unwrap();
2562-
let build_result = meta_data_builder.build().unwrap();
2563-
assert_eq!(
2564-
build_result
2565-
.metadata
2566-
.current_snapshot()
2567-
.unwrap()
2568-
.summary()
2569-
.additional_properties,
2570-
new_properties
2571-
);
2572-
}
25732499
}

crates/iceberg/src/transaction/mod.rs

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -128,18 +128,6 @@ impl<'a> Transaction<'a> {
128128
Ok(self)
129129
}
130130

131-
/// Add snapshot summary properties.
132-
pub fn add_snapshot_summary_properties(
133-
mut self,
134-
props: HashMap<String, String>,
135-
) -> Result<Self> {
136-
self.apply(
137-
vec![TableUpdate::AddSnapshotSummaryProperties { properties: props }],
138-
vec![],
139-
)?;
140-
Ok(self)
141-
}
142-
143131
fn generate_unique_snapshot_id(&self) -> i64 {
144132
let generate_random_id = || -> i64 {
145133
let (lhs, rhs) = Uuid::new_v4().as_u64_pair();

0 commit comments

Comments
 (0)