File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 315315 """
316316 )
317317
318+ # avro sanitization test
319+ spark .sql (
320+ f"""
321+ CREATE TABLE { catalog_name } .default.test_table_metadata_sanitized_character (
322+ name STRING NOT NULL,
323+ `π` STRING
324+ )
325+ USING ICEBERG
326+ PARTITIONED BY (`π`);
327+ """
328+ )
329+
330+ spark .sql (
331+ f"""
332+ INSERT INTO { catalog_name } .default.test_table_metadata_sanitized_character
333+ VALUES
334+ ('Foo', 'Cool Foo'),
335+ ('Bar', 'Cool Bar')
336+ """
337+ )
338+
318339 spark .sql (
319340 f"""
320341 CREATE TABLE { catalog_name } .default.test_table_add_column (
Original file line number Diff line number Diff line change @@ -760,6 +760,17 @@ def test_sanitize_character(catalog: Catalog) -> None:
760760 assert arrow_table .schema .names [0 ] == table_test_table_sanitized_character .schema ().fields [0 ].name
761761
762762
763+ @pytest .mark .integration
764+ @pytest .mark .parametrize ("catalog" , [pytest .lazy_fixture ("session_catalog_hive" ), pytest .lazy_fixture ("session_catalog" )])
765+ def test_metadata_sanitize_character (catalog : Catalog ) -> None :
766+ avro_sanitized_character_table = catalog .load_table ("default.test_table_metadata_sanitized_character" )
767+ arrow_table = avro_sanitized_character_table .scan ().to_arrow ()
768+ assert len (arrow_table .schema .names ) == 2
769+ assert len (avro_sanitized_character_table .inspect .files ()) == 2
770+ assert [field .name for field in avro_sanitized_character_table .schema ().fields ] == ["name" , "π" ]
771+ assert [field .name for field in avro_sanitized_character_table .spec ().fields ] == ["π" ]
772+
773+
763774@pytest .mark .integration
764775@pytest .mark .parametrize ("catalog" , [pytest .lazy_fixture ("session_catalog_hive" ), pytest .lazy_fixture ("session_catalog" )])
765776def test_null_list_and_map (catalog : Catalog ) -> None :
You canβt perform that action at this time.
0 commit comments