From 5dcd9fbd9eed7ab3ce971c23690f386cc5b03bd3 Mon Sep 17 00:00:00 2001 From: Ryan Beauchamp Date: Thu, 19 Jan 2023 08:20:06 -0500 Subject: [PATCH] fix: add check for bool type in addition to sample Signed-off-by: Ryan Beauchamp --- sdk/python/feast/type_map.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sdk/python/feast/type_map.py b/sdk/python/feast/type_map.py index a91a6c141d..78b625aa89 100644 --- a/sdk/python/feast/type_map.py +++ b/sdk/python/feast/type_map.py @@ -402,7 +402,7 @@ def _python_value_to_proto_value( valid_scalar_types, ) = PYTHON_SCALAR_VALUE_TYPE_TO_PROTO_VALUE[feast_value_type] if valid_scalar_types: - if sample == 0 or sample == 0.0: + if (sample == 0 or sample == 0.0) and feast_value_type != ValueType.BOOL: # Numpy convert 0 to int. However, in the feature view definition, the type of column may be a float. # So, if value is 0, type validation must pass if scalar_types are either int or float. assert type(sample) in [np.int64, int, np.float64, float]