Skip to content

Commit 1dc1c01

Browse files
committed
Add DuckDB integration test
1 parent c0de522 commit 1dc1c01

File tree

1 file changed

+43
-0
lines changed

1 file changed

+43
-0
lines changed

tests/integration/test_writes/test_writes.py

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1201,6 +1201,49 @@ def test_sanitize_character_partitioned(catalog: Catalog) -> None:
12011201
assert len(tbl.scan().to_arrow()) == 22
12021202

12031203

1204+
@pytest.mark.integration
1205+
@pytest.mark.parametrize("catalog", [pytest.lazy_fixture("session_catalog")])
1206+
def test_sanitize_character_partitioned_avro_bug(catalog: Catalog) -> None:
1207+
table_name = "default.test_table_partitioned_sanitized_character_avro"
1208+
try:
1209+
catalog.drop_table(table_name)
1210+
except NoSuchTableError:
1211+
pass
1212+
1213+
schema = Schema(
1214+
NestedField(id=1, name="😎", field_type=StringType(), required=False),
1215+
)
1216+
1217+
partition_spec = PartitionSpec(
1218+
PartitionField(
1219+
source_id=1,
1220+
field_id=1001,
1221+
transform=IdentityTransform(),
1222+
name="😎",
1223+
)
1224+
)
1225+
1226+
tbl = _create_table(
1227+
session_catalog=catalog,
1228+
identifier=table_name,
1229+
schema=schema,
1230+
partition_spec=partition_spec,
1231+
data=[
1232+
pa.Table.from_arrays(
1233+
[pa.array([str(i) for i in range(22)])], schema=pa.schema([pa.field("😎", pa.string(), nullable=False)])
1234+
)
1235+
],
1236+
)
1237+
1238+
assert len(tbl.scan().to_arrow()) == 22
1239+
1240+
con = tbl.scan().to_duckdb("table_test_debug")
1241+
result = con.query("SELECT * FROM table_test_debug").fetchall()
1242+
assert len(result) == 22
1243+
1244+
assert con.query("SHOW table_test_debug").fetchone() == ("😎", "VARCHAR", "YES", None, None, None)
1245+
1246+
12041247
@pytest.mark.integration
12051248
@pytest.mark.parametrize("format_version", [1, 2])
12061249
def test_table_write_subset_of_schema(session_catalog: Catalog, arrow_table_with_null: pa.Table, format_version: int) -> None:

0 commit comments

Comments
 (0)