Skip to content

Commit 3cf0369

Browse files
Rebasing and merging changes from other PR
Signed-off-by: Francisco Javier Arceo <farceo@redhat.com>
1 parent b76bf4e commit 3cf0369

File tree

2 files changed

+10
-9
lines changed

2 files changed

+10
-9
lines changed

sdk/python/feast/inference.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@
1313
from feast.infra.offline_stores.file_source import FileSource
1414
from feast.infra.offline_stores.redshift_source import RedshiftSource
1515
from feast.infra.offline_stores.snowflake_source import SnowflakeSource
16-
from feast.on_demand_feature_view import OnDemandFeatureView
1716
from feast.repo_config import RepoConfig
1817
from feast.stream_feature_view import StreamFeatureView
1918
from feast.on_demand_feature_view import OnDemandFeatureView

sdk/python/feast/utils.py

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -322,16 +322,18 @@ def _convert_arrow_odfv_to_proto(
322322
}
323323
# Adding On Demand Features
324324
for feature in feature_view.features:
325-
if feature.name in [c[0] for c in columns]:
325+
if feature.name in [c[0] for c in columns] and feature.name not in proto_values_by_column:
326326
# initializing the column as null
327-
proto_values_by_column[feature.name] = python_values_to_proto_values(
328-
table.append_column(
329-
feature.name,
330-
pyarrow.array(
331-
[None] * table.shape[0],
327+
null_column = pyarrow.array(
328+
[None] * table.num_rows,
332329
type=from_feast_to_pyarrow_type(feature.dtype),
333-
),
334-
),
330+
)
331+
updated_table = pyarrow.RecordBatch.from_arrays(
332+
table.columns + [null_column],
333+
schema=table.schema.append(pyarrow.field(feature.name, null_column.type))
334+
)
335+
proto_values_by_column[feature.name] = python_values_to_proto_values(
336+
updated_table.column(feature.name).to_numpy(zero_copy_only=False), feature.dtype.to_value_type(),
335337
)
336338

337339
entity_keys = [

0 commit comments

Comments
 (0)