-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Closed
Labels
Description
Expected Behavior
New on demand feature view created.
Current Behavior
Attempting to apply a feature view with STRING type field fails with an exception below.
/home/user/source_code/feast_exp/.venv/bin/python /home/user/source_code/feast_exp/src/od.py
/home/user/source_code/feast_exp/.venv/lib/python3.11/site-packages/feast/feature_store.py:580: RuntimeWarning: On demand feature view is an experimental feature. This API is stable, but the functionality does not scale well for offline retrieval
warnings.warn(
Traceback (most recent call last):
File "/home/user/source_code/feast_exp/src/od.py", line 23, in <module>
STORE.apply([r,transform])
File "/home/user/source_code/feast_exp/.venv/lib/python3.11/site-packages/feast/feature_store.py", line 936, in apply
self._make_inferences(
File "/home/user/source_code/feast_exp/.venv/lib/python3.11/site-packages/feast/feature_store.py", line 643, in _make_inferences
odfv.infer_features()
File "/home/user/source_code/feast_exp/.venv/lib/python3.11/site-packages/feast/on_demand_feature_view.py", line 654, in infer_features
inferred_features = self.feature_transformation.infer_features(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/user/source_code/feast_exp/.venv/lib/python3.11/site-packages/feast/transformation/pandas_transformation.py", line 98, in infer_features
python_type_to_feast_value_type(
File "/home/user/source_code/feast_exp/.venv/lib/python3.11/site-packages/feast/type_map.py", line 214, in python_type_to_feast_value_type
raise ValueError(
ValueError: Value with native type object cannot be converted into Feast value type
Process finished with exit code 1
Steps to reproduce
Attempt to apply the feature view below.
from feast import on_demand_feature_view
from feast import RequestSource
from feast import Field
from feast.types import String,Int32
from feature_store.configs.store import STORE
r=RequestSource(
name="r",
timestamp_field="event_ts",
schema=[
Field(name="input_1", dtype=String)
]
)
@on_demand_feature_view.on_demand_feature_view(name="a",schema=[],entities=[],sources=[r])
def transform(df):
return df
if __name__ == "__main__":
STORE.apply([r,transform])
Specifications
- Version: 0.53.0
- Platform: Linux
- Subsystem: Ubuntu
Possible Solution
Running the apply on debug mode shows that the input column is of type object
instead of string
.
When the column is explicitly type cast to string
with the line below in the transform
method, the apply successfully passes.
df["input_1"]=df["input_1"].astype("string")
One solution would be to ensure that the input source attempts to type cast to defined type and raise an exception if it cannot be type cast.
Copilot