Skip to content

Commit f48ecd0

Browse files
JanKaulJan Kaul
authored andcommitted
Merge pull request JanKaul#223 from JanKaul/more-context-for-unimplemented
provide more context for unimplemented macro
2 parents 2e2cf62 + 9ddcf4e commit f48ecd0

File tree

5 files changed

+27
-7
lines changed

5 files changed

+27
-7
lines changed

catalogs/iceberg-file-catalog/src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -506,7 +506,7 @@ impl Catalog for FileCatalog {
506506
_identifier: Identifier,
507507
_metadata_location: &str,
508508
) -> Result<Table, IcebergError> {
509-
unimplemented!()
509+
unimplemented!("Register table for file catalog")
510510
}
511511
}
512512

iceberg-rust-spec/src/spec/table_metadata.rs

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -892,6 +892,15 @@ impl From<FormatVersion> for u8 {
892892
}
893893
}
894894

895+
impl From<FormatVersion> for i32 {
896+
fn from(value: FormatVersion) -> Self {
897+
match value {
898+
FormatVersion::V1 => 1,
899+
FormatVersion::V2 => 2,
900+
}
901+
}
902+
}
903+
895904
#[cfg(test)]
896905
mod tests {
897906

iceberg-rust-spec/src/spec/values.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -670,7 +670,7 @@ impl Value {
670670
precision: 38,
671671
scale: dec.scale(),
672672
}),
673-
_ => unimplemented!(),
673+
_ => unimplemented!("Datatype for value"),
674674
}
675675
}
676676

@@ -698,7 +698,7 @@ impl Value {
698698
Value::String(any) => Box::new(any),
699699
Value::UUID(any) => Box::new(any),
700700
Value::Decimal(any) => Box::new(any),
701-
_ => unimplemented!(),
701+
_ => unimplemented!("Value conversion to any"),
702702
}
703703
}
704704

iceberg-rust-spec/src/spec/view_metadata.rs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -301,6 +301,14 @@ impl From<FormatVersion> for u8 {
301301
}
302302
}
303303

304+
impl From<FormatVersion> for i32 {
305+
fn from(value: FormatVersion) -> Self {
306+
match value {
307+
FormatVersion::V1 => 1,
308+
}
309+
}
310+
}
311+
304312
#[derive(Debug, Serialize, Deserialize, PartialEq, Eq, Clone, Default, Builder, Getters)]
305313
#[serde(rename_all = "kebab-case")]
306314
/// Fields for the version 2 of the view metadata.

iceberg-rust/src/catalog/commit.rs

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -420,10 +420,10 @@ pub fn apply_table_updates(
420420
for update in updates {
421421
match update {
422422
TableUpdate::UpgradeFormatVersion { format_version } => {
423-
if u8::from(metadata.format_version) == format_version as u8 {
423+
if i32::from(metadata.format_version) == format_version {
424424
return Ok(());
425425
}
426-
unimplemented!();
426+
unimplemented!("Table format upgrade");
427427
}
428428
TableUpdate::AssignUuid { uuid } => {
429429
metadata.table_uuid = Uuid::parse_str(&uuid)?;
@@ -519,8 +519,11 @@ pub fn apply_view_updates<T: Materialization + 'static>(
519519
) -> Result<(), Error> {
520520
for update in updates {
521521
match update {
522-
ViewUpdate::UpgradeFormatVersion { format_version: _ } => {
523-
unimplemented!();
522+
ViewUpdate::UpgradeFormatVersion { format_version } => {
523+
if i32::from(metadata.format_version.clone()) == format_version {
524+
return Ok(());
525+
}
526+
unimplemented!("Upgrade of format version");
524527
}
525528
ViewUpdate::AssignUuid { uuid } => {
526529
metadata.view_uuid = Uuid::parse_str(&uuid)?;

0 commit comments

Comments
 (0)