Skip to content

Commit d2097c9

Browse files
feedback OB
1 parent 36fc349 commit d2097c9

2 files changed

Lines changed: 2 additions & 34 deletions

File tree

diffly/_conditions.py

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33

44
import datetime as dt
55
from collections.abc import Mapping
6+
from typing import cast
67

78
import polars as pl
89
from polars.datatypes import DataType, DataTypeClass
@@ -206,12 +207,7 @@ def _compare_sequence_columns(
206207
n_elements = dtype_right.shape[0]
207208
has_same_length = col_left.list.len().eq(pl.lit(n_elements))
208209
else: # pl.List vs pl.List
209-
if max_list_length is None:
210-
raise ValueError(
211-
"max_list_length must be provided for List-vs-List comparisons "
212-
"in _compare_sequence_columns()."
213-
)
214-
n_elements = max_list_length
210+
n_elements = cast(int, max_list_length)
215211
has_same_length = col_left.list.len().eq_missing(col_right.list.len())
216212

217213
if n_elements == 0:

tests/test_conditions.py

Lines changed: 0 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -512,34 +512,6 @@ def test_condition_equal_columns_lists_only_inner() -> None:
512512
assert actual.to_list() == [True, False]
513513

514514

515-
def test_condition_equal_columns_two_lists_no_max_length() -> None:
516-
lhs = pl.DataFrame(
517-
{
518-
"pk": [1, 2],
519-
"a_left": [[1.0, 2.0], [3.0, 4.0]],
520-
},
521-
)
522-
rhs = pl.DataFrame(
523-
{
524-
"pk": [1, 2],
525-
"a_right": [[1.0, 2.0], [3.0, 4.0]],
526-
},
527-
)
528-
529-
with pytest.raises(
530-
ValueError,
531-
match="max_list_length must be provided for List-vs-List comparisons",
532-
):
533-
lhs.join(rhs, on="pk", maintain_order="left").select(
534-
condition_equal_columns(
535-
"a",
536-
dtype_left=lhs.schema["a_left"],
537-
dtype_right=rhs.schema["a_right"],
538-
max_list_length=None,
539-
)
540-
).to_series()
541-
542-
543515
@pytest.mark.parametrize(
544516
("dtype_left", "dtype_right", "can_compare_dtypes"),
545517
[

0 commit comments

Comments
 (0)