Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions vortex-python/python/vortex/polars_.py
Original file line number Diff line number Diff line change
Expand Up @@ -172,6 +172,9 @@ def _polars_to_vortex(expr: dict[str, Any]) -> ve.Expr:
if fn == "IsNotNull":
return ve.is_not_null(_inputs[0])

if fn == "IsNull":
return ve.is_null(_inputs[0])

if "IsIn" in fn:
fn = fn["IsIn"]
if fn["nulls_equal"]:
Expand Down
11 changes: 11 additions & 0 deletions vortex-python/test/test_polars_.py
Original file line number Diff line number Diff line change
Expand Up @@ -182,3 +182,14 @@ def test_polars_binary_literals(tmp_path):
actual = vx.open(str(path)).to_polars().filter(expr).collect()
assert_frame_equal(actual, expected_frame)
assert actual["id"].to_list() == [0]


def test_polars_is_null(tmp_path):
frame = pl.DataFrame({"id": [0, 1, 2], "x": [1, None, 3]})
expr = pl.col("x").is_null()
path = tmp_path / "is_null.vortex"
vx.io.write(vx.array(frame.to_arrow()), str(path))
expected_frame = frame.lazy().filter(expr).collect()
actual = vx.open(str(path)).to_polars().filter(expr).collect()
assert_frame_equal(actual, expected_frame)
assert actual["id"].to_list() == [1]
Loading