Skip to content

Commit

Permalink
expr: add print visitor to few more expressions
Browse files Browse the repository at this point in the history
  • Loading branch information
nikhilgarg28 committed Nov 14, 2024
1 parent 4eb02be commit ead2748
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 1 deletion.
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.55] - 2024-11-14
- Add print visitor for couple missing string operations

## [1.5.54] - 2024-11-12
- Add backfill parameter to commit operation

Expand Down
12 changes: 12 additions & 0 deletions fennel/expr/visitor.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,11 +39,15 @@
Floor,
StringNoop,
StringParse,
StringJsonExtract,
StrLen,
Lower,
Upper,
StringStrpTime,
StrContains,
StrStartsWith,
StrEndsWith,
StringSplit,
DictContains,
Concat,
DictGet,
Expand Down Expand Up @@ -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)

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.54"
version = "1.5.55"
description = "The modern realtime feature engineering platform"
authors = ["Fennel AI <[email protected]>"]
packages = [{ include = "fennel" }]
Expand Down

0 comments on commit ead2748

Please sign in to comment.