@@ -344,7 +344,7 @@ def test_deleting_hdfs_file_not_found() -> None:
344344 assert "Cannot delete file, does not exist:" in str (exc_info .value )
345345
346346
347- def test_schema_to_pyarrow_schema (table_schema_nested : Schema ) -> None :
347+ def test_schema_to_pyarrow_schema_include_field_ids (table_schema_nested : Schema ) -> None :
348348 actual = schema_to_pyarrow (table_schema_nested )
349349 expected = """foo: string
350350 -- field metadata --
@@ -402,6 +402,30 @@ def test_schema_to_pyarrow_schema(table_schema_nested: Schema) -> None:
402402 assert repr (actual ) == expected
403403
404404
405+ def test_schema_to_pyarrow_schema_exclude_field_ids (table_schema_nested : Schema ) -> None :
406+ actual = schema_to_pyarrow (table_schema_nested , include_field_ids = False )
407+ expected = """foo: string
408+ bar: int32 not null
409+ baz: bool
410+ qux: list<element: string not null> not null
411+ child 0, element: string not null
412+ quux: map<string, map<string, int32>> not null
413+ child 0, entries: struct<key: string not null, value: map<string, int32> not null> not null
414+ child 0, key: string not null
415+ child 1, value: map<string, int32> not null
416+ child 0, entries: struct<key: string not null, value: int32 not null> not null
417+ child 0, key: string not null
418+ child 1, value: int32 not null
419+ location: list<element: struct<latitude: float, longitude: float> not null> not null
420+ child 0, element: struct<latitude: float, longitude: float> not null
421+ child 0, latitude: float
422+ child 1, longitude: float
423+ person: struct<name: string, age: int32 not null>
424+ child 0, name: string
425+ child 1, age: int32 not null"""
426+ assert repr (actual ) == expected
427+
428+
405429def test_fixed_type_to_pyarrow () -> None :
406430 length = 22
407431 iceberg_type = FixedType (length )
@@ -945,23 +969,13 @@ def test_projection_add_column(file_int: str) -> None:
945969 == """id: int32
946970list: list<element: int32>
947971 child 0, element: int32
948- -- field metadata --
949- PARQUET:field_id: '21'
950972map: map<int32, string>
951973 child 0, entries: struct<key: int32 not null, value: string> not null
952974 child 0, key: int32 not null
953- -- field metadata --
954- PARQUET:field_id: '31'
955975 child 1, value: string
956- -- field metadata --
957- PARQUET:field_id: '32'
958976location: struct<lat: double, lon: double>
959977 child 0, lat: double
960- -- field metadata --
961- PARQUET:field_id: '41'
962- child 1, lon: double
963- -- field metadata --
964- PARQUET:field_id: '42'"""
978+ child 1, lon: double"""
965979 )
966980
967981
@@ -1014,11 +1028,7 @@ def test_projection_add_column_struct(schema_int: Schema, file_int: str) -> None
10141028 == """id: map<int32, string>
10151029 child 0, entries: struct<key: int32 not null, value: string> not null
10161030 child 0, key: int32 not null
1017- -- field metadata --
1018- PARQUET:field_id: '3'
1019- child 1, value: string
1020- -- field metadata --
1021- PARQUET:field_id: '4'"""
1031+ child 1, value: string"""
10221032 )
10231033
10241034
@@ -1062,12 +1072,7 @@ def test_projection_concat_files(schema_int: Schema, file_int: str) -> None:
10621072def test_projection_filter (schema_int : Schema , file_int : str ) -> None :
10631073 result_table = project (schema_int , [file_int ], GreaterThan ("id" , 4 ))
10641074 assert len (result_table .columns [0 ]) == 0
1065- assert (
1066- repr (result_table .schema )
1067- == """id: int32
1068- -- field metadata --
1069- PARQUET:field_id: '1'"""
1070- )
1075+ assert repr (result_table .schema ) == """id: int32"""
10711076
10721077
10731078def test_projection_filter_renamed_column (file_int : str ) -> None :
@@ -1304,11 +1309,7 @@ def test_projection_nested_struct_different_parent_id(file_struct: str) -> None:
13041309 repr (result_table .schema )
13051310 == """location: struct<lat: double, long: double>
13061311 child 0, lat: double
1307- -- field metadata --
1308- PARQUET:field_id: '41'
1309- child 1, long: double
1310- -- field metadata --
1311- PARQUET:field_id: '42'"""
1312+ child 1, long: double"""
13121313 )
13131314
13141315
0 commit comments