@@ -301,8 +301,14 @@ def _convert_arrow_to_proto(
301301 feature_view : FeatureView ,
302302 join_keys : List [str ],
303303) -> List [Tuple [EntityKeyProto , Dict [str , ValueProto ], datetime , Optional [datetime ]]]:
304+ # Avoid ChunkedArrays which guarentees `zero_copy_only` availiable.
305+ if isinstance (table , pyarrow .Table ):
306+ table = table .to_batches ()[0 ]
307+
304308 # Handle join keys
305- join_key_values = {k : table .column (k ).to_pylist () for k in join_keys }
309+ join_key_values = {
310+ k : table .column (k ).to_numpy (zero_copy_only = False ) for k in join_keys
311+ }
306312 entity_keys = [
307313 EntityKeyProto (
308314 join_keys = join_keys ,
@@ -317,7 +323,7 @@ def _convert_arrow_to_proto(
317323 feature_dict = {
318324 feature .name : [
319325 python_value_to_proto_value (val , feature .dtype )
320- for val in table .column (feature .name ).to_pylist ( )
326+ for val in table .column (feature .name ).to_numpy ( zero_copy_only = False )
321327 ]
322328 for feature in feature_view .features
323329 }
@@ -326,18 +332,22 @@ def _convert_arrow_to_proto(
326332 # Convert event_timestamps
327333 event_timestamps = [
328334 _coerce_datetime (val )
329- for val in table .column (
330- feature_view .batch_source .event_timestamp_column
331- ).to_pylist ()
335+ for val in pandas .to_datetime (
336+ table .column (feature_view .batch_source .event_timestamp_column ).to_numpy (
337+ zero_copy_only = False
338+ )
339+ )
332340 ]
333341
334342 # Convert created_timestamps if they exist
335343 if feature_view .batch_source .created_timestamp_column :
336344 created_timestamps = [
337345 _coerce_datetime (val )
338- for val in table .column (
339- feature_view .batch_source .created_timestamp_column
340- ).to_pylist ()
346+ for val in pandas .to_datetime (
347+ table .column (
348+ feature_view .batch_source .created_timestamp_column
349+ ).to_numpy (zero_copy_only = False )
350+ )
341351 ]
342352 else :
343353 created_timestamps = [None ] * table .num_rows
0 commit comments