Skip to content

Commit

Permalink
Handle np.datetime64 to ValueType.UNIX_TIMESTAMP conversion
Browse files Browse the repository at this point in the history
Signed-off-by: Judah Rand <[email protected]>
  • Loading branch information
judahrand committed Jan 21, 2022
1 parent 62fae05 commit 77af10f
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions sdk/python/feast/type_map.py
Original file line number Diff line number Diff line change
Expand Up @@ -290,6 +290,11 @@ def _python_value_to_proto_value(
return [
ProtoValue(int64_val=int(value.ToSeconds())) for value in values
]
elif isinstance(sample, np.datetime64):
return [
ProtoValue(int64_val=value.astype("datetime64[s]").astype("int"))
for value in values
]
return [ProtoValue(int64_val=int(value)) for value in values]

if feast_value_type in PYTHON_SCALAR_VALUE_TYPE_TO_PROTO_VALUE:
Expand Down

0 comments on commit 77af10f

Please sign in to comment.