From 0e31b5dd5988f16f58b864630ae8e3dccf3fc7a4 Mon Sep 17 00:00:00 2001 From: Nitin Bansal Date: Fri, 23 Aug 2024 04:25:39 +0530 Subject: [PATCH] Fix proto for lookback (#534) fix proto for lookback --- fennel/CHANGELOG.md | 3 +++ fennel/dtypes/dtypes.py | 19 +++++++++++++------ fennel/gen/window_pb2.py | 20 ++++++++++---------- fennel/gen/window_pb2.pyi | 24 ++++++++++++++++++------ pyproject.toml | 2 +- 5 files changed, 45 insertions(+), 23 deletions(-) diff --git a/fennel/CHANGELOG.md b/fennel/CHANGELOG.md index d7d6f264e..967c49784 100644 --- a/fennel/CHANGELOG.md +++ b/fennel/CHANGELOG.md @@ -1,5 +1,8 @@ # Changelog +## [1.5.7] - 2024-08-21 +- Fix proto for lookback + ## [1.5.6] - 2024-08-20 - Add support for expression based extractors diff --git a/fennel/dtypes/dtypes.py b/fennel/dtypes/dtypes.py index 56d600524..5c27930e0 100644 --- a/fennel/dtypes/dtypes.py +++ b/fennel/dtypes/dtypes.py @@ -341,7 +341,7 @@ def signature(self) -> str: @dataclass class Tumbling: duration: str - lookback: Optional[str] = None + lookback: str = "0s" def __post_init__(self): """ @@ -364,8 +364,10 @@ def __post_init__(self): def to_proto(self) -> window_proto.Window: duration = duration_proto.Duration() duration.FromTimedelta(duration_to_timedelta(self.duration)) + lookback = duration_proto.Duration() + lookback.FromTimedelta(duration_to_timedelta(self.lookback)) return window_proto.Window( - tumbling=window_proto.Tumbling(duration=duration) + tumbling=window_proto.Tumbling(duration=duration, lookback=lookback) ) def signature(self) -> str: @@ -387,7 +389,7 @@ def lookback_total_seconds(self) -> int: class Hopping: duration: str stride: str - lookback: Optional[str] = None + lookback: str = "0s" def __post_init__(self): """ @@ -415,16 +417,21 @@ def __post_init__(self): def to_proto(self) -> window_proto.Window: stride = duration_proto.Duration() stride.FromTimedelta(duration_to_timedelta(self.stride)) - + lookback = duration_proto.Duration() + lookback.FromTimedelta(duration_to_timedelta(self.lookback)) if self.duration != "forever": duration = duration_proto.Duration() duration.FromTimedelta(duration_to_timedelta(self.duration)) return window_proto.Window( - hopping=window_proto.Hopping(duration=duration, stride=stride) + hopping=window_proto.Hopping( + duration=duration, stride=stride, lookback=lookback + ) ) else: return window_proto.Window( - forever_hopping=window_proto.ForeverHopping(stride=stride) + forever_hopping=window_proto.ForeverHopping( + stride=stride, lookback=lookback + ) ) def signature(self) -> str: diff --git a/fennel/gen/window_pb2.py b/fennel/gen/window_pb2.py index 046c14ab3..ac2bb8d59 100644 --- a/fennel/gen/window_pb2.py +++ b/fennel/gen/window_pb2.py @@ -16,7 +16,7 @@ import fennel.gen.schema_pb2 as schema__pb2 -DESCRIPTOR = _descriptor_pool.Default().AddSerializedFile(b'\n\x0cwindow.proto\x12\x13\x66\x65nnel.proto.window\x1a\x1egoogle/protobuf/duration.proto\x1a\x0cpycode.proto\x1a\x0cschema.proto\"\xca\x02\n\x06Window\x12/\n\x07sliding\x18\x01 \x01(\x0b\x32\x1c.fennel.proto.window.SlidingH\x00\x12/\n\x07\x66orever\x18\x02 \x01(\x0b\x32\x1c.fennel.proto.window.ForeverH\x00\x12/\n\x07session\x18\x03 \x01(\x0b\x32\x1c.fennel.proto.window.SessionH\x00\x12\x31\n\x08tumbling\x18\x04 \x01(\x0b\x32\x1d.fennel.proto.window.TumblingH\x00\x12/\n\x07hopping\x18\x05 \x01(\x0b\x32\x1c.fennel.proto.window.HoppingH\x00\x12>\n\x0f\x66orever_hopping\x18\x06 \x01(\x0b\x32#.fennel.proto.window.ForeverHoppingH\x00\x42\t\n\x07variant\"6\n\x07Sliding\x12+\n\x08\x64uration\x18\x01 \x01(\x0b\x32\x19.google.protobuf.Duration\"\t\n\x07\x46orever\"7\n\x08Tumbling\x12+\n\x08\x64uration\x18\x01 \x01(\x0b\x32\x19.google.protobuf.Duration\"a\n\x07Hopping\x12+\n\x08\x64uration\x18\x01 \x01(\x0b\x32\x19.google.protobuf.Duration\x12)\n\x06stride\x18\x02 \x01(\x0b\x32\x19.google.protobuf.Duration\";\n\x0e\x46oreverHopping\x12)\n\x06stride\x18\x01 \x01(\x0b\x32\x19.google.protobuf.Duration\"1\n\x07Session\x12&\n\x03gap\x18\x01 \x01(\x0b\x32\x19.google.protobuf.Duration\"\x7f\n\x07Summary\x12\x13\n\x0b\x63olumn_name\x18\x01 \x01(\t\x12\x32\n\x0boutput_type\x18\x02 \x01(\x0b\x32\x1d.fennel.proto.schema.DataType\x12+\n\x06pycode\x18\x03 \x01(\x0b\x32\x1b.fennel.proto.pycode.PyCodeb\x06proto3') +DESCRIPTOR = _descriptor_pool.Default().AddSerializedFile(b'\n\x0cwindow.proto\x12\x13\x66\x65nnel.proto.window\x1a\x1egoogle/protobuf/duration.proto\x1a\x0cpycode.proto\x1a\x0cschema.proto\"\xca\x02\n\x06Window\x12/\n\x07sliding\x18\x01 \x01(\x0b\x32\x1c.fennel.proto.window.SlidingH\x00\x12/\n\x07\x66orever\x18\x02 \x01(\x0b\x32\x1c.fennel.proto.window.ForeverH\x00\x12/\n\x07session\x18\x03 \x01(\x0b\x32\x1c.fennel.proto.window.SessionH\x00\x12\x31\n\x08tumbling\x18\x04 \x01(\x0b\x32\x1d.fennel.proto.window.TumblingH\x00\x12/\n\x07hopping\x18\x05 \x01(\x0b\x32\x1c.fennel.proto.window.HoppingH\x00\x12>\n\x0f\x66orever_hopping\x18\x06 \x01(\x0b\x32#.fennel.proto.window.ForeverHoppingH\x00\x42\t\n\x07variant\"6\n\x07Sliding\x12+\n\x08\x64uration\x18\x01 \x01(\x0b\x32\x19.google.protobuf.Duration\"\t\n\x07\x46orever\"d\n\x08Tumbling\x12+\n\x08\x64uration\x18\x01 \x01(\x0b\x32\x19.google.protobuf.Duration\x12+\n\x08lookback\x18\x02 \x01(\x0b\x32\x19.google.protobuf.Duration\"\x8e\x01\n\x07Hopping\x12+\n\x08\x64uration\x18\x01 \x01(\x0b\x32\x19.google.protobuf.Duration\x12)\n\x06stride\x18\x02 \x01(\x0b\x32\x19.google.protobuf.Duration\x12+\n\x08lookback\x18\x03 \x01(\x0b\x32\x19.google.protobuf.Duration\"h\n\x0e\x46oreverHopping\x12)\n\x06stride\x18\x01 \x01(\x0b\x32\x19.google.protobuf.Duration\x12+\n\x08lookback\x18\x02 \x01(\x0b\x32\x19.google.protobuf.Duration\"1\n\x07Session\x12&\n\x03gap\x18\x01 \x01(\x0b\x32\x19.google.protobuf.Duration\"\x7f\n\x07Summary\x12\x13\n\x0b\x63olumn_name\x18\x01 \x01(\t\x12\x32\n\x0boutput_type\x18\x02 \x01(\x0b\x32\x1d.fennel.proto.schema.DataType\x12+\n\x06pycode\x18\x03 \x01(\x0b\x32\x1b.fennel.proto.pycode.PyCodeb\x06proto3') _globals = globals() _builder.BuildMessageAndEnumDescriptors(DESCRIPTOR, _globals) @@ -30,13 +30,13 @@ _globals['_FOREVER']._serialized_start=486 _globals['_FOREVER']._serialized_end=495 _globals['_TUMBLING']._serialized_start=497 - _globals['_TUMBLING']._serialized_end=552 - _globals['_HOPPING']._serialized_start=554 - _globals['_HOPPING']._serialized_end=651 - _globals['_FOREVERHOPPING']._serialized_start=653 - _globals['_FOREVERHOPPING']._serialized_end=712 - _globals['_SESSION']._serialized_start=714 - _globals['_SESSION']._serialized_end=763 - _globals['_SUMMARY']._serialized_start=765 - _globals['_SUMMARY']._serialized_end=892 + _globals['_TUMBLING']._serialized_end=597 + _globals['_HOPPING']._serialized_start=600 + _globals['_HOPPING']._serialized_end=742 + _globals['_FOREVERHOPPING']._serialized_start=744 + _globals['_FOREVERHOPPING']._serialized_end=848 + _globals['_SESSION']._serialized_start=850 + _globals['_SESSION']._serialized_end=899 + _globals['_SUMMARY']._serialized_start=901 + _globals['_SUMMARY']._serialized_end=1028 # @@protoc_insertion_point(module_scope) diff --git a/fennel/gen/window_pb2.pyi b/fennel/gen/window_pb2.pyi index f15870647..37ac12d1f 100644 --- a/fennel/gen/window_pb2.pyi +++ b/fennel/gen/window_pb2.pyi @@ -91,15 +91,19 @@ class Tumbling(google.protobuf.message.Message): DESCRIPTOR: google.protobuf.descriptor.Descriptor DURATION_FIELD_NUMBER: builtins.int + LOOKBACK_FIELD_NUMBER: builtins.int @property def duration(self) -> google.protobuf.duration_pb2.Duration: ... + @property + def lookback(self) -> google.protobuf.duration_pb2.Duration: ... def __init__( self, *, duration: google.protobuf.duration_pb2.Duration | None = ..., + lookback: google.protobuf.duration_pb2.Duration | None = ..., ) -> None: ... - def HasField(self, field_name: typing_extensions.Literal["duration", b"duration"]) -> builtins.bool: ... - def ClearField(self, field_name: typing_extensions.Literal["duration", b"duration"]) -> None: ... + def HasField(self, field_name: typing_extensions.Literal["duration", b"duration", "lookback", b"lookback"]) -> builtins.bool: ... + def ClearField(self, field_name: typing_extensions.Literal["duration", b"duration", "lookback", b"lookback"]) -> None: ... global___Tumbling = Tumbling @@ -109,18 +113,22 @@ class Hopping(google.protobuf.message.Message): DURATION_FIELD_NUMBER: builtins.int STRIDE_FIELD_NUMBER: builtins.int + LOOKBACK_FIELD_NUMBER: builtins.int @property def duration(self) -> google.protobuf.duration_pb2.Duration: ... @property def stride(self) -> google.protobuf.duration_pb2.Duration: ... + @property + def lookback(self) -> google.protobuf.duration_pb2.Duration: ... def __init__( self, *, duration: google.protobuf.duration_pb2.Duration | None = ..., stride: google.protobuf.duration_pb2.Duration | None = ..., + lookback: google.protobuf.duration_pb2.Duration | None = ..., ) -> None: ... - def HasField(self, field_name: typing_extensions.Literal["duration", b"duration", "stride", b"stride"]) -> builtins.bool: ... - def ClearField(self, field_name: typing_extensions.Literal["duration", b"duration", "stride", b"stride"]) -> None: ... + def HasField(self, field_name: typing_extensions.Literal["duration", b"duration", "lookback", b"lookback", "stride", b"stride"]) -> builtins.bool: ... + def ClearField(self, field_name: typing_extensions.Literal["duration", b"duration", "lookback", b"lookback", "stride", b"stride"]) -> None: ... global___Hopping = Hopping @@ -129,15 +137,19 @@ class ForeverHopping(google.protobuf.message.Message): DESCRIPTOR: google.protobuf.descriptor.Descriptor STRIDE_FIELD_NUMBER: builtins.int + LOOKBACK_FIELD_NUMBER: builtins.int @property def stride(self) -> google.protobuf.duration_pb2.Duration: ... + @property + def lookback(self) -> google.protobuf.duration_pb2.Duration: ... def __init__( self, *, stride: google.protobuf.duration_pb2.Duration | None = ..., + lookback: google.protobuf.duration_pb2.Duration | None = ..., ) -> None: ... - def HasField(self, field_name: typing_extensions.Literal["stride", b"stride"]) -> builtins.bool: ... - def ClearField(self, field_name: typing_extensions.Literal["stride", b"stride"]) -> None: ... + def HasField(self, field_name: typing_extensions.Literal["lookback", b"lookback", "stride", b"stride"]) -> builtins.bool: ... + def ClearField(self, field_name: typing_extensions.Literal["lookback", b"lookback", "stride", b"stride"]) -> None: ... global___ForeverHopping = ForeverHopping diff --git a/pyproject.toml b/pyproject.toml index 4b7a5bd59..c0ae80419 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [tool.poetry] name = "fennel-ai" -version = "1.5.6" +version = "1.5.7" description = "The modern realtime feature engineering platform" authors = ["Fennel AI "] packages = [{ include = "fennel" }]