Skip to content

Commit a735bfb

Browse files
Use explicit identity functions instead of lambda for better type safety
Co-authored-by: franciscojavierarceo <4163062+franciscojavierarceo@users.noreply.github.com>
1 parent 79d6744 commit a735bfb

File tree

2 files changed

+10
-2
lines changed

2 files changed

+10
-2
lines changed

sdk/python/feast/transformation/pandas_transformation.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -152,8 +152,12 @@ def from_proto(
152152
):
153153
if skip_udf:
154154
# Return a dummy transformation when skipping UDF deserialization
155+
# Identity function that preserves DataFrame structure
156+
def identity_udf(df: pd.DataFrame) -> pd.DataFrame:
157+
return df
158+
155159
return PandasTransformation(
156-
udf=lambda x: x, # Identity function as placeholder
160+
udf=identity_udf,
157161
udf_string=user_defined_function_proto.body_text,
158162
)
159163
return PandasTransformation(

sdk/python/feast/transformation/python_transformation.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -170,8 +170,12 @@ def from_proto(
170170
):
171171
if skip_udf:
172172
# Return a dummy transformation when skipping UDF deserialization
173+
# Identity function that preserves dictionary structure
174+
def identity_udf(features_dict: Dict[str, Any]) -> Dict[str, Any]:
175+
return features_dict
176+
173177
return PythonTransformation(
174-
udf=lambda x: x, # Identity function as placeholder
178+
udf=identity_udf,
175179
udf_string=user_defined_function_proto.body_text,
176180
)
177181
return PythonTransformation(

0 commit comments

Comments
 (0)