Skip to content

Commit

Permalink
replace GetOnlineFeaturesResponse with GetOnlineFeaturesResponseV2 in… (
Browse files Browse the repository at this point in the history
#2214)

* replace GetOnlineFeaturesResponse with GetOnlineFeaturesResponseV2 in Python

Signed-off-by: Tsotne Tabidze <tsotne@tecton.ai>

* Fix unit tests

Signed-off-by: Tsotne Tabidze <tsotne@tecton.ai>

* Fix java compilation & python integration tests

Signed-off-by: Tsotne Tabidze <tsotne@tecton.ai>

* Fix integration tests

Signed-off-by: Tsotne Tabidze <tsotne@tecton.ai>
  • Loading branch information
Tsotne Tabidze authored Jan 14, 2022
1 parent 2a95629 commit 1b98ec9
Show file tree
Hide file tree
Showing 27 changed files with 361 additions and 522 deletions.
4 changes: 2 additions & 2 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,8 @@ require (
go.opencensus.io v0.22.3 // indirect
golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9 // indirect
golang.org/x/lint v0.0.0-20210508222113-6edffad5e616 // indirect
golang.org/x/net v0.0.0-20210805182204-aaa1db679c0d
golang.org/x/tools v0.1.7 // indirect
golang.org/x/net v0.0.0-20211015210444-4f30a5c0130f
golang.org/x/tools v0.1.8 // indirect
google.golang.org/genproto v0.0.0-20200526211855-cb27e3aa2013 // indirect
google.golang.org/grpc v1.29.1
google.golang.org/protobuf v1.27.1 // indirect
Expand Down
7 changes: 7 additions & 0 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -345,6 +345,7 @@ github.com/yuin/goldmark v1.1.25/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9de
github.com/yuin/goldmark v1.1.27/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74=
github.com/yuin/goldmark v1.2.1/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74=
github.com/yuin/goldmark v1.4.0/go.mod h1:mwnBkeHKe2W/ZEtQ+71ViKU8L12m81fl3OWwC1Zlc8k=
github.com/yuin/goldmark v1.4.1/go.mod h1:mwnBkeHKe2W/ZEtQ+71ViKU8L12m81fl3OWwC1Zlc8k=
go.etcd.io/bbolt v1.3.2/go.mod h1:IbVyRI1SCnLcuJnV2u8VeU0CEYM7e686BmAb1XKL+uU=
go.opencensus.io v0.21.0 h1:mU6zScU4U1YAFPHEHYk+3JC4SY7JxgkqS10ZOSyksNg=
go.opencensus.io v0.21.0/go.mod h1:mSImk1erAIZhrmZN+AvHh14ztQfjbGwt4TtuofqLduU=
Expand Down Expand Up @@ -386,6 +387,7 @@ golang.org/x/mod v0.1.1-0.20191105210325-c90efee705ee/go.mod h1:QqPTAvyqsEbceGzB
golang.org/x/mod v0.2.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA=
golang.org/x/mod v0.3.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA=
golang.org/x/mod v0.4.2/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA=
golang.org/x/mod v0.5.1/go.mod h1:5OXOZSfqPIIbmVBIIKWRFfZjPR0E5r58TLhUjH0a2Ro=
golang.org/x/net v0.0.0-20170114055629-f2499483f923/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
golang.org/x/net v0.0.0-20180724234803-3673e40ba225/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
golang.org/x/net v0.0.0-20180826012351-8a410e7b638d h1:g9qWBGx4puODJTMVyoPrpoxPFgVGd+z1DZwjfRu4d0I=
Expand Down Expand Up @@ -415,6 +417,7 @@ golang.org/x/net v0.0.0-20200513185701-a91f0712d120/go.mod h1:qpuaurCH72eLCgpAm/
golang.org/x/net v0.0.0-20200822124328-c89045814202/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA=
golang.org/x/net v0.0.0-20201021035429-f5854403a974/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU=
golang.org/x/net v0.0.0-20210805182204-aaa1db679c0d/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y=
golang.org/x/net v0.0.0-20211015210444-4f30a5c0130f/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y=
golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U=
golang.org/x/oauth2 v0.0.0-20190226205417-e64efc72b421/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw=
golang.org/x/oauth2 v0.0.0-20190402181905-9f3314589c9a/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw=
Expand Down Expand Up @@ -454,6 +457,7 @@ golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7w
golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20210423082822-04245dca01da/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20210809222454-d867a43fc93e/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.0.0-20211019181941-9d821ace8654/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo=
golang.org/x/text v0.0.0-20160726164857-2910a502d2bf/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
golang.org/x/text v0.3.0 h1:g61tztE5qeGQ89tm6NTjjM9VPIm088od1l6aSorWRWg=
Expand All @@ -464,6 +468,7 @@ golang.org/x/text v0.3.2 h1:tW2bmiBqwgJj/UpqtC8EpXEZVYOwU0yG4iWbprSVAcs=
golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk=
golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ=
golang.org/x/time v0.0.0-20161028155119-f51c12702a4d/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ=
golang.org/x/time v0.0.0-20181108054448-85acf8d2951c/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ=
golang.org/x/time v0.0.0-20190308202827-9d24e82272b4/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ=
Expand Down Expand Up @@ -525,6 +530,8 @@ golang.org/x/tools v0.0.0-20201124005743-911501bfb504 h1:jOKV2ysikH1GANB7t2Lotmh
golang.org/x/tools v0.0.0-20201124005743-911501bfb504/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA=
golang.org/x/tools v0.1.7 h1:6j8CgantCy3yc8JGBqkDLMKWqZ0RDU2g1HVgacojGWQ=
golang.org/x/tools v0.1.7/go.mod h1:LGqMHiF4EqQNHR1JncWGqT5BVaXmza+X+BDGol+dOxo=
golang.org/x/tools v0.1.8 h1:P1HhGGuLW4aAclzjtmJdf0mJOjVUZUzOTqkAkWL+l6w=
golang.org/x/tools v0.1.8/go.mod h1:nABZi5QlRsZVlzPpHl034qft6wpY4eDcsTt5AaioBiU=
golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543 h1:E7g+9GITq07hpfrRu66IVDexMakfv52eLZ2CXBWiKr4=
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,12 @@

import com.google.gson.JsonObject;
import com.google.gson.JsonParser;
import com.google.protobuf.Timestamp;
import feast.common.logging.entry.LogResource.ResourceType;
import feast.proto.serving.ServingAPIProto;
import feast.proto.serving.ServingAPIProto.FeatureReferenceV2;
import feast.proto.serving.ServingAPIProto.GetOnlineFeaturesRequestV2;
import feast.proto.serving.ServingAPIProto.GetOnlineFeaturesResponse;
import feast.proto.serving.ServingAPIProto.GetOnlineFeaturesResponse.FieldValues;
import feast.proto.types.ValueProto.Value;
import io.grpc.Status;
import java.util.Arrays;
Expand All @@ -50,15 +51,24 @@ public List<AuditLogEntry> getTestAuditLogs() {

GetOnlineFeaturesResponse responseSpec =
GetOnlineFeaturesResponse.newBuilder()
.addAllFieldValues(
.setMetadata(
ServingAPIProto.GetOnlineFeaturesResponseMetadata.newBuilder()
.setFeatureNames(
ServingAPIProto.FeatureList.newBuilder()
.addAllVal(
Arrays.asList(
"featuretable_1:feature_1", "featuretable_1:feature2"))))
.addAllResults(
Arrays.asList(
FieldValues.newBuilder()
.putFields(
"featuretable_1:feature_1", Value.newBuilder().setInt32Val(32).build())
GetOnlineFeaturesResponse.FeatureVector.newBuilder()
.addValues(Value.newBuilder().setInt32Val(32).build())
.addStatuses(ServingAPIProto.FieldStatus.PRESENT)
.addEventTimestamps(Timestamp.newBuilder().build())
.build(),
FieldValues.newBuilder()
.putFields(
"featuretable_1:feature2", Value.newBuilder().setInt32Val(64).build())
GetOnlineFeaturesResponse.FeatureVector.newBuilder()
.addValues(Value.newBuilder().setInt32Val(64).build())
.addStatuses(ServingAPIProto.FieldStatus.PRESENT)
.addEventTimestamps(Timestamp.newBuilder().build())
.build()))
.build();

Expand Down
4 changes: 2 additions & 2 deletions java/sdk/java/src/main/java/dev/feast/FeastClient.java
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
import feast.proto.serving.ServingAPIProto.GetFeastServingInfoRequest;
import feast.proto.serving.ServingAPIProto.GetFeastServingInfoResponse;
import feast.proto.serving.ServingAPIProto.GetOnlineFeaturesRequest;
import feast.proto.serving.ServingAPIProto.GetOnlineFeaturesResponseV2;
import feast.proto.serving.ServingAPIProto.GetOnlineFeaturesResponse;
import feast.proto.serving.ServingServiceGrpc;
import feast.proto.serving.ServingServiceGrpc.ServingServiceBlockingStub;
import feast.proto.types.ValueProto;
Expand Down Expand Up @@ -129,7 +129,7 @@ public List<Row> getOnlineFeatures(List<String> featureRefs, List<Row> entities)

requestBuilder.putAllEntities(getEntityValuesMap(entities));

GetOnlineFeaturesResponseV2 response = stub.getOnlineFeatures(requestBuilder.build());
GetOnlineFeaturesResponse response = stub.getOnlineFeatures(requestBuilder.build());

List<Row> results = Lists.newArrayList();
if (response.getResultsCount() == 0) {
Expand Down
14 changes: 7 additions & 7 deletions java/sdk/java/src/test/java/dev/feast/FeastClientTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
import feast.proto.serving.ServingAPIProto;
import feast.proto.serving.ServingAPIProto.FieldStatus;
import feast.proto.serving.ServingAPIProto.GetOnlineFeaturesRequest;
import feast.proto.serving.ServingAPIProto.GetOnlineFeaturesResponseV2;
import feast.proto.serving.ServingAPIProto.GetOnlineFeaturesResponse;
import feast.proto.serving.ServingServiceGrpc.ServingServiceImplBase;
import feast.proto.types.ValueProto;
import feast.proto.types.ValueProto.Value;
Expand Down Expand Up @@ -57,7 +57,7 @@ public class FeastClientTest {
@Override
public void getOnlineFeatures(
GetOnlineFeaturesRequest request,
StreamObserver<GetOnlineFeaturesResponseV2> responseObserver) {
StreamObserver<GetOnlineFeaturesResponse> responseObserver) {
if (!request.equals(FeastClientTest.getFakeRequest())) {
responseObserver.onError(Status.FAILED_PRECONDITION.asRuntimeException());
}
Expand Down Expand Up @@ -137,22 +137,22 @@ private static GetOnlineFeaturesRequest getFakeRequest() {
.build();
}

private static GetOnlineFeaturesResponseV2 getFakeResponse() {
return GetOnlineFeaturesResponseV2.newBuilder()
private static GetOnlineFeaturesResponse getFakeResponse() {
return GetOnlineFeaturesResponse.newBuilder()
.addResults(
GetOnlineFeaturesResponseV2.FeatureVector.newBuilder()
GetOnlineFeaturesResponse.FeatureVector.newBuilder()
.addValues(strValue("david"))
.addStatuses(FieldStatus.PRESENT)
.addEventTimestamps(Timestamp.newBuilder())
.build())
.addResults(
GetOnlineFeaturesResponseV2.FeatureVector.newBuilder()
GetOnlineFeaturesResponse.FeatureVector.newBuilder()
.addValues(intValue(3))
.addStatuses(FieldStatus.PRESENT)
.addEventTimestamps(Timestamp.newBuilder())
.build())
.addResults(
GetOnlineFeaturesResponseV2.FeatureVector.newBuilder()
GetOnlineFeaturesResponse.FeatureVector.newBuilder()
.addValues(Value.newBuilder().build())
.addStatuses(FieldStatus.NULL_VALUE)
.addEventTimestamps(Timestamp.newBuilder())
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,12 +60,12 @@ public void getFeastServingInfo(
@Override
public void getOnlineFeatures(
ServingAPIProto.GetOnlineFeaturesRequest request,
StreamObserver<ServingAPIProto.GetOnlineFeaturesResponseV2> responseObserver) {
StreamObserver<ServingAPIProto.GetOnlineFeaturesResponse> responseObserver) {
try {
// authorize for the project in request object.
RequestHelper.validateOnlineRequest(request);
Span span = tracer.buildSpan("getOnlineFeaturesV2").start();
ServingAPIProto.GetOnlineFeaturesResponseV2 onlineFeatures =
ServingAPIProto.GetOnlineFeaturesResponse onlineFeatures =
servingServiceV2.getOnlineFeatures(request);
if (span != null) {
span.finish();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ public GetFeastServingInfoResponse getInfo() {
public List<Map<String, Object>> getOnlineFeatures(
@RequestBody ServingAPIProto.GetOnlineFeaturesRequest request) {
RequestHelper.validateOnlineRequest(request);
ServingAPIProto.GetOnlineFeaturesResponseV2 onlineFeatures =
ServingAPIProto.GetOnlineFeaturesResponse onlineFeatures =
servingService.getOnlineFeatures(request);
return mapGetOnlineFeaturesResponse(onlineFeatures);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ public void getFeastServingInfo(
@Override
public void getOnlineFeatures(
ServingAPIProto.GetOnlineFeaturesRequest request,
StreamObserver<ServingAPIProto.GetOnlineFeaturesResponseV2> responseObserver) {
StreamObserver<ServingAPIProto.GetOnlineFeaturesResponse> responseObserver) {
responseObserver.onNext(this.servingServiceV2.getOnlineFeatures(request));
responseObserver.onCompleted();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ public GetFeastServingInfoResponse getFeastServingInfo(
}

@Override
public ServingAPIProto.GetOnlineFeaturesResponseV2 getOnlineFeatures(
public ServingAPIProto.GetOnlineFeaturesResponse getOnlineFeatures(
ServingAPIProto.GetOnlineFeaturesRequest request) {
// Split all feature references into non-ODFV (e.g. batch and stream) references and ODFV.
List<FeatureReferenceV2> allFeatureReferences = getFeaturesList(request);
Expand Down Expand Up @@ -132,8 +132,8 @@ public ServingAPIProto.GetOnlineFeaturesResponseV2 getOnlineFeatures(

Span postProcessingSpan = tracer.buildSpan("postProcessing").start();

ServingAPIProto.GetOnlineFeaturesResponseV2.Builder responseBuilder =
ServingAPIProto.GetOnlineFeaturesResponseV2.newBuilder();
ServingAPIProto.GetOnlineFeaturesResponse.Builder responseBuilder =
ServingAPIProto.GetOnlineFeaturesResponse.newBuilder();

Timestamp now = Timestamp.newBuilder().setSeconds(System.currentTimeMillis() / 1000).build();
Timestamp nullTimestamp = Timestamp.newBuilder().build();
Expand All @@ -147,7 +147,7 @@ public ServingAPIProto.GetOnlineFeaturesResponseV2 getOnlineFeatures(

Duration maxAge = this.registryRepository.getMaxAge(featureReference);

ServingAPIProto.GetOnlineFeaturesResponseV2.FeatureVector.Builder vectorBuilder =
ServingAPIProto.GetOnlineFeaturesResponse.FeatureVector.Builder vectorBuilder =
responseBuilder.addResultsBuilder();

for (int rowIdx = 0; rowIdx < features.size(); rowIdx++) {
Expand Down Expand Up @@ -262,7 +262,7 @@ private void populateOnDemandFeatures(
List<FeatureReferenceV2> retrievedFeatureReferences,
ServingAPIProto.GetOnlineFeaturesRequest request,
List<List<feast.storage.api.retriever.Feature>> features,
ServingAPIProto.GetOnlineFeaturesResponseV2.Builder responseBuilder) {
ServingAPIProto.GetOnlineFeaturesResponse.Builder responseBuilder) {

List<Pair<String, List<ValueProto.Value>>> onDemandContext =
request.getRequestContextMap().entrySet().stream()
Expand Down Expand Up @@ -383,7 +383,7 @@ private void populateHistogramMetrics(
*/
private void populateCountMetrics(
FeatureReferenceV2 featureRef,
ServingAPIProto.GetOnlineFeaturesResponseV2.FeatureVectorOrBuilder featureVector) {
ServingAPIProto.GetOnlineFeaturesResponse.FeatureVectorOrBuilder featureVector) {
String featureRefString = Feature.getFeatureReference(featureRef);
featureVector
.getStatusesList()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,7 @@ public void processTransformFeaturesResponse(
transformFeaturesResponse,
String onDemandFeatureViewName,
Set<String> onDemandFeatureStringReferences,
ServingAPIProto.GetOnlineFeaturesResponseV2.Builder responseBuilder) {
ServingAPIProto.GetOnlineFeaturesResponse.Builder responseBuilder) {
try {
BufferAllocator allocator = new RootAllocator(Long.MAX_VALUE);
ArrowFileReader reader =
Expand Down Expand Up @@ -219,7 +219,7 @@ public void processTransformFeaturesResponse(

FieldVector fieldVector = readBatch.getVector(field);
int valueCount = fieldVector.getValueCount();
ServingAPIProto.GetOnlineFeaturesResponseV2.FeatureVector.Builder vectorBuilder =
ServingAPIProto.GetOnlineFeaturesResponse.FeatureVector.Builder vectorBuilder =
responseBuilder.addResultsBuilder();
List<ValueProto.Value> valueList = Lists.newArrayListWithExpectedSize(valueCount);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,9 @@ ServingAPIProto.GetFeastServingInfoResponse getFeastServingInfo(
*
* <p>This request is fulfilled synchronously.
*
* @return {@link feast.proto.serving.ServingAPIProto.GetOnlineFeaturesResponseV2} with list of
* {@link feast.proto.serving.ServingAPIProto.GetOnlineFeaturesResponseV2.FeatureVector}.
* @return {@link feast.proto.serving.ServingAPIProto.GetOnlineFeaturesResponse} with list of
* {@link feast.proto.serving.ServingAPIProto.GetOnlineFeaturesResponse.FeatureVector}.
*/
ServingAPIProto.GetOnlineFeaturesResponseV2 getOnlineFeatures(
ServingAPIProto.GetOnlineFeaturesResponse getOnlineFeatures(
ServingAPIProto.GetOnlineFeaturesRequest getFeaturesRequest);
}
Original file line number Diff line number Diff line change
Expand Up @@ -66,13 +66,13 @@ public interface TransformationService {
* @param transformFeaturesResponse response to be processed
* @param onDemandFeatureViewName name of ODFV to which the response corresponds
* @param onDemandFeatureStringReferences set of all ODFV references that should be kept
* @param responseBuilder {@link ServingAPIProto.GetOnlineFeaturesResponseV2.Builder}
* @param responseBuilder {@link ServingAPIProto.GetOnlineFeaturesResponse.Builder}
*/
void processTransformFeaturesResponse(
TransformFeaturesResponse transformFeaturesResponse,
String onDemandFeatureViewName,
Set<String> onDemandFeatureStringReferences,
ServingAPIProto.GetOnlineFeaturesResponseV2.Builder responseBuilder);
ServingAPIProto.GetOnlineFeaturesResponse.Builder responseBuilder);

/**
* Serialize data into Arrow IPC format, to be sent to the Python feature transformation server.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,14 +26,14 @@
public class ResponseJSONMapper {

public static List<Map<String, Object>> mapGetOnlineFeaturesResponse(
ServingAPIProto.GetOnlineFeaturesResponseV2 response) {
ServingAPIProto.GetOnlineFeaturesResponse response) {
return response.getResultsList().stream()
.map(fieldValues -> convertFieldValuesToMap(fieldValues))
.collect(Collectors.toList());
}

private static Map<String, Object> convertFieldValuesToMap(
ServingAPIProto.GetOnlineFeaturesResponseV2.FeatureVector vec) {
ServingAPIProto.GetOnlineFeaturesResponse.FeatureVector vec) {
return Map.of(
"values",
vec.getValuesList().stream()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ private static RegistryProto.Registry readLocalRegistry() {

@Test
public void shouldGetOnlineFeatures() {
ServingAPIProto.GetOnlineFeaturesResponseV2 featureResponse =
ServingAPIProto.GetOnlineFeaturesResponse featureResponse =
servingStub.getOnlineFeatures(buildOnlineRequest(1005));

assertEquals(2, featureResponse.getResultsCount());
Expand All @@ -96,7 +96,7 @@ public void shouldGetOnlineFeatures() {

@Test
public void shouldGetOnlineFeaturesWithOutsideMaxAgeStatus() {
ServingAPIProto.GetOnlineFeaturesResponseV2 featureResponse =
ServingAPIProto.GetOnlineFeaturesResponse featureResponse =
servingStub.getOnlineFeatures(buildOnlineRequest(1001));

assertEquals(2, featureResponse.getResultsCount());
Expand All @@ -113,7 +113,7 @@ public void shouldGetOnlineFeaturesWithOutsideMaxAgeStatus() {

@Test
public void shouldGetOnlineFeaturesWithNotFoundStatus() {
ServingAPIProto.GetOnlineFeaturesResponseV2 featureResponse =
ServingAPIProto.GetOnlineFeaturesResponse featureResponse =
servingStub.getOnlineFeatures(buildOnlineRequest(-1));

assertEquals(2, featureResponse.getResultsCount());
Expand Down
Loading

0 comments on commit 1b98ec9

Please sign in to comment.