onlineserving

package
v0.37.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 17, 2024 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetEntityMaps

func GetEntityMaps(requestedFeatureViews []*FeatureViewAndRefs, entities []*model.Entity) (map[string]string, map[string]interface{}, error)

func GroupFeatureRefs

func GroupFeatureRefs(requestedFeatureViews []*FeatureViewAndRefs,
	joinKeyValues map[string]*prototypes.RepeatedValue,
	entityNameToJoinKeyMap map[string]string,
	fullFeatureNames bool,
) (map[string]*GroupedFeaturesPerEntitySet,
	error,
)

func ParseFeatureReference

func ParseFeatureReference(featureRef string) (featureViewName, featureName string, e error)

func ValidateEntityValues

func ValidateEntityValues(joinKeyValues map[string]*prototypes.RepeatedValue,
	requestData map[string]*prototypes.RepeatedValue,
	expectedJoinKeysSet map[string]interface{}) (int, error)

func ValidateFeatureRefs

func ValidateFeatureRefs(requestedFeatures []*FeatureViewAndRefs, fullFeatureNames bool) error

Types

type FeatureVector

type FeatureVector struct {
	Name       string
	Values     arrow.Array
	Statuses   []serving.FieldStatus
	Timestamps []*timestamppb.Timestamp
}

FeatureVector type represent result of retrieving single feature for multiple rows. It can be imagined as a column in output dataframe / table. It contains of feature name, list of values (across all rows), list of statuses and list of timestamp. All these lists have equal length. And this length is also equal to number of entity rows received in request.

func EntitiesToFeatureVectors

func EntitiesToFeatureVectors(entityColumns map[string]*prototypes.RepeatedValue, arrowAllocator memory.Allocator, numRows int) ([]*FeatureVector, error)

func KeepOnlyRequestedFeatures

func KeepOnlyRequestedFeatures(
	vectors []*FeatureVector,
	requestedFeatureRefs []string,
	featureService *model.FeatureService,
	fullFeatureNames bool) ([]*FeatureVector, error)

func TransposeFeatureRowsIntoColumns

func TransposeFeatureRowsIntoColumns(featureData2D [][]onlinestore.FeatureData,
	groupRef *GroupedFeaturesPerEntitySet,
	requestedFeatureViews []*FeatureViewAndRefs,
	arrowAllocator memory.Allocator,
	numRows int) ([]*FeatureVector, error)

type FeatureViewAndRefs

type FeatureViewAndRefs struct {
	View        *model.FeatureView
	FeatureRefs []string
}

func GetFeatureViewsToUseByFeatureRefs

func GetFeatureViewsToUseByFeatureRefs(
	features []string,
	featureViews map[string]*model.FeatureView,
	onDemandFeatureViews map[string]*model.OnDemandFeatureView) ([]*FeatureViewAndRefs, []*model.OnDemandFeatureView, error)

Return

(1) requested feature views and features grouped per View
(2) requested on demand feature views

existed in the registry

func GetFeatureViewsToUseByService

func GetFeatureViewsToUseByService(
	featureService *model.FeatureService,
	featureViews map[string]*model.FeatureView,
	onDemandFeatureViews map[string]*model.OnDemandFeatureView) ([]*FeatureViewAndRefs, []*model.OnDemandFeatureView, error)

Return

(1) requested feature views and features grouped per View
(2) requested on demand feature views

existed in the registry

type GroupedFeaturesPerEntitySet

type GroupedFeaturesPerEntitySet struct {
	// A list of requested feature references of the form featureViewName:featureName that share this entity set
	FeatureNames     []string
	FeatureViewNames []string
	// full feature references as they supposed to appear in response
	AliasedFeatureNames []string
	// Entity set as a list of EntityKeys to pass to OnlineRead
	EntityKeys []*prototypes.EntityKey
	// Reversed mapping to project result of retrieval from storage to response
	Indices [][]int
}

We group all features from a single request by entities they attached to. Thus, we will be able to call online retrieval per entity and not per each feature View. In this struct we collect all features and views that belongs to a group. We also store here projected entity keys (only ones that needed to retrieve these features) and indexes to map result of retrieval into output response.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL