Skip to content

Commit 0de3f46

Browse files
gab23rgabriel
andauthored
fix: Default to non nullable column for array and object (#326)
Co-authored-by: gabriel <gabriel.g.robin@airbus.com>
1 parent 3bf52fc commit 0de3f46

File tree

4 files changed

+4
-4
lines changed

4 files changed

+4
-4
lines changed

dataframely/columns/array.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ def __init__(
3333
inner: Column,
3434
shape: int | tuple[int, ...],
3535
*,
36-
nullable: bool = True,
36+
nullable: bool = False,
3737
# polars doesn't yet support grouping by arrays,
3838
# see https://github.com/pola-rs/polars/issues/22574
3939
primary_key: Literal[False] = False,

dataframely/columns/object.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ class Object(Column):
2121
def __init__(
2222
self,
2323
*,
24-
nullable: bool = True,
24+
nullable: bool = False,
2525
primary_key: bool = False,
2626
check: Check | None = None,
2727
alias: str | None = None,

tests/columns/test_pyarrow.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ def test_equal_polars_schema_list(inner: Column) -> None:
9090
],
9191
)
9292
def test_equal_polars_schema_array(inner: Column, shape: int | tuple[int, ...]) -> None:
93-
schema = create_schema("test", {"a": dy.Array(inner, shape)})
93+
schema = create_schema("test", {"a": dy.Array(inner, shape, nullable=True)})
9494
actual = schema.to_pyarrow_schema()
9595
expected = schema.create_empty().to_arrow().schema
9696
assert actual == expected

tests/columns/test_sample.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -184,7 +184,7 @@ def test_sample_list(generator: Generator) -> None:
184184

185185

186186
def test_sample_array(generator: Generator) -> None:
187-
column = dy.Array(dy.Bool(nullable=True), (2, 3))
187+
column = dy.Array(dy.Bool(nullable=True), (2, 3), nullable=True)
188188
samples = sample_and_validate(column, generator, n=10_000)
189189
assert samples.is_null().any()
190190
assert set(samples.arr.len()) == {2, None}

0 commit comments

Comments
 (0)