From ead2748f2985cd8021934a27e8c49ed726652512 Mon Sep 17 00:00:00 2001 From: Nikhil Garg Date: Thu, 14 Nov 2024 09:09:53 -0800 Subject: [PATCH] expr: add print visitor to few more expressions --- fennel/CHANGELOG.md | 3 +++ fennel/expr/visitor.py | 12 ++++++++++++ pyproject.toml | 2 +- 3 files changed, 16 insertions(+), 1 deletion(-) diff --git a/fennel/CHANGELOG.md b/fennel/CHANGELOG.md index 249e6626..f897e44f 100644 --- a/fennel/CHANGELOG.md +++ b/fennel/CHANGELOG.md @@ -1,5 +1,8 @@ # Changelog +## [1.5.55] - 2024-11-14 +- Add print visitor for couple missing string operations + ## [1.5.54] - 2024-11-12 - Add backfill parameter to commit operation diff --git a/fennel/expr/visitor.py b/fennel/expr/visitor.py index b82ee964..dec1f7f4 100644 --- a/fennel/expr/visitor.py +++ b/fennel/expr/visitor.py @@ -39,11 +39,15 @@ Floor, StringNoop, StringParse, + StringJsonExtract, StrLen, Lower, Upper, StringStrpTime, StrContains, + StrStartsWith, + StrEndsWith, + StringSplit, DictContains, Concat, DictGet, @@ -301,6 +305,14 @@ def visitString(self, obj): return f"STRPTIME({self.visit(obj.operand)}, {obj.op.format})" elif isinstance(obj.op, StringParse): return f"PARSE({self.visit(obj.operand)}, {obj.op.dtype})" + elif isinstance(obj.op, StrStartsWith): + return f"STARTSWITH({self.visit(obj.operand)}, {self.visit(obj.op.item)})" + elif isinstance(obj.op, StrEndsWith): + return f"ENDSWITH({self.visit(obj.operand)}, {self.visit(obj.op.item)})" + elif isinstance(obj.op, StringJsonExtract): + return f"JSON_EXTRACT({self.visit(obj.operand)}, {obj.op.path})" + elif isinstance(obj.op, StringSplit): + return f"SPLIT({self.visit(obj.operand)}, {obj.op.sep})" else: raise InvalidExprException("invalid string operation: %s" % obj.op) diff --git a/pyproject.toml b/pyproject.toml index 0e43f12d..a09073a9 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [tool.poetry] name = "fennel-ai" -version = "1.5.54" +version = "1.5.55" description = "The modern realtime feature engineering platform" authors = ["Fennel AI "] packages = [{ include = "fennel" }]