Skip to content

Commit 74de467

Browse files
updated
Signed-off-by: Francisco Javier Arceo <farceo@redhat.com>
1 parent 02ae40b commit 74de467

File tree

4 files changed

+22
-22
lines changed

4 files changed

+22
-22
lines changed

sdk/python/feast/feature_server.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -380,7 +380,6 @@ async def write_to_online_store(request: WriteToFeatureStoreRequest) -> None:
380380
feature_view_name=feature_view_name,
381381
df=df,
382382
allow_registry_cache=allow_registry_cache,
383-
transform=request.transform_on_write,
384383
)
385384

386385
@app.get("/health")

sdk/python/feast/feature_store.py

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1767,7 +1767,6 @@ def push(
17671767
fv.name,
17681768
df,
17691769
allow_registry_cache=allow_registry_cache,
1770-
transform=transform_on_write,
17711770
)
17721771
if to == PushMode.OFFLINE or to == PushMode.ONLINE_AND_OFFLINE:
17731772
self.write_to_offline_store(
@@ -2094,10 +2093,9 @@ def write_to_online_store(
20942093
"""
20952094

20962095
# Get feature view to enable schema-based transformation detection
2097-
registry = self._get_registry_and_project()[0]
20982096
feature_view = cast(
20992097
FeatureView,
2100-
registry.get_feature_view(
2098+
self._registry.get_feature_view(
21012099
feature_view_name, self.project, allow_cache=allow_registry_cache
21022100
),
21032101
)
@@ -2156,10 +2154,9 @@ async def write_to_online_store_async(
21562154
"""
21572155

21582156
# Get feature view to enable schema-based transformation detection
2159-
registry = self._get_registry_and_project()[0]
21602157
feature_view = cast(
21612158
FeatureView,
2162-
registry.get_feature_view(
2159+
self._registry.get_feature_view(
21632160
feature_view_name, self.project, allow_cache=allow_registry_cache
21642161
),
21652162
)

sdk/python/feast/schema_utils.py

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -93,14 +93,16 @@ def get_output_schema_columns(
9393
schema_columns.add(field.name)
9494

9595
# Add entity columns (present in both input and output)
96-
for entity in feature_view.entities:
97-
if hasattr(entity, "join_keys"):
98-
# Entity object
99-
schema_columns.update(entity.join_keys)
100-
elif isinstance(entity, str):
101-
# Entity name string - need to get entity object from somewhere
102-
# For now, we'll assume the entity name is the join key
103-
schema_columns.add(entity)
96+
# For OnDemandFeatureViews, we skip adding entity columns since they're not meaningful
97+
if not isinstance(feature_view, OnDemandFeatureView):
98+
for entity in feature_view.entities:
99+
if hasattr(entity, "join_keys"):
100+
# Entity object
101+
schema_columns.update(entity.join_keys)
102+
elif isinstance(entity, str):
103+
# Entity name string - filter out dummy entities
104+
if entity != "__dummy":
105+
schema_columns.add(entity)
104106

105107
return schema_columns
106108

sdk/python/tests/unit/test_schema_detection.py

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,7 @@ def test_get_input_schema_columns(self):
8484
"""Test getting input schema columns from FeatureView."""
8585
input_columns = get_input_schema_columns(self.feature_view)
8686
# Note: FileSource without explicit schema falls back to entity names + timestamp
87+
# Since entities are stored as strings, we use entity name rather than join keys
8788
expected_columns = {"driver", "event_timestamp"}
8889
self.assertEqual(input_columns, expected_columns)
8990

@@ -151,7 +152,7 @@ def test_should_apply_transformation_dataframe_input(self):
151152
# DataFrame with input schema
152153
input_df = pd.DataFrame(
153154
{
154-
"driver_id": [1, 2],
155+
"driver": [1, 2],
155156
"value": [5, 10],
156157
"event_timestamp": ["2023-01-01", "2023-01-02"],
157158
}
@@ -163,7 +164,7 @@ def test_should_apply_transformation_dataframe_input(self):
163164
)
164165

165166
# DataFrame with output schema
166-
output_df = pd.DataFrame({"driver_id": [1, 2], "doubled_value": [10, 20]})
167+
output_df = pd.DataFrame({"driver": [1, 2], "doubled_value": [10, 20]})
167168

168169
result = should_apply_transformation(self.feature_view, output_df)
169170
self.assertFalse(
@@ -175,7 +176,7 @@ def test_should_apply_transformation_subset_matching(self):
175176
"""Test detection with subset schema matching (superset data)."""
176177
# Data is superset of input schema (extra columns are ok)
177178
superset_input_data = {
178-
"driver_id": 1,
179+
"driver": 1,
179180
"value": 5,
180181
"event_timestamp": "2023-01-01",
181182
"extra_field": "extra_value",
@@ -189,28 +190,29 @@ def test_should_apply_transformation_subset_matching(self):
189190
def test_validate_transformation_compatibility(self):
190191
"""Test transformation compatibility validation."""
191192
# Valid input data
192-
input_data = {"driver_id": 1, "value": 5, "event_timestamp": "2023-01-01"}
193-
transformed_data = {"driver_id": 1, "doubled_value": 10}
193+
input_data = {"driver": 1, "value": 5, "event_timestamp": "2023-01-01"}
194+
transformed_data = {"driver": 1, "doubled_value": 10}
194195

195196
errors = validate_transformation_compatibility(
196197
self.feature_view, input_data, transformed_data
197198
)
198199
self.assertEqual(len(errors), 0, "Should have no errors for valid data")
199200

200201
# Invalid input data (missing required column)
201-
invalid_input_data = {"driver_id": 1} # Missing value and timestamp
202+
invalid_input_data = {"driver": 1} # Missing value and timestamp
202203

203204
errors = validate_transformation_compatibility(
204205
self.feature_view, invalid_input_data
205206
)
206207
self.assertGreater(
207208
len(errors), 0, "Should have errors for missing input columns"
208209
)
209-
self.assertIn("value", str(errors))
210+
# Only event_timestamp is required from the input schema (entity + timestamp)
211+
# 'value' is not part of the detected input schema for sources without explicit schema
210212
self.assertIn("event_timestamp", str(errors))
211213

212214
# Invalid transformed data (missing required output column)
213-
invalid_transformed_data = {"driver_id": 1} # Missing doubled_value
215+
invalid_transformed_data = {"driver": 1} # Missing doubled_value
214216

215217
errors = validate_transformation_compatibility(
216218
self.feature_view, input_data, invalid_transformed_data

0 commit comments

Comments
 (0)