Skip to content

Commit

Permalink
feat: Safer PartitionSpec & SchemalessPartitionSpec (#645)
Browse files Browse the repository at this point in the history
* SchemalessPartitionSpec

* Traits -> Enum

* Remove PartitionSpec enum

* Address comments
  • Loading branch information
c-thiel authored Nov 3, 2024
1 parent b8f088e commit 6e0bcf5
Show file tree
Hide file tree
Showing 11 changed files with 969 additions and 627 deletions.
6 changes: 3 additions & 3 deletions crates/catalog/memory/src/catalog.rs
Original file line number Diff line number Diff line change
Expand Up @@ -283,7 +283,7 @@ mod tests {
use std::iter::FromIterator;

use iceberg::io::FileIOBuilder;
use iceberg::spec::{NestedField, PartitionSpec, PrimitiveType, Schema, SortOrder, Type};
use iceberg::spec::{BoundPartitionSpec, NestedField, PrimitiveType, Schema, SortOrder, Type};
use regex::Regex;
use tempfile::TempDir;

Expand Down Expand Up @@ -355,7 +355,7 @@ mod tests {

assert_eq!(metadata.current_schema().as_ref(), expected_schema);

let expected_partition_spec = PartitionSpec::builder(expected_schema)
let expected_partition_spec = BoundPartitionSpec::builder((*expected_schema).clone())
.with_spec_id(0)
.build()
.unwrap();
Expand All @@ -365,7 +365,7 @@ mod tests {
.partition_specs_iter()
.map(|p| p.as_ref())
.collect_vec(),
vec![&expected_partition_spec]
vec![&expected_partition_spec.into_schemaless()]
);

let expected_sorted_order = SortOrder::builder()
Expand Down
7 changes: 4 additions & 3 deletions crates/catalog/sql/src/catalog.rs
Original file line number Diff line number Diff line change
Expand Up @@ -781,7 +781,7 @@ mod tests {
use std::hash::Hash;

use iceberg::io::FileIOBuilder;
use iceberg::spec::{NestedField, PartitionSpec, PrimitiveType, Schema, SortOrder, Type};
use iceberg::spec::{BoundPartitionSpec, NestedField, PrimitiveType, Schema, SortOrder, Type};
use iceberg::table::Table;
use iceberg::{Catalog, Namespace, NamespaceIdent, TableCreation, TableIdent};
use itertools::Itertools;
Expand Down Expand Up @@ -874,10 +874,11 @@ mod tests {

assert_eq!(metadata.current_schema().as_ref(), expected_schema);

let expected_partition_spec = PartitionSpec::builder(expected_schema)
let expected_partition_spec = BoundPartitionSpec::builder(expected_schema.clone())
.with_spec_id(0)
.build()
.unwrap();
.unwrap()
.into_schemaless();

assert_eq!(
metadata
Expand Down
Loading

0 comments on commit 6e0bcf5

Please sign in to comment.