Skip to content

Commit b2d9f06

Browse files
committed
debug duckdb avro issue
1 parent 4cac691 commit b2d9f06

File tree

1 file changed

+39
-0
lines changed

1 file changed

+39
-0
lines changed

tests/integration/test_writes/test_writes.py

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1201,6 +1201,45 @@ 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=IntegerType(), 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=[pa.Table.from_arrays([range(22)], schema=pa.schema([pa.field("😎", pa.int32(), nullable=False)]))],
1232+
)
1233+
1234+
assert len(tbl.scan().to_arrow()) == 22
1235+
1236+
con = tbl.scan().to_duckdb("table_test_debug")
1237+
result = con.query("SELECT * FROM table_test_debug").fetchall()
1238+
assert len(result) == 22
1239+
1240+
assert con.query("SHOW table_test_debug").fetchone() == ("😎", "INTEGER", "YES", None, None, None)
1241+
1242+
12041243
@pytest.mark.integration
12051244
@pytest.mark.parametrize("format_version", [1, 2])
12061245
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)