@@ -10,13 +10,13 @@ var (
1010 // ErrInvalidFeatureRef indicates that the user has provided a feature reference
1111 // with the wrong structure or contents
1212 ErrInvalidFeatureRef = "Invalid Feature Reference %s provided, " +
13- "feature reference must be in the format [featureset:]name "
13+ "feature reference must be in the format featureTableName:featureName "
1414)
1515
16- // OnlineFeaturesRequest wrapper on feast.serving.GetOnlineFeaturesRequest .
16+ // OnlineFeaturesRequest wrapper on feast.serving.GetOnlineFeaturesRequestV2 .
1717type OnlineFeaturesRequest struct {
1818 // Features is the list of features to obtain from Feast. Each feature can be given as
19- // the format feature_set :feature, where "feature_set " & "feature" are feature set name
19+ // the format feature_table :feature, where "feature_table " & "feature" are feature table name
2020 // and feature name respectively. The only required components is feature name.
2121 Features []string
2222
@@ -26,41 +26,37 @@ type OnlineFeaturesRequest struct {
2626 // Project optionally specifies the project override. If specified, uses given project for retrieval.
2727 // Overrides the projects specified in Feature References if also specified.
2828 Project string
29-
30- // whether to omit the entities fields in the response.
31- OmitEntities bool
3229}
3330
3431// Builds the feast-specified request payload from the wrapper.
35- func (r OnlineFeaturesRequest ) buildRequest () (* serving.GetOnlineFeaturesRequest , error ) {
32+ func (r OnlineFeaturesRequest ) buildRequest () (* serving.GetOnlineFeaturesRequestV2 , error ) {
3633 featureRefs , err := buildFeatureRefs (r .Features )
3734 if err != nil {
3835 return nil , err
3936 }
4037
4138 // build request entity rows from native entities
42- entityRows := make ([]* serving.GetOnlineFeaturesRequest_EntityRow , len (r .Entities ))
39+ entityRows := make ([]* serving.GetOnlineFeaturesRequestV2_EntityRow , len (r .Entities ))
4340 for i , entity := range r .Entities {
44- entityRows [i ] = & serving.GetOnlineFeaturesRequest_EntityRow {
41+ entityRows [i ] = & serving.GetOnlineFeaturesRequestV2_EntityRow {
4542 Fields : entity ,
4643 }
4744 }
4845
49- return & serving.GetOnlineFeaturesRequest {
50- Features : featureRefs ,
51- EntityRows : entityRows ,
52- OmitEntitiesInResponse : r .OmitEntities ,
53- Project : r .Project ,
46+ return & serving.GetOnlineFeaturesRequestV2 {
47+ Features : featureRefs ,
48+ EntityRows : entityRows ,
49+ Project : r .Project ,
5450 }, nil
5551}
5652
5753// Creates a slice of FeatureReferences from string representation in
58- // the format featureset :feature.
54+ // the format featuretable :feature.
5955// featureRefStrs - string feature references to parse.
6056// Returns parsed FeatureReferences.
6157// Returns an error when the format of the string feature reference is invalid
62- func buildFeatureRefs (featureRefStrs []string ) ([]* serving.FeatureReference , error ) {
63- var featureRefs []* serving.FeatureReference
58+ func buildFeatureRefs (featureRefStrs []string ) ([]* serving.FeatureReferenceV2 , error ) {
59+ var featureRefs []* serving.FeatureReferenceV2
6460
6561 for _ , featureRefStr := range featureRefStrs {
6662 featureRef , err := parseFeatureRef (featureRefStr )
@@ -76,35 +72,21 @@ func buildFeatureRefs(featureRefStrs []string) ([]*serving.FeatureReference, err
7672// featureRefStr - the string feature reference to parse.
7773// Returns parsed FeatureReference.
7874// Returns an error when the format of the string feature reference is invalid
79- func parseFeatureRef (featureRefStr string ) (* serving.FeatureReference , error ) {
75+ func parseFeatureRef (featureRefStr string ) (* serving.FeatureReferenceV2 , error ) {
8076 if len (featureRefStr ) == 0 {
8177 return nil , fmt .Errorf (ErrInvalidFeatureRef , featureRefStr )
8278 }
8379
84- var featureRef serving.FeatureReference
85- if strings .Contains (featureRefStr , "/" ) {
80+ var featureRef serving.FeatureReferenceV2
81+ if strings .Contains (featureRefStr , "/" ) || ! strings . Contains ( featureRefStr , ":" ) {
8682 return nil , fmt .Errorf (ErrInvalidFeatureRef , featureRefStr )
8783 }
88- // parse featureset if specified
84+ // parse featuretable if specified
8985 if strings .Contains (featureRefStr , ":" ) {
9086 refSplit := strings .Split (featureRefStr , ":" )
91- featureRef .FeatureSet , featureRefStr = refSplit [0 ], refSplit [1 ]
87+ featureRef .FeatureTable , featureRefStr = refSplit [0 ], refSplit [1 ]
9288 }
9389 featureRef .Name = featureRefStr
9490
9591 return & featureRef , nil
9692}
97-
98- // Converts a FeatureReference proto into a string
99- // featureRef - The FeatureReference to render as string
100- // Returns string representation of the given FeatureReference
101- func toFeatureRefStr (featureRef * serving.FeatureReference ) string {
102- refStr := ""
103- // In protov3, unset string and default to ""
104- if len (featureRef .FeatureSet ) > 0 {
105- refStr += featureRef .FeatureSet + ":"
106- }
107- refStr += featureRef .Name
108-
109- return refStr
110- }
0 commit comments