Skip to content

Commit 4f49da3

Browse files
committed
Update deps and proto files
Signed-off-by: Michal Deutch <mdeutch@salesforce.com>
1 parent 8df14e4 commit 4f49da3

5 files changed

Lines changed: 17 additions & 38 deletions

File tree

sdk/java/src/main/java/com/gojek/feast/core/CoreClient.java

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@ public Optional<Entity> getEntity(String project, String name) {
107107
CoreServiceProto.GetEntityRequest.Builder request =
108108
CoreServiceProto.GetEntityRequest.newBuilder().setProject(project).setName(name);
109109
CoreServiceProto.GetEntityResponse response = stub.getEntity(request.build());
110-
Entity entity = response.hasEntity() ? new Entity(response.getEntity()) : null;
110+
Entity entity = response.hasEntity() ? new Entity(project, response.getEntity()) : null;
111111
return Optional.ofNullable(entity);
112112
}
113113

@@ -124,7 +124,7 @@ public Optional<Entity> apply(Entity.Spec entitySpec) {
124124
.setProject(entitySpec.getProject())
125125
.setSpec(entitySpec.toProto());
126126
CoreServiceProto.ApplyEntityResponse response = stub.applyEntity(request.build());
127-
Entity entity = response.hasEntity() ? new Entity(response.getEntity()) : null;
127+
Entity entity = response.hasEntity() ? new Entity(entitySpec.getProject(), response.getEntity()) : null;
128128
return Optional.ofNullable(entity);
129129
}
130130

@@ -153,7 +153,7 @@ public List<Entity> listEntities(String project, Map<String, String> labels) {
153153
CoreServiceProto.ListEntitiesRequest request =
154154
CoreServiceProto.ListEntitiesRequest.newBuilder().setFilter(filter).build();
155155
List<EntityProto.Entity> entities = stub.listEntities(request).getEntitiesList();
156-
return entities.stream().map(Entity::new).collect(Collectors.toList());
156+
return entities.stream().map(proto -> new Entity(project, proto)).collect(Collectors.toList());
157157
}
158158

159159
/**
@@ -167,7 +167,7 @@ public Optional<FeatureTable> getFeatureTable(String project, String name) {
167167
CoreServiceProto.GetFeatureTableRequest.Builder request =
168168
CoreServiceProto.GetFeatureTableRequest.newBuilder().setProject(project).setName(name);
169169
CoreServiceProto.GetFeatureTableResponse response = stub.getFeatureTable(request.build());
170-
FeatureTable featureTable = response.hasTable() ? new FeatureTable(response.getTable()) : null;
170+
FeatureTable featureTable = response.hasTable() ? new FeatureTable(project, response.getTable()) : null;
171171
return Optional.ofNullable(featureTable);
172172
}
173173

@@ -184,7 +184,7 @@ public Optional<FeatureTable> apply(FeatureTable.Spec featureTableSpec) {
184184
.setProject(featureTableSpec.getProject())
185185
.setTableSpec(featureTableSpec.toProto());
186186
CoreServiceProto.ApplyFeatureTableResponse response = stub.applyFeatureTable(request.build());
187-
FeatureTable featureTable = response.hasTable() ? new FeatureTable(response.getTable()) : null;
187+
FeatureTable featureTable = response.hasTable() ? new FeatureTable(featureTableSpec.getProject(), response.getTable()) : null;
188188
return Optional.ofNullable(featureTable);
189189
}
190190

@@ -213,7 +213,7 @@ public List<FeatureTable> listFeatureTables(String project, Map<String, String>
213213
CoreServiceProto.ListFeatureTablesRequest.newBuilder().setFilter(filter).build();
214214
List<FeatureTableProto.FeatureTable> featureTables =
215215
stub.listFeatureTables(request).getTablesList();
216-
return featureTables.stream().map(FeatureTable::new).collect(Collectors.toList());
216+
return featureTables.stream().map(proto -> new FeatureTable(project, proto)).collect(Collectors.toList());
217217
}
218218

219219
/**

sdk/java/src/main/java/com/gojek/feast/core/Entity.java

Lines changed: 5 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -29,21 +29,18 @@ public static class Spec {
2929
private final String project;
3030
private final ValueType value;
3131
private final String description;
32-
private final String joinKey;
3332
private final Map<String, String> labels;
3433

3534
protected Spec(
3635
String project,
3736
String name,
3837
ValueType value,
3938
String description,
40-
String joinKey,
4139
Map<String, String> labels) {
4240
this.name = name;
4341
this.project = project;
4442
this.value = value;
4543
this.description = description;
46-
this.joinKey = joinKey;
4744
this.labels = labels;
4845
}
4946

@@ -56,7 +53,6 @@ public static class Builder {
5653
private final String project;
5754
private ValueType value;
5855
private String description;
59-
private String joinKey;
6056
private final Map<String, String> labels = new HashMap<>();
6157

6258
private Builder(String project, String name) {
@@ -74,11 +70,6 @@ public Builder setDescription(String description) {
7470
return this;
7571
}
7672

77-
public Builder setJoinKey(String joinKey) {
78-
this.joinKey = joinKey;
79-
return this;
80-
}
81-
8273
public Builder addLabel(String key, String val) {
8374
this.labels.put(key, val);
8475
return this;
@@ -90,7 +81,7 @@ public Builder addLabels(Map<String, String> labels) {
9081
}
9182

9283
public Spec build() {
93-
return new Spec(project, name, value, description, joinKey, labels);
84+
return new Spec(project, name, value, description, labels);
9485
}
9586
}
9687

@@ -110,30 +101,23 @@ public String getDescription() {
110101
return description;
111102
}
112103

113-
public String getJoinKey() {
114-
return joinKey;
115-
}
116-
117104
public Map<String, String> getLabels() {
118105
return labels;
119106
}
120107

121-
protected Spec(EntityProto.EntitySpecV2 spec) {
108+
protected Spec(String project, EntityProto.EntitySpecV2 spec) {
109+
this.project = project;
122110
this.name = spec.getName();
123-
this.project = spec.getProject();
124111
this.value = ValueType.fromProto(spec.getValueType());
125112
this.description = spec.getDescription();
126-
this.joinKey = spec.getJoinKey();
127113
this.labels = spec.getLabelsMap();
128114
}
129115

130116
protected EntityProto.EntitySpecV2 toProto() {
131117
return EntityProto.EntitySpecV2.newBuilder()
132118
.setName(name)
133-
.setProject(project)
134119
.setValueType(value.toProto())
135120
.setDescription(description)
136-
.setJoinKey(joinKey)
137121
.putAllLabels(labels)
138122
.build();
139123
}
@@ -147,8 +131,8 @@ public Metadata getMetadata() {
147131
return metadata;
148132
}
149133

150-
protected Entity(EntityProto.Entity entity) {
151-
if (entity.hasSpec()) this.spec = new Spec(entity.getSpec());
134+
protected Entity(String project, EntityProto.Entity entity) {
135+
if (entity.hasSpec()) this.spec = new Spec(project, entity.getSpec());
152136
if (entity.hasMeta()) this.metadata = new Metadata(entity.getMeta());
153137
}
154138

sdk/java/src/main/java/com/gojek/feast/core/FeatureTable.java

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -138,8 +138,8 @@ public Optional<Duration> getMaxAge() {
138138
return Optional.ofNullable(maxAge);
139139
}
140140

141-
protected Spec(FeatureTableProto.FeatureTableSpec spec) {
142-
this.project = spec.getProject();
141+
protected Spec(String project, FeatureTableProto.FeatureTableSpec spec) {
142+
this.project = project;
143143
this.name = spec.getName();
144144
this.entities = spec.getEntitiesList();
145145
this.features =
@@ -153,7 +153,6 @@ protected Spec(FeatureTableProto.FeatureTableSpec spec) {
153153
protected FeatureTableProto.FeatureTableSpec toProto() {
154154
FeatureTableProto.FeatureTableSpec.Builder builder =
155155
FeatureTableProto.FeatureTableSpec.newBuilder()
156-
.setProject(project)
157156
.setName(name)
158157
.addAllEntities(entities)
159158
.addAllFeatures(features.stream().map(Feature::toProto).collect(Collectors.toList()))
@@ -177,8 +176,8 @@ public Metadata getMetadata() {
177176
return metadata;
178177
}
179178

180-
protected FeatureTable(FeatureTableProto.FeatureTable featureTable) {
181-
if (featureTable.hasSpec()) this.spec = new Spec(featureTable.getSpec());
179+
protected FeatureTable(String project, FeatureTableProto.FeatureTable featureTable) {
180+
if (featureTable.hasSpec()) this.spec = new Spec(project, featureTable.getSpec());
182181
if (featureTable.hasMeta()) this.metadata = new Metadata(featureTable.getMeta());
183182
}
184183

sdk/java/src/test/java/com/gojek/feast/core/CoreClientTest.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,6 @@ public void testEntity() {
5757
Entity.Spec.getBuilder(CoreServiceImplMock.PROJECT, name)
5858
.setValue(ValueType.BOOL)
5959
.setDescription("description")
60-
.setJoinKey("joinKey")
6160
.build();
6261
client.apply(spec);
6362
Assertions.assertEquals(

sdk/java/src/test/java/com/gojek/feast/core/ProtobufSerializationTest.java

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -50,13 +50,11 @@ public void testEntity() {
5050
.setSpec(
5151
EntityProto.EntitySpecV2.newBuilder()
5252
.setName("name")
53-
.setProject("project")
5453
.setDescription("description")
5554
.setValueType(ValueProto.ValueType.Enum.BOOL_LIST)
56-
.setJoinKey("joinKey")
5755
.putLabels("key", "val"))
5856
.build();
59-
Entity entity = new Entity(protoEntity);
57+
Entity entity = new Entity("project", protoEntity);
6058
Assert.assertEquals(protoEntity, entity.toProto());
6159
}
6260

@@ -83,13 +81,12 @@ public void testFeatureTable() {
8381
.setSpec(
8482
FeatureTableProto.FeatureTableSpec.newBuilder()
8583
.setName("name")
86-
.setProject("project")
8784
.setMaxAge(Duration.newBuilder().setSeconds(10).setNanos(10))
8885
.addEntities("entity")
8986
.putLabels("key", "val")
9087
.addFeatures(FeatureProto.FeatureSpecV2.getDefaultInstance()))
9188
.build();
92-
FeatureTable featureTable = new FeatureTable(featureTableProto);
89+
FeatureTable featureTable = new FeatureTable("project", featureTableProto);
9390
Assert.assertEquals(featureTableProto, featureTable.toProto());
9491
}
9592
}

0 commit comments

Comments
 (0)