-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Closed
Labels
Description
Expected Behavior
In Snowflake
select FEAST_FEAST_FEATURES_SNOWFLAKE_BOOLEAN_TO_BOOL_PROTO(FALSE);
--> 3800
Current Behavior
select FEAST_FEAST_FEATURES_SNOWFLAKE_BOOLEAN_TO_BOOL_PROTO(FALSE);
Traceback (most recent call last):
File "/home/udf/6137508531934/feast.zip/feast/infra/utils/snowflake/snowpark/snowflake_udfs.py", line 150, in feast_snowflake_boolean_to_bool_boolean_proto
python_values_to_proto_values(df[0].to_numpy(), ValueType.BOOL),
File "/home/udf/6137508531934/feast.zip/feast/type_map.py", line 454, in python_values_to_proto_values
return _python_value_to_proto_value(value_type, values)
File "/home/udf/6137508531934/feast.zip/feast/type_map.py", line 408, in _python_value_to_proto_value
assert type(sample) in [np.int64, int, np.float64, float]
AssertionError
in function FEAST_FEAST_FEATURES_SNOWFLAKE_BOOLEAN_TO_BOOL_PROTO with handler feast.infra.utils.snowflake.snowpark.snowflake_udfs.feast_snowflake_boolean_to_bool_boolean_proto
Steps to reproduce
feast==0.28.0
- Batch materialization job where Boolean values (must include
FALSE
)
Specifications
- Version: 0.28.0
- Platform: mac, linux
- Subsystem: ?
Possible Solution
As pointed out in this issue, I believe this bug was introduced in 0.28.0 such that:
Boolean value evaluates to
feast/sdk/python/feast/type_map.py
Lines 399 to 403 in 98a24a3
( | |
field_name, | |
func, | |
valid_scalar_types, | |
) = PYTHON_SCALAR_VALUE_TYPE_TO_PROTO_VALUE[feast_value_type] |
feast/sdk/python/feast/type_map.py
Line 303 in 98a24a3
ValueType.BOOL: ("bool_val", lambda x: x, {bool, np.bool_}), |
Which causes it to enter this conditional
feast/sdk/python/feast/type_map.py
Lines 404 to 410 in 98a24a3
if valid_scalar_types: | |
if sample == 0 or sample == 0.0: | |
# 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] | |
else: | |
assert type(sample) in valid_scalar_types |
Where it can fail if sample == False
because False == 0
--> True