File tree Expand file tree Collapse file tree 1 file changed +6
-1
lines changed Expand file tree Collapse file tree 1 file changed +6
-1
lines changed Original file line number Diff line number Diff line change @@ -402,7 +402,12 @@ def _python_value_to_proto_value(
402
402
valid_scalar_types ,
403
403
) = PYTHON_SCALAR_VALUE_TYPE_TO_PROTO_VALUE [feast_value_type ]
404
404
if valid_scalar_types :
405
- assert type (sample ) in valid_scalar_types
405
+ if sample == 0 or sample == 0.0 :
406
+ # Numpy convert 0 to int. However, in the feature view definition, the type of column may be a float.
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 ]
409
+ else :
410
+ assert type (sample ) in valid_scalar_types
406
411
if feast_value_type == ValueType .BOOL :
407
412
# ProtoValue does not support conversion of np.bool_ so we need to convert it to support np.bool_.
408
413
return [
You can’t perform that action at this time.
0 commit comments