Skip to content

Commit

Permalink
Feat: Normalize TableMetadata (apache#611)
Browse files Browse the repository at this point in the history
* Normalize Table Metadata

* Improve readability & comments
  • Loading branch information
c-thiel authored Sep 9, 2024
1 parent e08c0e5 commit 8a3de4e
Show file tree
Hide file tree
Showing 6 changed files with 631 additions and 117 deletions.
8 changes: 2 additions & 6 deletions crates/catalog/rest/tests/rest_catalog_test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -293,12 +293,8 @@ async fn test_create_table() {
assert_eq!(table.metadata().format_version(), FormatVersion::V2);
assert!(table.metadata().current_snapshot().is_none());
assert!(table.metadata().history().is_empty());
assert!(table.metadata().default_sort_order().unwrap().is_unsorted());
assert!(table
.metadata()
.default_partition_spec()
.unwrap()
.is_unpartitioned());
assert!(table.metadata().default_sort_order().is_unsorted());
assert!(table.metadata().default_partition_spec().is_unpartitioned());
}

#[tokio::test]
Expand Down
2 changes: 1 addition & 1 deletion crates/iceberg/src/io/object_cache.rs
Original file line number Diff line number Diff line change
Expand Up @@ -252,7 +252,7 @@ mod tests {
async fn setup_manifest_files(&mut self) {
let current_snapshot = self.table.metadata().current_snapshot().unwrap();
let current_schema = current_snapshot.schema(self.table.metadata()).unwrap();
let current_partition_spec = self.table.metadata().default_partition_spec().unwrap();
let current_partition_spec = self.table.metadata().default_partition_spec();

// Write data files
let data_file_manifest = ManifestWriter::new(
Expand Down
2 changes: 1 addition & 1 deletion crates/iceberg/src/scan.rs
Original file line number Diff line number Diff line change
Expand Up @@ -979,7 +979,7 @@ mod tests {
.parent_snapshot(self.table.metadata())
.unwrap();
let current_schema = current_snapshot.schema(self.table.metadata()).unwrap();
let current_partition_spec = self.table.metadata().default_partition_spec().unwrap();
let current_partition_spec = self.table.metadata().default_partition_spec();

// Write data files
let data_file_manifest = ManifestWriter::new(
Expand Down
2 changes: 1 addition & 1 deletion crates/iceberg/src/spec/sort.rs
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ pub struct SortOrder {
}

impl SortOrder {
const UNSORTED_ORDER_ID: i64 = 0;
pub(crate) const UNSORTED_ORDER_ID: i64 = 0;

/// Create sort order builder
pub fn builder() -> SortOrderBuilder {
Expand Down
Loading

0 comments on commit 8a3de4e

Please sign in to comment.