From 86d3d310b6e56e7402231da9be93e1d929c0e0c0 Mon Sep 17 00:00:00 2001 From: Kevin Zhang Date: Wed, 7 Sep 2022 14:16:37 -0700 Subject: [PATCH 1/2] Fix Signed-off-by: Kevin Zhang --- sdk/python/feast/feature_view.py | 4 ++++ sdk/python/feast/type_map.py | 2 ++ 2 files changed, 6 insertions(+) diff --git a/sdk/python/feast/feature_view.py b/sdk/python/feast/feature_view.py index cdd507868df..07ca9cd92e4 100644 --- a/sdk/python/feast/feature_view.py +++ b/sdk/python/feast/feature_view.py @@ -409,6 +409,10 @@ def from_proto(cls, feature_view_proto: FeatureViewProto): for field_proto in feature_view_proto.spec.entity_columns ] + if len(feature_view.entities) != len(feature_view.entity_columns): + warnings.warn(f"There are some mismatches in your feature view's registered entities. Please check if you have applied your entities correctly." + f"Entities: {feature_view.entities} vs Entity Columns: {feature_view.entity_columns}") + # FeatureViewProjections are not saved in the FeatureView proto. # Create the default projection. feature_view.projection = FeatureViewProjection.from_definition(feature_view) diff --git a/sdk/python/feast/type_map.py b/sdk/python/feast/type_map.py index 3bec457dcbb..466993bb3d7 100644 --- a/sdk/python/feast/type_map.py +++ b/sdk/python/feast/type_map.py @@ -320,6 +320,8 @@ def _python_datetime_to_int_timestamp( int_timestamps.append(int(value.ToSeconds())) elif isinstance(value, np.datetime64): int_timestamps.append(value.astype("datetime64[s]").astype(np.int_)) + elif isinstance(value, type(np.nan)): + int_timestamps.append(NULL_TIMESTAMP_INT_VALUE) else: int_timestamps.append(int(value)) return int_timestamps From a1fc535ca5eb24544e3916c036b07c33b2544911 Mon Sep 17 00:00:00 2001 From: Kevin Zhang Date: Wed, 7 Sep 2022 14:17:48 -0700 Subject: [PATCH 2/2] Foix lint Signed-off-by: Kevin Zhang --- sdk/python/feast/feature_view.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/sdk/python/feast/feature_view.py b/sdk/python/feast/feature_view.py index 07ca9cd92e4..344171745be 100644 --- a/sdk/python/feast/feature_view.py +++ b/sdk/python/feast/feature_view.py @@ -410,8 +410,10 @@ def from_proto(cls, feature_view_proto: FeatureViewProto): ] if len(feature_view.entities) != len(feature_view.entity_columns): - warnings.warn(f"There are some mismatches in your feature view's registered entities. Please check if you have applied your entities correctly." - f"Entities: {feature_view.entities} vs Entity Columns: {feature_view.entity_columns}") + warnings.warn( + f"There are some mismatches in your feature view's registered entities. Please check if you have applied your entities correctly." + f"Entities: {feature_view.entities} vs Entity Columns: {feature_view.entity_columns}" + ) # FeatureViewProjections are not saved in the FeatureView proto. # Create the default projection.