From c0b1e57853790d9f999f8cf3f814279227c72aa7 Mon Sep 17 00:00:00 2001 From: Judah Rand <17158624+judahrand@users.noreply.github.com> Date: Sat, 10 Jul 2021 11:14:50 +0100 Subject: [PATCH] Fix Python to Feast `list[int]` mapping Corrects a case where if elements in list were not `numpy` types type mapping would fail. --- sdk/python/feast/type_map.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/sdk/python/feast/type_map.py b/sdk/python/feast/type_map.py index 54d30cbd22..20c950b137 100644 --- a/sdk/python/feast/type_map.py +++ b/sdk/python/feast/type_map.py @@ -235,7 +235,9 @@ def _python_value_to_proto_value(feast_value_type, value) -> ProtoValue: return ProtoValue( int32_list_val=Int32List( val=[ - item if type(item) is np.int32 else _type_err(item, np.int32) + item + if type(item) in [np.int32, int] + else _type_err(item, np.int32) for item in value ] ) @@ -246,7 +248,7 @@ def _python_value_to_proto_value(feast_value_type, value) -> ProtoValue: int64_list_val=Int64List( val=[ item - if type(item) in [np.int64, np.int32] + if type(item) in [np.int64, np.int32, int] else _type_err(item, np.int64) for item in value ] @@ -258,7 +260,7 @@ def _python_value_to_proto_value(feast_value_type, value) -> ProtoValue: int64_list_val=Int64List( val=[ item - if type(item) in [np.int64, np.int32] + if type(item) in [np.int64, np.int32, int] else _type_err(item, np.int64) for item in value ]