@@ -701,9 +701,9 @@ mod tests {
701
701
702
702
use chrono:: { TimeZone , Utc } ;
703
703
use iceberg:: spec:: {
704
- FormatVersion , NestedField , NullOrder , Operation , PrimitiveType , Schema , Snapshot ,
705
- SnapshotLog , SortDirection , SortField , SortOrder , Summary , Transform , Type ,
706
- UnboundPartitionField , UnboundPartitionSpec ,
704
+ FormatVersion , NestedField , NullOrder , Operation , PartitionSpecBuilder , PrimitiveType ,
705
+ Schema , Snapshot , SnapshotLog , SortDirection , SortField , SortOrder , Summary , Transform ,
706
+ Type ,
707
707
} ;
708
708
use iceberg:: transaction:: Transaction ;
709
709
use mockito:: { Mock , Server , ServerGuard } ;
@@ -1471,33 +1471,28 @@ mod tests {
1471
1471
1472
1472
let catalog = RestCatalog :: new ( RestCatalogConfig :: builder ( ) . uri ( server. url ( ) ) . build ( ) ) ;
1473
1473
1474
+ let schema = Schema :: builder ( )
1475
+ . with_fields ( vec ! [
1476
+ NestedField :: optional( 1 , "foo" , Type :: Primitive ( PrimitiveType :: String ) ) . into( ) ,
1477
+ NestedField :: required( 2 , "bar" , Type :: Primitive ( PrimitiveType :: Int ) ) . into( ) ,
1478
+ NestedField :: optional( 3 , "baz" , Type :: Primitive ( PrimitiveType :: Boolean ) ) . into( ) ,
1479
+ ] )
1480
+ . with_schema_id ( 1 )
1481
+ . with_identifier_field_ids ( vec ! [ 2 ] )
1482
+ . build ( )
1483
+ . unwrap ( ) ;
1484
+
1485
+ let partition_spec = PartitionSpecBuilder :: new ( & schema)
1486
+ . add_partition_field ( "foo" , "id" , Transform :: Truncate ( 3 ) )
1487
+ . unwrap ( )
1488
+ . build ( )
1489
+ . unwrap ( ) ;
1490
+
1474
1491
let table_creation = TableCreation :: builder ( )
1475
1492
. name ( "test1" . to_string ( ) )
1476
- . schema (
1477
- Schema :: builder ( )
1478
- . with_fields ( vec ! [
1479
- NestedField :: optional( 1 , "foo" , Type :: Primitive ( PrimitiveType :: String ) )
1480
- . into( ) ,
1481
- NestedField :: required( 2 , "bar" , Type :: Primitive ( PrimitiveType :: Int ) ) . into( ) ,
1482
- NestedField :: optional( 3 , "baz" , Type :: Primitive ( PrimitiveType :: Boolean ) )
1483
- . into( ) ,
1484
- ] )
1485
- . with_schema_id ( 1 )
1486
- . with_identifier_field_ids ( vec ! [ 2 ] )
1487
- . build ( )
1488
- . unwrap ( ) ,
1489
- )
1493
+ . schema ( schema)
1490
1494
. properties ( HashMap :: from ( [ ( "owner" . to_string ( ) , "testx" . to_string ( ) ) ] ) )
1491
- . partition_spec (
1492
- UnboundPartitionSpec :: builder ( )
1493
- . add_partition_fields ( vec ! [ UnboundPartitionField :: builder( )
1494
- . source_id( 1 )
1495
- . transform( Transform :: Truncate ( 3 ) )
1496
- . name( "id" . to_string( ) )
1497
- . build( ) ] )
1498
- . unwrap ( )
1499
- . build ( ) ,
1500
- )
1495
+ . partition_spec ( partition_spec)
1501
1496
. sort_order (
1502
1497
SortOrder :: builder ( )
1503
1498
. with_sort_field (
0 commit comments