Skip to content

Commit c95df72

Browse files
committed
Deprecate the input parameter for FeatureViews
Signed-off-by: Felix Wang <wangfelix98@gmail.com>
1 parent 54bbe5f commit c95df72

4 files changed

Lines changed: 17 additions & 31 deletions

File tree

‎sdk/python/feast/feature_view.py‎

Lines changed: 10 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -51,9 +51,7 @@ class FeatureView:
5151
ttl: The amount of time this group of features lives. A ttl of 0 indicates that
5252
this group of features lives forever. Note that large ttl's or a ttl of 0
5353
can result in extremely computationally intensive queries.
54-
input: The source of data where this group of features is stored.
55-
batch_source (optional): The batch source of data where this group of features
56-
is stored.
54+
batch_source: The batch source of data where this group of features is stored.
5755
stream_source (optional): The stream source of data where this group of features
5856
is stored.
5957
features (optional): The set of features defined as part of this FeatureView.
@@ -67,7 +65,6 @@ class FeatureView:
6765
tags: Optional[Dict[str, str]]
6866
ttl: timedelta
6967
online: bool
70-
input: DataSource
7168
batch_source: DataSource
7269
stream_source: Optional[DataSource] = None
7370
created_timestamp: Optional[datetime] = None
@@ -80,8 +77,7 @@ def __init__(
8077
name: str,
8178
entities: List[str],
8279
ttl: Union[Duration, timedelta],
83-
input: Optional[DataSource] = None,
84-
batch_source: Optional[DataSource] = None,
80+
batch_source: DataSource,
8581
stream_source: Optional[DataSource] = None,
8682
features: Optional[List[Feature]] = None,
8783
tags: Optional[Dict[str, str]] = None,
@@ -93,26 +89,17 @@ def __init__(
9389
Raises:
9490
ValueError: A field mapping conflicts with an Entity or a Feature.
9591
"""
96-
if input is not None:
97-
warnings.warn(
98-
(
99-
"The argument 'input' is being deprecated. Please use 'batch_source' "
100-
"instead. Feast 0.13 and onwards will not support the argument 'input'."
101-
),
102-
DeprecationWarning,
103-
)
104-
105-
_input = input or batch_source
106-
assert _input is not None
107-
10892
_features = features or []
10993

11094
cols = [entity for entity in entities] + [feat.name for feat in _features]
11195
for col in cols:
112-
if _input.field_mapping is not None and col in _input.field_mapping.keys():
96+
if (
97+
batch_source.field_mapping is not None
98+
and col in batch_source.field_mapping.keys()
99+
):
113100
raise ValueError(
114-
f"The field {col} is mapped to {_input.field_mapping[col]} for this data source. "
115-
f"Please either remove this field mapping or use {_input.field_mapping[col]} as the "
101+
f"The field {col} is mapped to {batch_source.field_mapping[col]} for this data source. "
102+
f"Please either remove this field mapping or use {batch_source.field_mapping[col]} as the "
116103
f"Entity or Feature name."
117104
)
118105

@@ -127,8 +114,7 @@ def __init__(
127114
self.ttl = ttl
128115

129116
self.online = online
130-
self.input = _input
131-
self.batch_source = _input
117+
self.batch_source = batch_source
132118
self.stream_source = stream_source
133119

134120
self.materialization_intervals = []
@@ -311,7 +297,7 @@ def most_recent_end_time(self) -> Optional[datetime]:
311297

312298
def infer_features_from_batch_source(self, config: RepoConfig):
313299
"""
314-
Infers the set of features associated to this feature view from the input source.
300+
Infers the set of features associated to this feature view from the batch source.
315301
316302
Args:
317303
config: Configuration object used to configure the feature store.

‎sdk/python/feast/infra/offline_stores/offline_utils.py‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ def get_feature_view_query_context(
105105
join_keys = []
106106
entity_selections = []
107107
reverse_field_mapping = {
108-
v: k for k, v in feature_view.input.field_mapping.items()
108+
v: k for k, v in feature_view.batch_source.field_mapping.items()
109109
}
110110
for entity_name in feature_view.entities:
111111
entity = registry.get_entity(entity_name, project)
@@ -120,8 +120,8 @@ def get_feature_view_query_context(
120120
else:
121121
ttl_seconds = 0
122122

123-
event_timestamp_column = feature_view.input.event_timestamp_column
124-
created_timestamp_column = feature_view.input.created_timestamp_column
123+
event_timestamp_column = feature_view.batch_source.event_timestamp_column
124+
created_timestamp_column = feature_view.batch_source.created_timestamp_column
125125

126126
context = FeatureViewQueryContext(
127127
name=feature_view.name,
@@ -135,7 +135,7 @@ def get_feature_view_query_context(
135135
created_timestamp_column, created_timestamp_column
136136
),
137137
# TODO: Make created column optional and not hardcoded
138-
table_subquery=feature_view.input.get_table_query_string(),
138+
table_subquery=feature_view.batch_source.get_table_query_string(),
139139
entity_selections=entity_selections,
140140
)
141141
query_context.append(context)

‎sdk/python/tests/example_repos/example_feature_repo_with_duplicated_featureview_names.py‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
name="driver_hourly_stats", # Intentionally use the same FeatureView name
1111
entities=["driver_id"],
1212
online=False,
13-
input=driver_hourly_stats,
13+
batch_source=driver_hourly_stats,
1414
ttl=Duration(seconds=10),
1515
tags={},
1616
)
@@ -19,7 +19,7 @@
1919
name="driver_hourly_stats", # Intentionally use the same FeatureView name
2020
entities=["driver_id"],
2121
online=False,
22-
input=driver_hourly_stats,
22+
batch_source=driver_hourly_stats,
2323
ttl=Duration(seconds=10),
2424
tags={},
2525
)

‎sdk/python/tests/integration/feature_repos/universal/feature_views.py‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,5 +10,5 @@ def correctness_feature_view(data_source: DataSource) -> FeatureView:
1010
entities=["driver"],
1111
features=[Feature("value", ValueType.FLOAT)],
1212
ttl=timedelta(days=5),
13-
input=data_source,
13+
batch_source=data_source,
1414
)

0 commit comments

Comments
 (0)