Skip to content

Commit 0a624ec

Browse files
author
hao-xu5
committed
add aggregation in OnDemandFeatureView
1 parent eb51f00 commit 0a624ec

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

sdk/python/feast/on_demand_feature_view.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
import pyarrow
99
from typeguard import typechecked
1010

11+
from feast.aggregation import Aggregation
1112
from feast.base_feature_view import BaseFeatureView
1213
from feast.data_source import RequestSource
1314
from feast.entity import Entity
@@ -76,6 +77,7 @@ class OnDemandFeatureView(BaseFeatureView):
7677
singleton: bool
7778
udf: Optional[FunctionType]
7879
udf_string: Optional[str]
80+
aggregations: List[Aggregation]
7981

8082
def __init__( # noqa: C901
8183
self,
@@ -93,6 +95,7 @@ def __init__( # noqa: C901
9395
owner: str = "",
9496
write_to_online_store: bool = False,
9597
singleton: bool = False,
98+
aggregations: Optional[List[Aggregation]] = None,
9699
):
97100
"""
98101
Creates an OnDemandFeatureView object.
@@ -118,6 +121,7 @@ def __init__( # noqa: C901
118121
the online store for faster retrieval.
119122
singleton (optional): A boolean that indicates whether the transformation is executed on a singleton
120123
(only applicable when mode="python").
124+
aggregations (optional): List of aggregations to apply before transformation.
121125
"""
122126
super().__init__(
123127
name=name,
@@ -187,6 +191,7 @@ def __init__( # noqa: C901
187191
self.singleton = singleton
188192
if self.singleton and self.mode != "python":
189193
raise ValueError("Singleton is only supported for Python mode.")
194+
self.aggregations = aggregations or []
190195

191196
def get_feature_transformation(self) -> Transformation:
192197
if not self.udf:
@@ -251,6 +256,7 @@ def __eq__(self, other):
251256
or self.write_to_online_store != other.write_to_online_store
252257
or sorted(self.entity_columns) != sorted(other.entity_columns)
253258
or self.singleton != other.singleton
259+
or self.aggregations != other.aggregations
254260
):
255261
return False
256262

0 commit comments

Comments
 (0)