From 7735ae92e722e2b95e686d43fa9d9b79c440909b Mon Sep 17 00:00:00 2001 From: Zhu Zhanyan Date: Wed, 20 May 2020 12:49:48 +0800 Subject: [PATCH 1/5] Fix nil error cause by adding items to a nil map in go SDK's client.GetOnlineFeatures() --- sdk/go/client.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sdk/go/client.go b/sdk/go/client.go index 38c9e2fb7e5..4f17c07cbe2 100644 --- a/sdk/go/client.go +++ b/sdk/go/client.go @@ -52,7 +52,7 @@ func (fc *GrpcClient) GetOnlineFeatures(ctx context.Context, req *OnlineFeatures resp, err := fc.cli.GetOnlineFeatures(ctx, featuresRequest) // collect unqiue entity refs from entity rows - var entityRefs map[string]struct{} + entityRefs := make(map[string]struct{}) for _, entityRows := range req.Entities { for ref, _ := range entityRows { entityRefs[ref] = struct{}{} @@ -61,7 +61,7 @@ func (fc *GrpcClient) GetOnlineFeatures(ctx context.Context, req *OnlineFeatures // strip projects from to projects for _, fieldValue := range resp.GetFieldValues() { - var stripFields map[string]*types.Value + stripFields := make(map[string]*types.Value) for refStr, value := range fieldValue.Fields { _, isEntity := entityRefs[refStr] if !isEntity { // is feature ref From 6d40047553dbc1954a46a9b12ccf8f5e5d5cfaf0 Mon Sep 17 00:00:00 2001 From: Zhu Zhanyan Date: Wed, 20 May 2020 17:44:04 +0800 Subject: [PATCH 2/5] Fix issue where go sdk client.GetOnlineFeatures() does not return entity values --- sdk/go/client.go | 2 ++ sdk/go/types.go | 4 ++-- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/sdk/go/client.go b/sdk/go/client.go index 4f17c07cbe2..0ac654dfa01 100644 --- a/sdk/go/client.go +++ b/sdk/go/client.go @@ -71,6 +71,8 @@ func (fc *GrpcClient) GetOnlineFeatures(ctx context.Context, req *OnlineFeatures } stripRefStr := toFeatureRefStr(featureRef) stripFields[stripRefStr] = value + } else { + stripFields[refStr] = value } } fieldValue.Fields = stripFields diff --git a/sdk/go/types.go b/sdk/go/types.go index 7fe400e45bb..dd6553163bd 100644 --- a/sdk/go/types.go +++ b/sdk/go/types.go @@ -21,12 +21,12 @@ func (r Row) equalTo(other Row) bool { return true } -// StrVal is a int64 type feast value +// StrVal is a string type feast value func StrVal(val string) *types.Value { return &types.Value{Val: &types.Value_StringVal{StringVal: val}} } -// Int32Val is a int64 type feast value +// Int32Val is a int32 type feast value func Int32Val(val int32) *types.Value { return &types.Value{Val: &types.Value_Int32Val{Int32Val: val}} } From 67e23ca7f54b2cc269e05ac612d11cd2b3cde05f Mon Sep 17 00:00:00 2001 From: Zhu Zhanyan Date: Wed, 20 May 2020 17:51:51 +0800 Subject: [PATCH 3/5] Fixed issue where Row is unable to parse Value type due to proto package rename. --- sdk/go/client.go | 6 ++---- sdk/java/src/main/java/com/gojek/feast/FeastClient.java | 9 +++++---- sdk/java/src/main/java/com/gojek/feast/Row.java | 2 +- 3 files changed, 8 insertions(+), 9 deletions(-) diff --git a/sdk/go/client.go b/sdk/go/client.go index 0ac654dfa01..ef8ec8b8cf9 100644 --- a/sdk/go/client.go +++ b/sdk/go/client.go @@ -69,11 +69,9 @@ func (fc *GrpcClient) GetOnlineFeatures(ctx context.Context, req *OnlineFeatures if err != nil { return nil, err } - stripRefStr := toFeatureRefStr(featureRef) - stripFields[stripRefStr] = value - } else { - stripFields[refStr] = value + refStr = toFeatureRefStr(featureRef) } + stripFields[refStr] = value } fieldValue.Fields = stripFields } diff --git a/sdk/java/src/main/java/com/gojek/feast/FeastClient.java b/sdk/java/src/main/java/com/gojek/feast/FeastClient.java index c6e7edd0764..4ec9e0599e0 100644 --- a/sdk/java/src/main/java/com/gojek/feast/FeastClient.java +++ b/sdk/java/src/main/java/com/gojek/feast/FeastClient.java @@ -23,6 +23,7 @@ import feast.proto.serving.ServingAPIProto.GetOnlineFeaturesRequest.EntityRow; import feast.proto.serving.ServingAPIProto.GetOnlineFeaturesResponse; import feast.proto.serving.ServingServiceGrpc; +import feast.proto.serving.ServingServiceGrpc.ServingServiceBlockingStub; import feast.proto.types.ValueProto.Value; import io.grpc.ManagedChannel; import io.grpc.ManagedChannelBuilder; @@ -39,8 +40,8 @@ public class FeastClient implements AutoCloseable { private static final int CHANNEL_SHUTDOWN_TIMEOUT_SEC = 5; - private final ManagedChannel channel; - private final ServingServiceGrpc.ServingServiceBlockingStub stub; + private ManagedChannel channel; + private ServingServiceBlockingStub stub; /** * Create a client to access Feast @@ -161,9 +162,9 @@ public List getOnlineFeatures( .collect(Collectors.toList()); } - private FeastClient(ManagedChannel channel) { + protected FeastClient(ManagedChannel channel) { this.channel = channel; - stub = ServingServiceGrpc.newBlockingStub(channel); + this.stub = ServingServiceGrpc.newBlockingStub(channel); } public void close() throws Exception { diff --git a/sdk/java/src/main/java/com/gojek/feast/Row.java b/sdk/java/src/main/java/com/gojek/feast/Row.java index 2ac2581cac9..4a3035f8f19 100644 --- a/sdk/java/src/main/java/com/gojek/feast/Row.java +++ b/sdk/java/src/main/java/com/gojek/feast/Row.java @@ -76,7 +76,7 @@ public Row set(String fieldName, Object value) { fields.put( fieldName, Value.newBuilder().setBytesVal(ByteString.copyFrom((byte[]) value)).build()); break; - case "feast.types.ValueProto.Value": + case "feast.proto.types.ValueProto.Value": fields.put(fieldName, (Value) value); break; default: From 638c017bb86f2685ac1e44b382ae62a4ad979b36 Mon Sep 17 00:00:00 2001 From: Zhu Zhanyan Date: Wed, 20 May 2020 18:31:32 +0800 Subject: [PATCH 4/5] Fix wrong path of test_feature python SDK test. --- sdk/python/{feast => tests}/test_feature.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) rename sdk/python/{feast => tests}/test_feature.py (92%) diff --git a/sdk/python/feast/test_feature.py b/sdk/python/tests/test_feature.py similarity index 92% rename from sdk/python/feast/test_feature.py rename to sdk/python/tests/test_feature.py index a4f0ff58ff2..bc83683e0fe 100644 --- a/sdk/python/feast/test_feature.py +++ b/sdk/python/tests/test_feature.py @@ -17,7 +17,7 @@ class TestFeatureRef: def test_str_ref(self): - original_ref = FeatureRef(project="test", name="test") + original_ref = FeatureRef(feature_set="test", name="test") ref_str = repr(original_ref) parsed_ref = FeatureRef.from_str(ref_str) assert original_ref == parsed_ref From 7212162455c0e3e195c5773b38f11f45aa2952ff Mon Sep 17 00:00:00 2001 From: Zhu Zhanyan Date: Thu, 21 May 2020 17:12:59 +0800 Subject: [PATCH 5/5] Revert stub and channel private fields to final in FeastClient java SDK --- sdk/java/src/main/java/com/gojek/feast/FeastClient.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sdk/java/src/main/java/com/gojek/feast/FeastClient.java b/sdk/java/src/main/java/com/gojek/feast/FeastClient.java index 4ec9e0599e0..a81fdab21a2 100644 --- a/sdk/java/src/main/java/com/gojek/feast/FeastClient.java +++ b/sdk/java/src/main/java/com/gojek/feast/FeastClient.java @@ -40,8 +40,8 @@ public class FeastClient implements AutoCloseable { private static final int CHANNEL_SHUTDOWN_TIMEOUT_SEC = 5; - private ManagedChannel channel; - private ServingServiceBlockingStub stub; + private final ManagedChannel channel; + private final ServingServiceBlockingStub stub; /** * Create a client to access Feast