From 974c099ed88c0b0a102f76f0e91509594b241ac6 Mon Sep 17 00:00:00 2001 From: Aditya Nambiar Date: Thu, 19 Sep 2024 00:59:53 -0700 Subject: [PATCH] expr: Fix unary expressions --- fennel/CHANGELOG.md | 3 +++ fennel/expr/test_expr.py | 6 +++--- fennel/expr/visitor.py | 2 +- pyproject.toml | 2 +- 4 files changed, 8 insertions(+), 5 deletions(-) diff --git a/fennel/CHANGELOG.md b/fennel/CHANGELOG.md index 143f2013f..b7e3f7e32 100644 --- a/fennel/CHANGELOG.md +++ b/fennel/CHANGELOG.md @@ -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 diff --git a/fennel/expr/test_expr.py b/fennel/expr/test_expr.py index 478bd0ae3..be2d35555 100644 --- a/fennel/expr/test_expr.py +++ b/fennel/expr/test_expr.py @@ -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, ), diff --git a/fennel/expr/visitor.py b/fennel/expr/visitor.py index 6e7cf4c1e..8affab86f 100644 --- a/fennel/expr/visitor.py +++ b/fennel/expr/visitor.py @@ -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)" % ( diff --git a/pyproject.toml b/pyproject.toml index 9377b9893..74264934b 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -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 "] packages = [{ include = "fennel" }]