Skip to content

Commit 2184209

Browse files
committed
add partition by 😎 test
1 parent 904c0b7 commit 2184209

2 files changed

Lines changed: 32 additions & 0 deletions

File tree

β€Ždev/provision.pyβ€Ž

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -315,6 +315,27 @@
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 (

β€Žtests/integration/test_reads.pyβ€Ž

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff 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")])
765776
def test_null_list_and_map(catalog: Catalog) -> None:

0 commit comments

Comments
Β (0)