Skip to content

Commit

Permalink
expr: Fix unary expressions (#564)
Browse files Browse the repository at this point in the history
  • Loading branch information
aditya-nambiar authored Sep 19, 2024
1 parent f34eb61 commit d8af2f6
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 5 deletions.
3 changes: 3 additions & 0 deletions fennel/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
# Changelog

## [1.5.25] - 2024-09-24
- Fix unary operator expressions

## [1.5.24] - 2024-09-18
- Add support for aggregation on optional dtype columns

Expand Down
6 changes: 3 additions & 3 deletions fennel/expr/test_expr.py
Original file line number Diff line number Diff line change
Expand Up @@ -769,12 +769,12 @@ def test_list():
),
# List contains
ExprTestCase(
expr=(col("a").list.contains(3)),
expr=(~col("a").list.contains(3)),
df=pd.DataFrame({"a": [[1, 2, 3], [4, 5, 6], [7, 8, 9]]}),
schema={"a": List[int]},
display="CONTAINS(col('a'), 3)",
display="~(CONTAINS(col('a'), 3))",
refs={"a"},
eval_result=[True, False, False],
eval_result=[False, True, True],
expected_dtype=bool,
proto_json=None,
),
Expand Down
2 changes: 1 addition & 1 deletion fennel/expr/visitor.py
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,7 @@ def visitRef(self, obj):
return str(obj)

def visitUnary(self, obj):
return "%s(%s)" % (obj.op, self.visit(obj.expr))
return "%s(%s)" % (obj.op, self.visit(obj.operand))

def visitBinary(self, obj):
return "(%s %s %s)" % (
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[tool.poetry]
name = "fennel-ai"
version = "1.5.24"
version = "1.5.25"
description = "The modern realtime feature engineering platform"
authors = ["Fennel AI <[email protected]>"]
packages = [{ include = "fennel" }]
Expand Down

0 comments on commit d8af2f6

Please sign in to comment.