From 77af10fc241aead9a965f489dfa2639e3a066115 Mon Sep 17 00:00:00 2001 From: Judah Rand <17158624+judahrand@users.noreply.github.com> Date: Tue, 18 Jan 2022 11:00:00 +0000 Subject: [PATCH] Handle `np.datetime64` to `ValueType.UNIX_TIMESTAMP` conversion Signed-off-by: Judah Rand <17158624+judahrand@users.noreply.github.com> --- sdk/python/feast/type_map.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/sdk/python/feast/type_map.py b/sdk/python/feast/type_map.py index 969ca65862..9df80725db 100644 --- a/sdk/python/feast/type_map.py +++ b/sdk/python/feast/type_map.py @@ -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: