forked from feast-dev/feast
-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: Adding Python classes for new Feature View type SortedFeatureVi…
…ew (#175) * Adding python classes for new Feature View type SortedFeatureView * Adding python classes for new Feature View type SortedFeatureView * Adding python classes for new Feature View type SortedFeatureView * fixing formatting * Adding tests and fixing formatting * Adding go class * Adding relevant go class * Adding additional testing * getting rid of dummy entity constants * formatting file to fix linting errors * Adding in new changes to support the new feature view type sortedFeatureView * fixing circular dependency * fixing circular dependency * fixing circular dependency by fixing how things are imported * fixing circular dependency by fixing how things are imported * Fixing linting and missed additions of the SortedFeatureView * fixing formatting issues * fixing formatting issues * fixing failing tests * adding SortedFeatureView to the permission proto * Fixing linting errors * Fixing linting errors * Fixing linting errors * Fixing linting errors * Fixing linting errors * Adding in more changes * Adding changes to the workflow to see if it fixes the build failures * fixing linting issues * Committing PR changes * fixing failing tests * removing setup tools from GHA unit_tests workflow * Modifying go class and adding back build addition to workflow * removing cast * changing value type field for SortedFeatureViewSortKeyModel * changing value type field for SortedFeatureViewSortKeyModel * modified ensure_valid method in SortedFeatureView * Added more changes based on PR comments
- Loading branch information
Showing
28 changed files
with
1,557 additions
and
55 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,76 @@ | ||
package model | ||
|
||
import ( | ||
"github.com/feast-dev/feast/go/protos/feast/core" | ||
"github.com/feast-dev/feast/go/protos/feast/types" | ||
) | ||
|
||
type SortOrder struct { | ||
Order core.SortOrder_Enum | ||
} | ||
|
||
func NewSortOrderFromProto(order core.SortOrder_Enum) *SortOrder { | ||
return &SortOrder{ | ||
Order: order, | ||
} | ||
} | ||
|
||
func (so *SortOrder) String() string { | ||
switch so.Order { | ||
case core.SortOrder_ASC: | ||
return "ASC" | ||
case core.SortOrder_DESC: | ||
return "DESC" | ||
default: | ||
return "INVALID" | ||
} | ||
} | ||
|
||
func (so *SortOrder) ToProto() core.SortOrder_Enum { | ||
return so.Order | ||
} | ||
|
||
type SortKey struct { | ||
FieldName string | ||
Order *SortOrder | ||
ValueType types.ValueType_Enum | ||
} | ||
|
||
func NewSortKeyFromProto(proto *core.SortKey) *SortKey { | ||
return &SortKey{ | ||
FieldName: proto.GetName(), | ||
Order: NewSortOrderFromProto(proto.GetDefaultSortOrder()), | ||
ValueType: proto.GetValueType(), | ||
} | ||
} | ||
|
||
type SortedFeatureView struct { | ||
*FeatureView | ||
SortKeys []*SortKey | ||
} | ||
|
||
func NewSortedFeatureViewFromProto(proto *core.SortedFeatureView) *SortedFeatureView { | ||
baseFV := &FeatureView{ | ||
Base: NewBaseFeatureView(proto.GetSpec().GetName(), proto.GetSpec().GetFeatures()), | ||
Ttl: proto.GetSpec().GetTtl(), | ||
} | ||
|
||
// Convert each sort key from the proto. | ||
sortKeys := make([]*SortKey, len(proto.GetSpec().GetSortKeys())) | ||
for i, skProto := range proto.GetSpec().GetSortKeys() { | ||
sortKeys[i] = NewSortKeyFromProto(skProto) | ||
} | ||
|
||
return &SortedFeatureView{ | ||
FeatureView: baseFV, | ||
SortKeys: sortKeys, | ||
} | ||
} | ||
|
||
func (sfv *SortedFeatureView) NewSortedFeatureViewFromBase(base *BaseFeatureView) *SortedFeatureView { | ||
newFV := sfv.FeatureView.NewFeatureViewFromBase(base) | ||
return &SortedFeatureView{ | ||
FeatureView: newFV, | ||
SortKeys: sfv.SortKeys, | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.