diff --git a/sdk/python/feast/type_map.py b/sdk/python/feast/type_map.py index f86a826e29..c615d2f50e 100644 --- a/sdk/python/feast/type_map.py +++ b/sdk/python/feast/type_map.py @@ -114,7 +114,7 @@ def python_type_to_feast_value_type( Returns: Feast Value Type """ - type_name = type_name or type(value).__name__ + type_name = (type_name or type(value).__name__).lower() type_map = { "int": ValueType.INT64, @@ -131,7 +131,7 @@ def python_type_to_feast_value_type( "int8": ValueType.INT32, "bool": ValueType.BOOL, "timedelta": ValueType.UNIX_TIMESTAMP, - "Timestamp": ValueType.UNIX_TIMESTAMP, + "timestamp": ValueType.UNIX_TIMESTAMP, "datetime": ValueType.UNIX_TIMESTAMP, "datetime64[ns]": ValueType.UNIX_TIMESTAMP, "datetime64[ns, tz]": ValueType.UNIX_TIMESTAMP, diff --git a/sdk/python/tests/integration/feature_repos/universal/feature_views.py b/sdk/python/tests/integration/feature_repos/universal/feature_views.py index b566fa4609..23ce1b4cb1 100644 --- a/sdk/python/tests/integration/feature_repos/universal/feature_views.py +++ b/sdk/python/tests/integration/feature_repos/universal/feature_views.py @@ -44,6 +44,9 @@ def conv_rate_plus_100(features_df: pd.DataFrame) -> pd.DataFrame: df["conv_rate_plus_val_to_add"] = ( features_df["conv_rate"] + features_df["val_to_add"] ) + df["conv_rate_plus_100_rounded"] = ( + df["conv_rate_plus_100"].astype("float").round().astype(pd.Int32Dtype()) + ) return df @@ -55,6 +58,7 @@ def conv_rate_plus_100_feature_view( _features = features or [ Feature("conv_rate_plus_100", ValueType.DOUBLE), Feature("conv_rate_plus_val_to_add", ValueType.DOUBLE), + Feature("conv_rate_plus_100_rounded", ValueType.INT32), ] return OnDemandFeatureView( name=conv_rate_plus_100.__name__, diff --git a/sdk/python/tests/integration/offline_store/test_universal_historical_retrieval.py b/sdk/python/tests/integration/offline_store/test_universal_historical_retrieval.py index b558bbe3e8..384f3c8d4f 100644 --- a/sdk/python/tests/integration/offline_store/test_universal_historical_retrieval.py +++ b/sdk/python/tests/integration/offline_store/test_universal_historical_retrieval.py @@ -228,6 +228,12 @@ def get_expected_training_df( conv_feature_name = "driver_stats__conv_rate" if full_feature_names else "conv_rate" expected_df["conv_rate_plus_100"] = expected_df[conv_feature_name] + 100 + expected_df["conv_rate_plus_100_rounded"] = ( + expected_df["conv_rate_plus_100"] + .astype("float") + .round() + .astype(pd.Int32Dtype()) + ) expected_df["conv_rate_plus_val_to_add"] = ( expected_df[conv_feature_name] + expected_df["val_to_add"] ) @@ -375,6 +381,7 @@ def test_historical_features(environment, universal_data_sources, full_feature_n expected_df_query = expected_df.drop( columns=[ "conv_rate_plus_100", + "conv_rate_plus_100_rounded", "val_to_add", "conv_rate_plus_val_to_add", "driver_age", @@ -426,6 +433,7 @@ def test_historical_features(environment, universal_data_sources, full_feature_n "customer_profile:avg_passenger_count", "customer_profile:lifetime_trip_count", "conv_rate_plus_100:conv_rate_plus_100", + "conv_rate_plus_100:conv_rate_plus_100_rounded", "conv_rate_plus_100:conv_rate_plus_val_to_add", "order:order_is_success", "global_stats:num_rides", diff --git a/sdk/python/tests/integration/registration/test_universal_odfv_feature_inference.py b/sdk/python/tests/integration/registration/test_universal_odfv_feature_inference.py index a2ff8b24ad..6d6750081b 100644 --- a/sdk/python/tests/integration/registration/test_universal_odfv_feature_inference.py +++ b/sdk/python/tests/integration/registration/test_universal_odfv_feature_inference.py @@ -30,7 +30,7 @@ def test_infer_odfv_features(environment, universal_data_sources, infer_features feast_objects = [driver_hourly_stats, driver_odfv, driver(), customer()] store.apply(feast_objects) odfv = store.get_on_demand_feature_view("conv_rate_plus_100") - assert len(odfv.features) == 2 + assert len(odfv.features) == 3 @pytest.mark.integration