Skip to content

Commit 4e678f9

Browse files
authoredSep 25, 2024
[FSTORE-1411][APPEND] On-Demand Transformations (#340)
* using deep copy to copy feature group object instead of from_response * reverting deep copy change and using to_dict instead * using get to check if the attributes present in response dict
1 parent 447d947 commit 4e678f9

File tree

4 files changed

+9
-7
lines changed

4 files changed

+9
-7
lines changed
 

‎python/hsfs/core/feature_group_engine.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -259,7 +259,7 @@ def sql(self, query, feature_store_name, dataframe_type, online, read_options):
259259
read_options,
260260
)
261261

262-
def _update_features_metadata(self, feature_group, features):
262+
def _update_features_metadata(self, feature_group: fg.FeatureGroup, features):
263263
# perform changes on copy in case the update fails, so we don't leave
264264
# the user object in corrupted state
265265
copy_feature_group = fg.FeatureGroup.from_response_json(feature_group.to_dict())

‎python/hsfs/feature_group.py

+3-1
Original file line numberDiff line numberDiff line change
@@ -3554,7 +3554,9 @@ def to_dict(self) -> Dict[str, Any]:
35543554
"topicName": self.topic_name,
35553555
"notificationTopicName": self.notification_topic_name,
35563556
"deprecated": self.deprecated,
3557-
"transformationFunctions": self._transformation_functions,
3557+
"transformationFunctions": [
3558+
tf.to_dict() for tf in self._transformation_functions
3559+
],
35583560
}
35593561
if self._online_config:
35603562
fg_meta_dict["onlineConfig"] = self._online_config.to_dict()

‎python/hsfs/hopsworks_udf.py

+4-4
Original file line numberDiff line numberDiff line change
@@ -315,7 +315,7 @@ def _extract_source_code(udf_function: Callable) -> str:
315315
except FileNotFoundError:
316316
module_imports = [""]
317317
warnings.warn(
318-
"Cannot extract imported dependencies for the function module. Please make sure to import all dependencies for the UDF inside the function.",
318+
"Cannot extract imported dependencies for the UDF from the module in which it is defined. Please make sure to import all dependencies for the UDF inside the function.",
319319
stacklevel=2,
320320
)
321321

@@ -657,7 +657,7 @@ def from_response_json(
657657
dropped_feature.strip()
658658
for dropped_feature in json_decamelized["dropped_argument_names"]
659659
]
660-
if "dropped_argument_names" in json_decamelized
660+
if json_decamelized.get("dropped_argument_names", None)
661661
else None
662662
)
663663
transformation_function_argument_names = (
@@ -667,15 +667,15 @@ def from_response_json(
667667
"transformation_function_argument_names"
668668
]
669669
]
670-
if "transformation_function_argument_names" in json_decamelized
670+
if json_decamelized.get("transformation_function_argument_names", None)
671671
else None
672672
)
673673
statistics_features = (
674674
[
675675
feature.strip()
676676
for feature in json_decamelized["statistics_argument_names"]
677677
]
678-
if "statistics_argument_names" in json_decamelized
678+
if json_decamelized.get("statistics_argument_names", None)
679679
else None
680680
)
681681

‎python/hsfs/transformation_function.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -227,7 +227,7 @@ def to_dict(self) -> Dict[str, Any]:
227227
"id": self._id,
228228
"version": self._version,
229229
"featurestoreId": self._featurestore_id,
230-
"hopsworksUdf": self._hopsworks_udf,
230+
"hopsworksUdf": self._hopsworks_udf.to_dict(),
231231
}
232232

233233
def _get_output_column_names(self) -> str:

0 commit comments

Comments
 (0)
Failed to load comments.