@@ -500,9 +500,9 @@ def _group_feature_refs(
500500 # on demand view to on demand view proto
501501 on_demand_view_index : Dict [str , "OnDemandFeatureView" ] = {}
502502 for view in all_on_demand_feature_views :
503- if view .projection and not getattr (view , ' write_to_online_store' , True ):
503+ if view .projection and not getattr (view , " write_to_online_store" , True ):
504504 on_demand_view_index [view .projection .name_to_use ()] = view
505- elif view .projection and getattr (view , ' write_to_online_store' , True ):
505+ elif view .projection and getattr (view , " write_to_online_store" , True ):
506506 # we insert the ODFV view to FVs for ones that are written to the online store
507507 view_index [view .projection .name_to_use ()] = view
508508
@@ -690,16 +690,17 @@ def _augment_response_with_on_demand_transforms(
690690 # For unified FeatureViews with transformations, always execute transforms
691691 # For OnDemandFeatureViews, check write_to_online_store setting
692692 should_transform = (
693- hasattr (odfv , 'feature_transformation' ) and odfv .feature_transformation is not None
694- ) or not getattr (odfv , 'write_to_online_store' , True )
693+ hasattr (odfv , "feature_transformation" )
694+ and odfv .feature_transformation is not None
695+ ) or not getattr (odfv , "write_to_online_store" , True )
695696
696697 if should_transform :
697698 # Apply aggregations if configured.
698- aggregations = getattr (odfv , ' aggregations' , [])
699- mode_attr = getattr (odfv , ' mode' , ' pandas' )
699+ aggregations = getattr (odfv , " aggregations" , [])
700+ mode_attr = getattr (odfv , " mode" , " pandas" )
700701 # Handle TransformationMode enum values
701- mode = mode_attr .value if hasattr (mode_attr , ' value' ) else mode_attr
702- entities = getattr (odfv , ' entities' , [])
702+ mode = mode_attr .value if hasattr (mode_attr , " value" ) else mode_attr
703+ entities = getattr (odfv , " entities" , [])
703704 if aggregations :
704705 if mode == "python" :
705706 if initial_response_dict is None :
@@ -727,23 +728,34 @@ def _augment_response_with_on_demand_transforms(
727728 if initial_response_dict is None :
728729 initial_response_dict = initial_response .to_dict ()
729730 # Use feature_transformation for unified FeatureViews
730- if hasattr (odfv , 'feature_transformation' ) and odfv .feature_transformation :
731- transformed_features_dict = odfv .feature_transformation .udf (initial_response_dict )
731+ if (
732+ hasattr (odfv , "feature_transformation" )
733+ and odfv .feature_transformation
734+ ):
735+ transformed_features_dict = odfv .feature_transformation .udf (
736+ initial_response_dict
737+ )
732738 else :
733739 # Fallback to OnDemandFeatureView method
734- transformed_features_dict : Dict [str , List [Any ]] = odfv . transform_dict (
735- initial_response_dict
740+ transformed_features_dict : Dict [str , List [Any ]] = (
741+ odfv . transform_dict ( initial_response_dict )
736742 )
737743 elif mode in {"pandas" , "substrait" }:
738744 if initial_response_arrow is None :
739745 initial_response_arrow = initial_response .to_arrow ()
740746 # Use feature_transformation for unified FeatureViews
741- if hasattr (odfv , 'feature_transformation' ) and odfv .feature_transformation :
747+ if (
748+ hasattr (odfv , "feature_transformation" )
749+ and odfv .feature_transformation
750+ ):
742751 if mode == "pandas" :
743752 df = initial_response_arrow .to_pandas ()
744753 transformed_df = odfv .feature_transformation .udf (df )
745754 import pyarrow as pa
746- transformed_features_arrow = pa .Table .from_pandas (transformed_df )
755+
756+ transformed_features_arrow = pa .Table .from_pandas (
757+ transformed_df
758+ )
747759 else :
748760 # For substrait mode, fallback to OnDemandFeatureView method
749761 transformed_features_arrow = odfv .transform_arrow (
@@ -772,7 +784,7 @@ def _augment_response_with_on_demand_transforms(
772784 selected_subset = [f for f in transformed_columns if f in _feature_refs ]
773785
774786 proto_values = []
775- schema_dict = {k .name : k .dtype for k in getattr (odfv , ' schema' , [])}
787+ schema_dict = {k .name : k .dtype for k in getattr (odfv , " schema" , [])}
776788 for selected_feature in selected_subset :
777789 feature_vector = transformed_features [selected_feature ]
778790 selected_feature_type = schema_dict .get (selected_feature , None )
@@ -1215,17 +1227,24 @@ def _get_feature_views_to_use(
12151227 od_fvs_to_use .append (
12161228 fv .with_projection (copy .copy (projection )) if projection else fv
12171229 )
1218- elif hasattr (fv , 'feature_transformation' ) and fv .feature_transformation is not None :
1230+ elif (
1231+ hasattr (fv , "feature_transformation" )
1232+ and fv .feature_transformation is not None
1233+ ):
12191234 # Handle unified FeatureViews with transformations like OnDemandFeatureViews
12201235 od_fvs_to_use .append (
12211236 fv .with_projection (copy .copy (projection )) if projection else fv
12221237 )
12231238
12241239 # For unified FeatureViews, source FeatureViews are stored in source_views property
1225- source_views = fv .source_views if hasattr (fv , 'source_views' ) and fv .source_views else []
1240+ source_views = (
1241+ fv .source_views
1242+ if hasattr (fv , "source_views" ) and fv .source_views
1243+ else []
1244+ )
12261245 for source_fv in source_views :
12271246 # source_fv is already a FeatureView object for unified FeatureViews
1228- if hasattr (source_fv , ' name' ):
1247+ if hasattr (source_fv , " name" ):
12291248 # If it's a FeatureView, get it from registry to ensure it's up to date
12301249 source_fv = registry .get_any_feature_view (
12311250 source_fv .name , project , allow_cache
@@ -1380,7 +1399,9 @@ def _prepare_entities_to_read_from_online_store(
13801399 ]
13811400 odfv_entities .extend (entities_for_odfv )
13821401 # Check if the feature view has source_request_sources (OnDemandFeatureView attribute)
1383- source_request_sources = getattr (on_demand_feature_view , 'source_request_sources' , {})
1402+ source_request_sources = getattr (
1403+ on_demand_feature_view , "source_request_sources" , {}
1404+ )
13841405 for source in source_request_sources :
13851406 source_schema = source_request_sources [source ].schema
13861407 for column in source_schema :
0 commit comments