@@ -4,14 +4,15 @@ import (
44 "context"
55 "errors"
66 "fmt"
7+ "sort"
8+ "strings"
9+
710 "github.com/feast-dev/feast/go/protos/feast/serving"
811 "github.com/feast-dev/feast/go/protos/feast/types"
912 "google.golang.org/grpc/codes"
1013 "google.golang.org/grpc/status"
1114 "google.golang.org/protobuf/types/known/durationpb"
1215 "google.golang.org/protobuf/types/known/timestamppb"
13- "sort"
14- "strings"
1516)
1617
1718type FeatureStore struct {
@@ -92,7 +93,7 @@ func (fs *FeatureStore) GetOnlineFeatures(ctx context.Context, request *serving.
9293 return nil , err
9394 }
9495
95- fvs , requestedFeatureViews , requestedRequestFeatureViews , requestedOnDemandFeatureViews , err := fs .getFeatureViewsToUse (features , true , false )
96+ fvs , requestedFeatureViews , requestedRequestFeatureViews , requestedOnDemandFeatureViews , err := fs .getFeatureViewsToUse (features , false )
9697
9798 if len (requestedRequestFeatureViews )+ len (requestedOnDemandFeatureViews ) > 0 {
9899 return nil , status .Errorf (codes .InvalidArgument , "on demand feature views are currently not supported" )
@@ -253,22 +254,31 @@ func (fs *FeatureStore) getFeatureRefs(features *Features) ([]string, error) {
253254 retrieving all feature views. Similar argument to FeatureService applies.
254255
255256*/
256- func (fs * FeatureStore ) getFeatureViewsToUse (features * Features , allowCache , hideDummyEntity bool ) (map [string ]* FeatureView , map [* FeatureView ][]string , []* RequestFeatureView , []* OnDemandFeatureView , error ) {
257+ func (fs * FeatureStore ) getFeatureViewsToUse (features * Features , hideDummyEntity bool ) (map [string ]* FeatureView , map [* FeatureView ][]string , []* RequestFeatureView , []* OnDemandFeatureView , error ) {
257258 fvs := make (map [string ]* FeatureView )
258259 requestFvs := make (map [string ]* RequestFeatureView )
259260 odFvs := make (map [string ]* OnDemandFeatureView )
260261
261- featureViews := fs .listFeatureViews (allowCache , hideDummyEntity )
262+ featureViews , err := fs .listFeatureViews (hideDummyEntity )
263+ if err != nil {
264+ return nil , nil , nil , nil , err
265+ }
262266 for _ , featureView := range featureViews {
263267 fvs [featureView .base .name ] = featureView
264268 }
265269
266- requestFeatureViews := fs .registry .listRequestFeatureViews (fs .config .Project )
270+ requestFeatureViews , err := fs .registry .listRequestFeatureViews (fs .config .Project )
271+ if err != nil {
272+ return nil , nil , nil , nil , err
273+ }
267274 for _ , requestFeatureView := range requestFeatureViews {
268275 requestFvs [requestFeatureView .base .name ] = requestFeatureView
269276 }
270277
271- onDemandFeatureViews := fs .registry .listOnDemandFeatureViews (fs .config .Project )
278+ onDemandFeatureViews , err := fs .registry .listOnDemandFeatureViews (fs .config .Project )
279+ if err != nil {
280+ return nil , nil , nil , nil , err
281+ }
272282 for _ , onDemandFeatureView := range onDemandFeatureViews {
273283 odFvs [onDemandFeatureView .base .name ] = onDemandFeatureView
274284 }
@@ -347,7 +357,10 @@ func (fs *FeatureStore) getEntityMaps(requestedFeatureViews map[*FeatureView][]s
347357 var joinKeyMap map [string ]string
348358 var featureView * FeatureView
349359
350- entities := fs .listEntities (true , false )
360+ entities , err := fs .listEntities (false )
361+ if err != nil {
362+ return nil , err
363+ }
351364
352365 for _ , entity := range entities {
353366 entityNameToJoinKeyMap [entity .name ] = entity .joinKey
@@ -636,26 +649,31 @@ func (fs *FeatureStore) dropUnneededColumns(onlineFeaturesResponse *serving.GetO
636649 }
637650}
638651
639- func (fs * FeatureStore ) listFeatureViews (allowCache , hideDummyEntity bool ) []* FeatureView {
640- featureViews := fs .registry .listFeatureViews (fs .config .Project )
641- for _ , featureView := range featureViews {
642- if _ , ok := featureView .entities [DUMMY_ENTITY_NAME ]; ok && hideDummyEntity {
643- featureView .entities = make (map [string ]struct {})
644- }
652+ func (fs * FeatureStore ) listFeatureViews (hideDummyEntity bool ) ([]* FeatureView , error ) {
653+ featureViews , err := fs .registry .listFeatureViews (fs .config .Project )
654+ if err != nil {
655+ return featureViews , err
645656 }
646- return featureViews
657+ return featureViews , nil
658+ }
659+
660+ func (fs * FeatureStore ) listRequestFeatureViews () ([]* RequestFeatureView , error ) {
661+ return fs .registry .listRequestFeatureViews (fs .config .Project )
647662}
648663
649- func (fs * FeatureStore ) listEntities (allowCache , hideDummyEntity bool ) []* Entity {
664+ func (fs * FeatureStore ) listEntities (hideDummyEntity bool ) ( []* Entity , error ) {
650665
651- allEntities := fs .registry .listEntities (fs .config .Project )
666+ allEntities , err := fs .registry .listEntities (fs .config .Project )
667+ if err != nil {
668+ return allEntities , err
669+ }
652670 entities := make ([]* Entity , 0 )
653671 for _ , entity := range allEntities {
654672 if entity .name != DUMMY_ENTITY_NAME || ! hideDummyEntity {
655673 entities = append (entities , entity )
656674 }
657675 }
658- return entities
676+ return entities , nil
659677}
660678
661679func (fs * FeatureStore ) getFvEntityValues (fv * FeatureView ,
@@ -820,7 +838,7 @@ func (fs *FeatureStore) groupFeatureRefs(requestedFeatureViews map[*FeatureView]
820838 return fvFeatures , nil
821839}
822840
823- func (fs * FeatureStore ) getFeatureView (project , featureViewName string , allowCache , hideDummyEntity bool ) (* FeatureView , error ) {
841+ func (fs * FeatureStore ) getFeatureView (project , featureViewName string , hideDummyEntity bool ) (* FeatureView , error ) {
824842 fv , err := fs .registry .getFeatureView (fs .config .Project , featureViewName )
825843 if err != nil {
826844 return nil , err
0 commit comments