Skip to content

Serving not working with datetime64 numpy env. #2209

Closed

Description

@Z-Ghostshell

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

Activity

  1. judahrand commented on Jan 10, 2022

    @judahrand
    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

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions