38
38
write_manifest ,
39
39
write_manifest_list ,
40
40
)
41
- from pyiceberg .partitioning import UNPARTITIONED_PARTITION_SPEC , PartitionField , PartitionSpec
41
+ from pyiceberg .partitioning import UNPARTITIONED_PARTITION_SPEC , PartitionSpec
42
42
from pyiceberg .schema import Schema
43
43
from pyiceberg .table .snapshots import Operation , Snapshot , Summary
44
- from pyiceberg .transforms import IdentityTransform
45
44
from pyiceberg .typedef import Record , TableVersion
46
45
from pyiceberg .types import IntegerType , NestedField
47
46
@@ -363,6 +362,8 @@ def test_write_manifest(
363
362
generated_manifest_file_file_v1 : str ,
364
363
generated_manifest_file_file_v2 : str ,
365
364
format_version : TableVersion ,
365
+ test_schema : Schema ,
366
+ test_partition_spec : PartitionSpec ,
366
367
compression : AvroCompressionCodec ,
367
368
) -> None :
368
369
io = load_file_io ()
@@ -376,20 +377,12 @@ def test_write_manifest(
376
377
)
377
378
demo_manifest_file = snapshot .manifests (io )[0 ]
378
379
manifest_entries = demo_manifest_file .fetch_manifest_entry (io )
379
- test_schema = Schema (
380
- NestedField (1 , "VendorID" , IntegerType (), False ), NestedField (2 , "tpep_pickup_datetime" , IntegerType (), False )
381
- )
382
- test_spec = PartitionSpec (
383
- PartitionField (source_id = 1 , field_id = 1 , transform = IdentityTransform (), name = "VendorID" ),
384
- PartitionField (source_id = 2 , field_id = 2 , transform = IdentityTransform (), name = "tpep_pickup_datetime" ),
385
- spec_id = demo_manifest_file .partition_spec_id ,
386
- )
387
380
with TemporaryDirectory () as tmpdir :
388
381
tmp_avro_file = tmpdir + "/test_write_manifest.avro"
389
382
output = io .new_output (tmp_avro_file )
390
383
with write_manifest (
391
384
format_version = format_version ,
392
- spec = test_spec ,
385
+ spec = test_partition_spec ,
393
386
schema = test_schema ,
394
387
output_file = output ,
395
388
snapshot_id = 8744736658442914487 ,
@@ -404,7 +397,7 @@ def test_write_manifest(
404
397
405
398
expected_metadata = {
406
399
"schema" : test_schema .model_dump_json (),
407
- "partition-spec" : """[{"source-id":1,"field-id":1 ,"transform":"identity","name":"VendorID"},{"source-id":2,"field-id":2 ,"transform":"identity ","name":"tpep_pickup_datetime"}]""" ,
400
+ "partition-spec" : """[{"source-id":1,"field-id":1000 ,"transform":"identity","name":"VendorID"},{"source-id":2,"field-id":1001 ,"transform":"day ","name":"tpep_pickup_datetime"}]""" ,
408
401
"partition-spec-id" : str (demo_manifest_file .partition_spec_id ),
409
402
"format-version" : str (format_version ),
410
403
}
0 commit comments