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
4 changes: 2 additions & 2 deletions pyiceberg/expressions/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -596,11 +596,11 @@ class SetPredicate(IcebergBaseModel, UnboundPredicate, ABC):
model_config = ConfigDict(arbitrary_types_allowed=True)

type: TypingLiteral["in", "not-in"] = Field(default="in")
literals: set[LiteralValue] = Field(alias="items")
literals: set[LiteralValue] = Field(alias="values")

def __init__(self, term: str | UnboundTerm, literals: Iterable[Any] | Iterable[LiteralValue]):
literal_set = _to_literal_set(literals)
super().__init__(term=_to_unbound_term(term), items=literal_set) # type: ignore
super().__init__(term=_to_unbound_term(term), values=literal_set) # type: ignore
object.__setattr__(self, "literals", literal_set)

def bind(self, schema: Schema, case_sensitive: bool = True) -> BoundSetPredicate:
Expand Down
4 changes: 2 additions & 2 deletions tests/expressions/test_expressions.py
Original file line number Diff line number Diff line change
Expand Up @@ -915,12 +915,12 @@ def test_not_in() -> None:

def test_serialize_in() -> None:
pred = In(term="foo", literals=[1, 2, 3])
assert pred.model_dump_json() == '{"term":"foo","type":"in","items":[1,2,3]}'
assert pred.model_dump_json() == '{"term":"foo","type":"in","values":[1,2,3]}'


def test_serialize_not_in() -> None:
pred = NotIn(term="foo", literals=[1, 2, 3])
assert pred.model_dump_json() == '{"term":"foo","type":"not-in","items":[1,2,3]}'
assert pred.model_dump_json() == '{"term":"foo","type":"not-in","values":[1,2,3]}'


def test_bound_equal_to(term: BoundReference) -> None:
Expand Down