@@ -300,7 +300,7 @@ def _type_err(item, dtype):
300
300
ValueType .DOUBLE : ("double_val" , lambda x : x , {float , np .float64 }),
301
301
ValueType .STRING : ("string_val" , lambda x : str (x ), None ),
302
302
ValueType .BYTES : ("bytes_val" , lambda x : x , {bytes }),
303
- ValueType .BOOL : ("bool_val" , lambda x : x , {bool , np .bool_ }),
303
+ ValueType .BOOL : ("bool_val" , lambda x : x , {bool , np .bool_ , int , np . int_ }),
304
304
}
305
305
306
306
@@ -405,9 +405,14 @@ def _python_value_to_proto_value(
405
405
if (sample == 0 or sample == 0.0 ) and feast_value_type != ValueType .BOOL :
406
406
# Numpy convert 0 to int. However, in the feature view definition, the type of column may be a float.
407
407
# So, if value is 0, type validation must pass if scalar_types are either int or float.
408
- assert type (sample ) in [np .int64 , int , np .float64 , float ]
408
+ allowed_types = {np .int64 , int , np .float64 , float }
409
+ assert (
410
+ type (sample ) in allowed_types
411
+ ), f"Type `{ type (sample )} ` not in { allowed_types } "
409
412
else :
410
- assert type (sample ) in valid_scalar_types
413
+ assert (
414
+ type (sample ) in valid_scalar_types
415
+ ), f"Type `{ type (sample )} ` not in { valid_scalar_types } "
411
416
if feast_value_type == ValueType .BOOL :
412
417
# ProtoValue does not support conversion of np.bool_ so we need to convert it to support np.bool_.
413
418
return [
0 commit comments