MCPcopy
hub / github.com/feast-dev/feast / ValidateEntityValues

Function ValidateEntityValues

go/internal/feast/onlineserving/serving.go:274–299  ·  view source on GitHub ↗
(joinKeyValues map[string]*prototypes.RepeatedValue,
	requestData map[string]*prototypes.RepeatedValue,
	expectedJoinKeysSet map[string]interface{})

Source from the content-addressed store, hash-verified

272}
273
274func ValidateEntityValues(joinKeyValues map[string]*prototypes.RepeatedValue,
275 requestData map[string]*prototypes.RepeatedValue,
276 expectedJoinKeysSet map[string]interface{}) (int, error) {
277 numRows := -1
278 if err := validateJoinKeys(joinKeyValues, expectedJoinKeysSet); err != nil {
279 return -1, errors.New("valueError: " + err.Error())
280 }
281 for joinKey, values := range joinKeyValues {
282 if _, ok := expectedJoinKeysSet[joinKey]; !ok {
283 requestData[joinKey] = values
284 delete(joinKeyValues, joinKey)
285 // ToDo: when request data will be passed correctly (not as part of entity rows)
286 // ToDo: throw this error instead
287 // return 0, fmt.Errorf("JoinKey is not expected in this request: %s\n%v", JoinKey, expectedJoinKeysSet)
288 } else {
289 if numRows < 0 {
290 numRows = len(values.Val)
291 } else if len(values.Val) != numRows {
292 return -1, errors.New("valueError: All entity rows must have the same columns")
293 }
294
295 }
296 }
297
298 return numRows, nil
299}
300
301func ValidateFeatureRefs(requestedFeatures []*FeatureViewAndRefs, fullFeatureNames bool) error {
302 featureRefCounter := make(map[string]int)

Callers 1

GetOnlineFeaturesMethod · 0.92

Calls 3

validateJoinKeysFunction · 0.85
deleteFunction · 0.85
ErrorMethod · 0.45

Tested by

no test coverage detected