Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Serving not working with datetime64 numpy env. #2209

Closed
fengyu05 opened this issue Jan 8, 2022 · 1 comment · Fixed by #2219
Closed

Serving not working with datetime64 numpy env. #2209

fengyu05 opened this issue Jan 8, 2022 · 1 comment · Fixed by #2219

Comments

@fengyu05
Copy link
Contributor

fengyu05 commented Jan 8, 2022

Expected Behavior

should work.

Current Behavior

Serving not working with datetime64 numpy env.

  File "/Users/zf/go/src/github.com/opendoor-labs/code/py/.venv/lib/python3.9/site-packages/feast/type_map.py", line 332, in python_values_to_proto_values
    return _python_value_to_proto_value(value_type, values)
  File "/Users/zf/go/src/github.com/opendoor-labs/code/py/.venv/lib/python3.9/site-packages/feast/type_map.py", line 293, in _python_value_to_proto_value
    return [ProtoValue(int64_val=int(value)) for value in values]
  File "/Users/zf/go/src/github.com/opendoor-labs/code/py/.venv/lib/python3.9/site-packages/feast/type_map.py", line 293, in <listcomp>
    return [ProtoValue(int64_val=int(value)) for value in values]
TypeError: int() argument must be a string, a bytes-like object or a number, not 'datetime.datetime'

Steps to reproduce

Serve a feature

Specifications

  • Version:
  • Platform:
  • Subsystem:

Possible Solution

Fix:
https://github.com/feast-dev/feast/blob/master/sdk/python/feast/type_map.py#L292

++ this to type map

            elif isinstance(sample, np.datetime64):
                return [
                ProtoValue(int64_val=int(pd.Timestamp(value).to_pydatetime().timestamp())) for value in values
                ]

72bae7d

@judahrand
Copy link
Member

Would you be able to open a Pull Request with this fix?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants