Skip to content

Commit

Permalink
fix: Fix Shopify timestamp bug and add warnings to help with debuggin…
Browse files Browse the repository at this point in the history
…g entity registration (#3191)

* Fix

Signed-off-by: Kevin Zhang <[email protected]>

* Foix lint

Signed-off-by: Kevin Zhang <[email protected]>

Signed-off-by: Kevin Zhang <[email protected]>
  • Loading branch information
kevjumba authored Sep 7, 2022
1 parent 2107ce2 commit de75971
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
6 changes: 6 additions & 0 deletions sdk/python/feast/feature_view.py
Original file line number Diff line number Diff line change
Expand Up @@ -409,6 +409,12 @@ 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)
Expand Down
2 changes: 2 additions & 0 deletions sdk/python/feast/type_map.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit de75971

Please sign in to comment.