Skip to content

Commit 0ca3bf0

Browse files
authored
fix: ignore nullability in compare_schemas (#36)
## What's Changed Ignore nullability when comparing schema fields.
1 parent af6260d commit 0ca3bf0

2 files changed

Lines changed: 15 additions & 1 deletion

File tree

adbc_drivers_validation/compare.py

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,14 @@ def make_nullable(value: T) -> T:
5959
)
6060
)
6161
else:
62-
fields.append(field)
62+
fields.append(
63+
pyarrow.field(
64+
field.name,
65+
field.type,
66+
nullable=True,
67+
metadata=field.metadata,
68+
)
69+
)
6370
return pyarrow.schema(fields)
6471
case pyarrow.Table():
6572
schema = make_nullable(value.schema)

tests/test_compare.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,13 @@ def test_compare_fields():
5858
compare.compare_fields(f1, f6)
5959

6060

61+
def test_compare_schemas_nullability():
62+
# Should ignore nullability
63+
s1 = pyarrow.schema([pyarrow.field("a", pyarrow.int32(), nullable=True)])
64+
s2 = pyarrow.schema([pyarrow.field("a", pyarrow.int32(), nullable=False)])
65+
compare.compare_schemas(s1, s2)
66+
67+
6168
@pytest.mark.parametrize(
6269
"value, expected",
6370
[

0 commit comments

Comments
 (0)