4242import feast .proto .serving .ServingAPIProto ;
4343import feast .proto .serving .ServingServiceGrpc ;
4444import feast .proto .types .ValueProto ;
45- import feast .serving .config .ServingServiceConfigV2 ;
4645import io .grpc .ManagedChannel ;
4746import io .grpc .ManagedChannelBuilder ;
4847import java .io .ByteArrayOutputStream ;
@@ -129,7 +128,6 @@ static void globalSetup() throws IOException {
129128 String projectName = "default" ;
130129 // Apply Entity (driver_id)
131130 String driverEntityName = "driver_id" ;
132- ValueProto .Value driverEntityValue = ValueProto .Value .newBuilder ().setInt64Val (1 ).build ();
133131 String driverEntityDescription = "My driver id" ;
134132 ValueProto .ValueType .Enum driverEntityType = ValueProto .ValueType .Enum .INT64 ;
135133 EntityProto .EntitySpecV2 driverEntitySpec =
@@ -142,7 +140,6 @@ static void globalSetup() throws IOException {
142140
143141 // Apply Entity (merchant_id)
144142 String merchantEntityName = "merchant_id" ;
145- ValueProto .Value merchantEntityValue = ValueProto .Value .newBuilder ().setInt64Val (1 ).build ();
146143 String merchantEntityDescription = "My driver id" ;
147144 ValueProto .ValueType .Enum merchantEntityType = ValueProto .ValueType .Enum .INT64 ;
148145 EntityProto .EntitySpecV2 merchantEntitySpec =
@@ -194,10 +191,10 @@ static void globalSetup() throws IOException {
194191 SchemaBuilder .record ("DriverData" )
195192 .namespace (featureTableName )
196193 .fields ()
197- .requiredInt ("trip_cost" )
198- .requiredDouble ("trip_distance" )
199- .requiredDouble ( "trip_empty " )
200- .requiredString ("trip_wrong_type" )
194+ .requiredInt (feature1Reference . getName () )
195+ .requiredDouble (feature2Reference . getName () )
196+ .nullableString ( feature3Reference . getName (), "null " )
197+ .requiredString (feature4Reference . getName () )
201198 .endRecord ();
202199 byte [] schemaReference =
203200 Hashing .murmur3_32 ().hashBytes (ftSchema .toString ().getBytes ()).asBytes ();
@@ -207,7 +204,7 @@ static void globalSetup() throws IOException {
207204 new GenericRecordBuilder (ftSchema )
208205 .set ("trip_cost" , 5 )
209206 .set ("trip_distance" , 3.5 )
210- .set ("trip_empty" , 3.5 )
207+ .set ("trip_empty" , null )
211208 .set ("trip_wrong_type" , "test" )
212209 .build ();
213210 byte [] avroSerializedFeatures = recordToAvro (record , ftSchema );
@@ -267,7 +264,7 @@ static void globalSetup() throws IOException {
267264 @ AfterAll
268265 static void tearDown () {
269266 ((ManagedChannel ) servingStub .getChannel ()).shutdown ();
270- // channel.shutdown();
267+ channel .shutdown ();
271268 }
272269
273270 private static void createTable (
@@ -294,12 +291,9 @@ private static void createTable(
294291 }
295292
296293 private static byte [] recordToAvro (GenericRecord datum , Schema schema ) throws IOException {
297- // DatumReader<Object> reader = new GenericDatumReader<>(schema);
298294 GenericDatumWriter <Object > writer = new GenericDatumWriter <>(schema );
299295 ByteArrayOutputStream output = new ByteArrayOutputStream ();
300- // Decoder decoder = DecoderFactory.get().jsonDecoder(schema, json);
301296 Encoder encoder = EncoderFactory .get ().binaryEncoder (output , null );
302- // Object datum = reader.read(null, decoder);
303297 writer .write (datum , encoder );
304298 encoder .flush ();
305299
@@ -338,11 +332,9 @@ public void shouldRegisterAndGetOnlineFeaturesWithNotFound() {
338332 DataGenerator .createFeatureReference ("rides" , "trip_cost" );
339333 ServingAPIProto .FeatureReferenceV2 notFoundFeatureReference =
340334 DataGenerator .createFeatureReference ("rides" , "trip_transaction" );
341- ServingAPIProto .FeatureReferenceV2 emptyFeatureReference =
342- DataGenerator .createFeatureReference ("rides" , "trip_empty" );
343335
344336 ImmutableList <ServingAPIProto .FeatureReferenceV2 > featureReferences =
345- ImmutableList .of (featureReference , notFoundFeatureReference , emptyFeatureReference );
337+ ImmutableList .of (featureReference , notFoundFeatureReference );
346338
347339 // Build GetOnlineFeaturesRequestV2
348340 ServingAPIProto .GetOnlineFeaturesRequestV2 onlineFeatureRequest =
@@ -355,10 +347,8 @@ public void shouldRegisterAndGetOnlineFeaturesWithNotFound() {
355347 entityName ,
356348 entityValue ,
357349 FeatureV2 .getFeatureStringRef (featureReference ),
358- DataGenerator .createInt64Value (42 ),
350+ DataGenerator .createInt64Value (5 ),
359351 FeatureV2 .getFeatureStringRef (notFoundFeatureReference ),
360- DataGenerator .createEmptyValue (),
361- FeatureV2 .getFeatureStringRef (emptyFeatureReference ),
362352 DataGenerator .createEmptyValue ());
363353
364354 ImmutableMap <String , ServingAPIProto .GetOnlineFeaturesResponse .FieldStatus > expectedStatusMap =
@@ -368,9 +358,7 @@ public void shouldRegisterAndGetOnlineFeaturesWithNotFound() {
368358 FeatureV2 .getFeatureStringRef (featureReference ),
369359 ServingAPIProto .GetOnlineFeaturesResponse .FieldStatus .PRESENT ,
370360 FeatureV2 .getFeatureStringRef (notFoundFeatureReference ),
371- ServingAPIProto .GetOnlineFeaturesResponse .FieldStatus .NOT_FOUND ,
372- FeatureV2 .getFeatureStringRef (emptyFeatureReference ),
373- ServingAPIProto .GetOnlineFeaturesResponse .FieldStatus .NULL_VALUE );
361+ ServingAPIProto .GetOnlineFeaturesResponse .FieldStatus .NOT_FOUND );
374362
375363 ServingAPIProto .GetOnlineFeaturesResponse .FieldValues expectedFieldValues =
376364 ServingAPIProto .GetOnlineFeaturesResponse .FieldValues .newBuilder ()
@@ -384,7 +372,7 @@ public void shouldRegisterAndGetOnlineFeaturesWithNotFound() {
384372 }
385373
386374 @ TestConfiguration
387- public static class TestConfig extends ServingServiceConfigV2 {
375+ public static class TestConfig {
388376 @ Bean
389377 public BigtableDataClient bigtableClient () throws IOException {
390378 return BigtableDataClient .create (
0 commit comments