We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 9a33fce commit 8f264b6Copy full SHA for 8f264b6
sdk/python/feast/type_map.py
@@ -396,13 +396,18 @@ def _python_value_to_proto_value(
396
raise _type_err(item, valid_types[0])
397
398
if feast_value_type == ValueType.UNIX_TIMESTAMP_LIST:
399
- int_timestamps_lists = (
400
- _python_datetime_to_int_timestamp(value) for value in values
401
- )
402
return [
403
- # ProtoValue does actually accept `np.int_` but the typing complains.
404
- ProtoValue(unix_timestamp_list_val=Int64List(val=ts)) # type: ignore
405
- for ts in int_timestamps_lists
+ (
+ # ProtoValue does actually accept `np.int_` but the typing complains.
+ ProtoValue(
+ unix_timestamp_list_val=Int64List(
+ val=_python_datetime_to_int_timestamp(value) # type: ignore
+ )
406
407
+ if value is not None
408
+ else ProtoValue()
409
410
+ for value in values
411
]
412
if feast_value_type == ValueType.BOOL_LIST:
413
# ProtoValue does not support conversion of np.bool_ so we need to convert it to support np.bool_.
sdk/python/tests/unit/test_type_map.py
@@ -60,7 +60,14 @@ def test_python_values_to_proto_values_bool(values):
60
(np.array([b'["a","b","c"]']), ValueType.STRING_LIST, ["a", "b", "c"]),
61
(np.array([b"[true,false]"]), ValueType.BOOL_LIST, [True, False]),
62
(np.array([b"[1,0]"]), ValueType.BOOL_LIST, [True, False]),
63
+ (np.array([None]), ValueType.INT32_LIST, None),
64
+ (np.array([None]), ValueType.INT64_LIST, None),
65
+ (np.array([None]), ValueType.FLOAT_LIST, None),
66
+ (np.array([None]), ValueType.DOUBLE_LIST, None),
67
+ (np.array([None]), ValueType.BOOL_LIST, None),
68
+ (np.array([None]), ValueType.BYTES_LIST, None),
69
(np.array([None]), ValueType.STRING_LIST, None),
70
+ (np.array([None]), ValueType.UNIX_TIMESTAMP_LIST, None),
71
([b"[1,2,3]"], ValueType.INT64_LIST, [1, 2, 3]),
72
([b"[1,2,3]"], ValueType.INT32_LIST, [1, 2, 3]),
73
([b"[1.5,2.5,3.5]"], ValueType.FLOAT_LIST, [1.5, 2.5, 3.5]),
0 commit comments