Skip to content

Commit

Permalink
fix: Ensure no duplicates in fv.schema (#3460)
Browse files Browse the repository at this point in the history
* Ensure no duplicates in `fv.schema`

Signed-off-by: Felix Wang <wangfelix98@gmail.com>

* Fix `Field.__eq__` to check all attributes

Signed-off-by: Felix Wang <wangfelix98@gmail.com>

Signed-off-by: Felix Wang <wangfelix98@gmail.com>
  • Loading branch information
felixwang9817 authored Jan 20, 2023
1 parent 1c7c491 commit 08ffa8d
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
2 changes: 1 addition & 1 deletion sdk/python/feast/feature_view.py
Original file line number Diff line number Diff line change
Expand Up @@ -259,7 +259,7 @@ def join_keys(self) -> List[str]:

@property
def schema(self) -> List[Field]:
return self.entity_columns + self.features
return list(set(self.entity_columns + self.features))

def ensure_valid(self):
"""
Expand Down
6 changes: 5 additions & 1 deletion sdk/python/feast/field.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,11 +30,13 @@ class Field:
Attributes:
name: The name of the field.
dtype: The type of the field, such as string or float.
tags (optional): User-defined metadata in dictionary form.
description: A human-readable description.
tags: User-defined metadata in dictionary form.
"""

name: str
dtype: FeastType
description: str
tags: Dict[str, str]

def __init__(
Expand All @@ -51,6 +53,7 @@ def __init__(
Args:
name: The name of the field.
dtype: The type of the field, such as string or float.
description (optional): A human-readable description.
tags (optional): User-defined metadata in dictionary form.
"""
self.name = name
Expand All @@ -65,6 +68,7 @@ def __eq__(self, other):
if (
self.name != other.name
or self.dtype != other.dtype
or self.description != other.description
or self.tags != other.tags
):
return False
Expand Down

0 comments on commit 08ffa8d

Please sign in to comment.