diff --git a/serving/src/main/java/feast/serving/service/RedisServingService.java b/serving/src/main/java/feast/serving/service/RedisServingService.java index 9f96139ac6..b298747c32 100644 --- a/serving/src/main/java/feast/serving/service/RedisServingService.java +++ b/serving/src/main/java/feast/serving/service/RedisServingService.java @@ -332,7 +332,7 @@ private List sendMultiGet(List keys) { .collect(Collectors.toList()) .toArray(new byte[0][0]); return syncCommands.mget(binaryKeys).stream() - .map(io.lettuce.core.Value::getValue) + .map(keyValue -> keyValue.getValueOrElse(null)) .collect(Collectors.toList()); } catch (Exception e) { throw Status.NOT_FOUND diff --git a/serving/src/test/java/feast/serving/service/RedisServingServiceTest.java b/serving/src/test/java/feast/serving/service/RedisServingServiceTest.java index 8446218cff..05a24d3fe6 100644 --- a/serving/src/test/java/feast/serving/service/RedisServingServiceTest.java +++ b/serving/src/test/java/feast/serving/service/RedisServingServiceTest.java @@ -377,39 +377,29 @@ public void shouldReturnResponseWithUnsetValuesIfKeysNotPresent() { .putFields("entity2", strValue("b"))) .build(); - List featureRows = - Lists.newArrayList( - FeatureRow.newBuilder() - .setEventTimestamp(Timestamp.newBuilder().setSeconds(100)) - .addAllFields( - Lists.newArrayList( - Field.newBuilder().setName("entity1").setValue(intValue(1)).build(), - Field.newBuilder().setName("entity2").setValue(strValue("a")).build(), - Field.newBuilder().setName("feature1").setValue(intValue(1)).build(), - Field.newBuilder().setName("feature2").setValue(intValue(1)).build())) - .setFeatureSet("featureSet:1") - .build(), - FeatureRow.newBuilder() - .setEventTimestamp(Timestamp.newBuilder()) - .addAllFields( - Lists.newArrayList( - Field.newBuilder().setName("entity1").setValue(intValue(2)).build(), - Field.newBuilder().setName("entity2").setValue(strValue("b")).build(), - Field.newBuilder().setName("feature1").build(), - Field.newBuilder().setName("feature2").build())) - .setFeatureSet("featureSet:1") - .build()); - FeatureSetRequest featureSetRequest = FeatureSetRequest.newBuilder() .addAllFeatureReferences(request.getFeaturesList()) .setSpec(getFeatureSetSpec()) .build(); + FeatureRow featureRowPresent = + FeatureRow.newBuilder() + .setEventTimestamp(Timestamp.newBuilder().setSeconds(100)) + .addAllFields( + Lists.newArrayList( + Field.newBuilder().setName("entity1").setValue(intValue(1)).build(), + Field.newBuilder().setName("entity2").setValue(strValue("a")).build(), + Field.newBuilder().setName("feature1").setValue(intValue(1)).build(), + Field.newBuilder().setName("feature2").setValue(intValue(1)).build())) + .setFeatureSet("featureSet:1") + .build(); + List> featureRowBytes = - featureRows.stream() - .map(x -> KeyValue.from(new byte[1], Optional.of(x.toByteArray()))) - .collect(Collectors.toList()); + Lists.newArrayList( + KeyValue.from(new byte[1], Optional.of(featureRowPresent.toByteArray())), + KeyValue.from(new byte[1], Optional.empty())); + when(specService.getFeatureSets(request.getFeaturesList())) .thenReturn(Collections.singletonList(featureSetRequest)); when(connection.sync()).thenReturn(syncCommands);