4848from feast .on_demand_feature_view import OnDemandFeatureView
4949from feast .repo_config import FeastConfigBaseModel , RepoConfig
5050from feast .saved_dataset import SavedDatasetStorage , ValidationReference
51- from feast .type_map import feast_value_type_to_pandas_type , pa_to_feast_value_type
51+ from feast .type_map import (
52+ convert_array_column ,
53+ convert_scalar_column ,
54+ feast_value_type_to_pandas_type ,
55+ pa_to_feast_value_type ,
56+ )
5257from feast .utils import _get_column_names , make_df_tzaware , make_tzaware
53- from feast .value_type import ValueType
5458
5559logger = logging .getLogger (__name__ )
5660
@@ -284,12 +288,12 @@ def convert_batch(batch: pd.DataFrame) -> pd.DataFrame:
284288 try :
285289 value_type = feature .dtype .to_value_type ()
286290 if value_type .name .endswith ("_LIST" ):
287- batch [feat_name ] = _convert_array_column (
291+ batch [feat_name ] = convert_array_column (
288292 batch [feat_name ], value_type
289293 )
290294 else :
291295 target_pandas_type = feast_value_type_to_pandas_type (value_type )
292- batch [feat_name ] = _convert_scalar_column (
296+ batch [feat_name ] = convert_scalar_column (
293297 batch [feat_name ], value_type , target_pandas_type
294298 )
295299 except Exception as e :
@@ -302,64 +306,19 @@ def convert_batch(batch: pd.DataFrame) -> pd.DataFrame:
302306 return _apply_to_data (data , convert_batch )
303307
304308
305- def _convert_scalar_column (
306- series : pd .Series , value_type : ValueType , target_pandas_type : str
307- ) -> pd .Series :
308- """Convert a scalar feature column to the appropriate pandas type."""
309- if value_type == ValueType .INT32 :
310- return pd .to_numeric (series , errors = "coerce" ).astype ("Int32" )
311- elif value_type == ValueType .INT64 :
312- return pd .to_numeric (series , errors = "coerce" ).astype ("Int64" )
313- elif value_type in [ValueType .FLOAT , ValueType .DOUBLE ]:
314- return pd .to_numeric (series , errors = "coerce" ).astype ("float64" )
315- elif value_type == ValueType .BOOL :
316- return series .astype ("boolean" )
317- elif value_type == ValueType .STRING :
318- return series .astype ("string" )
319- elif value_type == ValueType .UNIX_TIMESTAMP :
320- return pd .to_datetime (series , unit = "s" , errors = "coerce" )
321- else :
322- return series .astype (target_pandas_type )
323-
324-
325- def _convert_array_column (series : pd .Series , value_type : ValueType ) -> pd .Series :
326- """Convert an array feature column to the appropriate type with proper empty array handling."""
327- base_type_map = {
328- ValueType .INT32_LIST : np .int32 ,
329- ValueType .INT64_LIST : np .int64 ,
330- ValueType .FLOAT_LIST : np .float32 ,
331- ValueType .DOUBLE_LIST : np .float64 ,
332- ValueType .BOOL_LIST : np .bool_ ,
333- ValueType .STRING_LIST : object ,
334- ValueType .BYTES_LIST : object ,
335- ValueType .UNIX_TIMESTAMP_LIST : "datetime64[s]" ,
336- }
337-
338- target_dtype = base_type_map .get (value_type , object )
339-
340- def convert_array_item (item ) -> Union [np .ndarray , Any ]:
341- if item is None or (isinstance (item , list ) and len (item ) == 0 ):
342- if target_dtype == object :
343- return np .empty (0 , dtype = object )
344- else :
345- return np .empty (0 , dtype = target_dtype )
346- else :
347- return item
348-
349- return series .apply (convert_array_item )
350-
351-
352309class RayOfflineStoreConfig (FeastConfigBaseModel ):
353310 """
354311 Configuration for the Ray Offline Store.
312+
313+ For detailed configuration options and examples, see the documentation:
314+ https://docs.feast.dev/reference/offline-stores/ray
355315 """
356316
357317 type : Literal [
358318 "feast.offline_stores.contrib.ray_offline_store.ray.RayOfflineStore" , "ray"
359319 ] = "ray"
360320 storage_path : Optional [str ] = None
361321 ray_address : Optional [str ] = None
362- use_ray_cluster : Optional [bool ] = False
363322
364323 # Optimization settings
365324 broadcast_join_threshold_mb : Optional [int ] = 100
@@ -378,6 +337,7 @@ class RayOfflineStoreConfig(FeastConfigBaseModel):
378337class RayResourceManager :
379338 """
380339 Manages Ray cluster resources for optimal performance.
340+ # See: https://docs.feast.dev/reference/offline-stores/ray#resource-management-and-testing
381341 """
382342
383343 def __init__ (self , config : Optional [RayOfflineStoreConfig ] = None ) -> None :
@@ -1265,7 +1225,7 @@ def _ensure_ray_initialized(config: Optional[RepoConfig] = None) -> None:
12651225
12661226 if config and hasattr (config , "offline_store" ):
12671227 if isinstance (ray_config , RayOfflineStoreConfig ):
1268- if ray_config .use_ray_cluster and ray_config . ray_address :
1228+ if ray_config .ray_address :
12691229 ray_init_kwargs ["address" ] = ray_config .ray_address
12701230 else :
12711231 ray_init_kwargs .update (
0 commit comments