From 654182848f343993ffb499d6aa4170dbee188598 Mon Sep 17 00:00:00 2001 From: iamcodingcat Date: Fri, 5 Dec 2025 20:36:56 +0900 Subject: [PATCH] fix: validate not existing entity join keys for preventing panic --- go/internal/feast/onlineserving/serving.go | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/go/internal/feast/onlineserving/serving.go b/go/internal/feast/onlineserving/serving.go index 2ae733b62bb..f042939ec0f 100644 --- a/go/internal/feast/onlineserving/serving.go +++ b/go/internal/feast/onlineserving/serving.go @@ -272,7 +272,9 @@ func ValidateEntityValues(joinKeyValues map[string]*prototypes.RepeatedValue, requestData map[string]*prototypes.RepeatedValue, expectedJoinKeysSet map[string]interface{}) (int, error) { numRows := -1 - + if err := validateJoinKeys(joinKeyValues, expectedJoinKeysSet); err != nil { + return -1, errors.New("valueError: " + err.Error()) + } for joinKey, values := range joinKeyValues { if _, ok := expectedJoinKeysSet[joinKey]; !ok { requestData[joinKey] = values @@ -647,6 +649,17 @@ func getQualifiedFeatureName(viewName string, featureName string, fullFeatureNam } } +func validateJoinKeys( + joinKeyValues map[string]*prototypes.RepeatedValue, + expectedJoinKeysSet map[string]interface{}) error { + for joinKey, _ := range joinKeyValues { + if _, ok := expectedJoinKeysSet[joinKey]; !ok { + return fmt.Errorf("Invalid entity join key. key=%s", joinKey) + } + } + return nil +} + type featureNameCollisionError struct { featureRefCollisions []string fullFeatureNames bool