Skip to content

Commit cbd297f

Browse files
committed
Use the spec that it was written with
1 parent b29d80e commit cbd297f

2 files changed

Lines changed: 16 additions & 8 deletions

File tree

tests/conftest.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2375,8 +2375,10 @@ def data_file(table_schema_simple: Schema, tmp_path: str) -> str:
23752375

23762376
@pytest.fixture
23772377
def example_task(data_file: str) -> FileScanTask:
2378+
datafile = DataFile.from_args(file_path=data_file, file_format=FileFormat.PARQUET, file_size_in_bytes=1925)
2379+
datafile.spec_id = 0
23782380
return FileScanTask(
2379-
data_file=DataFile.from_args(file_path=data_file, file_format=FileFormat.PARQUET, file_size_in_bytes=1925),
2381+
data_file=datafile,
23802382
)
23812383

23822384

tests/io/test_pyarrow.py

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -970,6 +970,10 @@ def file_map(schema_map: Schema, tmpdir: str) -> str:
970970
def project(
971971
schema: Schema, files: List[str], expr: Optional[BooleanExpression] = None, table_schema: Optional[Schema] = None
972972
) -> pa.Table:
973+
def _set_spec_id(datafile: DataFile) -> DataFile:
974+
datafile.spec_id = 0
975+
return datafile
976+
973977
return ArrowScan(
974978
table_metadata=TableMetadataV2(
975979
location="file://a/b/",
@@ -985,13 +989,15 @@ def project(
985989
).to_table(
986990
tasks=[
987991
FileScanTask(
988-
DataFile.from_args(
989-
content=DataFileContent.DATA,
990-
file_path=file,
991-
file_format=FileFormat.PARQUET,
992-
partition={},
993-
record_count=3,
994-
file_size_in_bytes=3,
992+
_set_spec_id(
993+
DataFile.from_args(
994+
content=DataFileContent.DATA,
995+
file_path=file,
996+
file_format=FileFormat.PARQUET,
997+
partition={},
998+
record_count=3,
999+
file_size_in_bytes=3,
1000+
)
9951001
)
9961002
)
9971003
for file in files

0 commit comments

Comments
 (0)