Skip to content

Commit 828cd23

Browse files
fix integration tests
Signed-off-by: Alan Gauthier <alan.gauthier@jobteaser.com>
1 parent ecd43bd commit 828cd23

2 files changed

Lines changed: 5 additions & 4 deletions

File tree

sdk/python/feast/type_map.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -897,8 +897,6 @@ def _sanitize_list_value(value: Any, feast_value_type: ValueType) -> Any:
897897
"""
898898
if isinstance(value, np.ndarray):
899899
value = value.tolist()
900-
if isinstance(value, list) and len(value) == 0:
901-
return None
902900
none_default = _LIST_NONE_DEFAULTS.get(feast_value_type)
903901
if none_default is not None and isinstance(value, list):
904902
value = [none_default if v is None else v for v in value]

sdk/python/tests/unit/test_type_map.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,9 @@ def test_python_values_to_proto_values_bool(values):
8787
(np.array([None]), ValueType.BYTES_LIST, None),
8888
(np.array([None]), ValueType.STRING_LIST, None),
8989
(np.array([None]), ValueType.UNIX_TIMESTAMP_LIST, None),
90+
([np.array([], dtype=np.int32)], ValueType.INT32_LIST, []),
91+
([np.array([], dtype=np.float32)], ValueType.FLOAT_LIST, []),
92+
([np.array([], dtype=np.bool_)], ValueType.BOOL_LIST, []),
9093
([b"[1,2,3]"], ValueType.INT64_LIST, [1, 2, 3]),
9194
([b"[1,2,3]"], ValueType.INT32_LIST, [1, 2, 3]),
9295
([b"[1.5,2.5,3.5]"], ValueType.FLOAT_LIST, [1.5, 2.5, 3.5]),
@@ -2094,12 +2097,12 @@ def test_sanitize_list_value_ndarray(self):
20942097
assert isinstance(result, list)
20952098

20962099
def test_sanitize_list_value_empty_ndarray(self):
2097-
"""Empty ndarray is converted to None (treated as a missing row)."""
2100+
"""Empty ndarray is converted to an empty Python list."""
20982101
from feast.type_map import _sanitize_list_value
20992102

21002103
arr = np.array([], dtype=object)
21012104
result = _sanitize_list_value(arr, ValueType.STRING_LIST)
2102-
assert result is None
2105+
assert result == []
21032106

21042107
def test_sanitize_list_value_ndarray_with_none(self):
21052108
"""None elements inside a STRING_LIST ndarray are replaced with empty string."""

0 commit comments

Comments
 (0)