Skip to content

Commit 974e2e3

Browse files
committed
Avro: Fix tests and add missing content header
While working on #2004 I've noticed some small discrepancies that I think would be good to address in a separate PR.
1 parent cdc8d85 commit 974e2e3

File tree

1 file changed

+4
-9
lines changed

1 file changed

+4
-9
lines changed

tests/utils/test_manifest.py

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -38,10 +38,9 @@
3838
write_manifest,
3939
write_manifest_list,
4040
)
41-
from pyiceberg.partitioning import UNPARTITIONED_PARTITION_SPEC, PartitionField, PartitionSpec
41+
from pyiceberg.partitioning import UNPARTITIONED_PARTITION_SPEC, PartitionSpec
4242
from pyiceberg.schema import Schema
4343
from pyiceberg.table.snapshots import Operation, Snapshot, Summary
44-
from pyiceberg.transforms import IdentityTransform
4544
from pyiceberg.typedef import Record, TableVersion
4645
from pyiceberg.types import IntegerType, NestedField
4746

@@ -364,6 +363,7 @@ def test_write_manifest(
364363
generated_manifest_file_file_v2: str,
365364
format_version: TableVersion,
366365
test_schema: Schema,
366+
test_partition_spec: PartitionSpec,
367367
compression: AvroCompressionCodec,
368368
) -> None:
369369
io = load_file_io()
@@ -377,17 +377,12 @@ def test_write_manifest(
377377
)
378378
demo_manifest_file = snapshot.manifests(io)[0]
379379
manifest_entries = demo_manifest_file.fetch_manifest_entry(io)
380-
test_spec = PartitionSpec(
381-
PartitionField(source_id=1, field_id=1, transform=IdentityTransform(), name="VendorID"),
382-
PartitionField(source_id=2, field_id=2, transform=IdentityTransform(), name="tpep_pickup_datetime"),
383-
spec_id=demo_manifest_file.partition_spec_id,
384-
)
385380
with TemporaryDirectory() as tmpdir:
386381
tmp_avro_file = tmpdir + "/test_write_manifest.avro"
387382
output = io.new_output(tmp_avro_file)
388383
with write_manifest(
389384
format_version=format_version,
390-
spec=test_spec,
385+
spec=test_partition_spec,
391386
schema=test_schema,
392387
output_file=output,
393388
snapshot_id=8744736658442914487,
@@ -402,7 +397,7 @@ def test_write_manifest(
402397

403398
expected_metadata = {
404399
"schema": test_schema.model_dump_json(),
405-
"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"}]""",
406401
"partition-spec-id": str(demo_manifest_file.partition_spec_id),
407402
"format-version": str(format_version),
408403
}

0 commit comments

Comments
 (0)