File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -443,9 +443,7 @@ def infer_features(self):
443443 Raises:
444444 RegistryInferenceFailure: The set of features could not be inferred.
445445 """
446- # Note: Pandas will cast string or mixed number / string values to object. Assume this is string.
447446 rand_df_value : Dict [str , Any ] = {
448- "object" : "hello world" ,
449447 "float" : 1.0 ,
450448 "int" : 1 ,
451449 "str" : "hello world" ,
@@ -461,13 +459,13 @@ def infer_features(self):
461459 df [f"{ feature_view_projection .name } __{ feature .name } " ] = pd .Series (
462460 dtype = dtype
463461 )
464- df [f"{ feature .name } " ] = pd .Series (
465- data = rand_df_value [dtype ], dtype = dtype
466- )
462+ sample_val = rand_df_value [dtype ] if dtype in rand_df_value else None
463+ df [f"{ feature .name } " ] = pd .Series (data = sample_val , dtype = dtype )
467464 for request_data in self .source_request_sources .values ():
468465 for field in request_data .schema :
469466 dtype = feast_value_type_to_pandas_type (field .dtype .to_value_type ())
470- df [f"{ field .name } " ] = pd .Series (rand_df_value [dtype ], dtype = dtype )
467+ sample_val = rand_df_value [dtype ] if dtype in rand_df_value else None
468+ df [f"{ field .name } " ] = pd .Series (sample_val , dtype = dtype )
471469 output_df : pd .DataFrame = self .udf .__call__ (df )
472470 inferred_features = []
473471 for f , dt in zip (output_df .columns , output_df .dtypes ):
You can’t perform that action at this time.
0 commit comments