From 7b1e82053341360c758faa79f54a60561a5af05d Mon Sep 17 00:00:00 2001 From: Ches Martin Date: Thu, 21 May 2020 12:17:45 +0700 Subject: [PATCH 1/2] Make storage modules target Java 8, since Ingestion must With the addition of the Storage APIs and connector implementations, we did not specify that their build should target Java 8 bytecode. Because Ingestion depends on them, we regressed on keeping Ingestion compatible with Java 8 runtimes according to #518. This could be confirmed prior to this change with, for example: $ mvn -pl ingestion clean compile $ javap -v storage/connectors/redis/target/classes/feast/storage/connectors/redis/writer/RedisCustomIO.class | grep major major version: 55 I take this as proof that a blacklist approach with 11 as the default in our root POM is error prone, so this change flips it so that 8 is default and our leaf applications that are able use 11 opt into it in whitelist fashion. --- core/pom.xml | 8 +++++ datatypes/java/pom.xml | 9 ----- ingestion/pom.xml | 34 ++++++++++++++----- pom.xml | 3 +- sdk/java/pom.xml | 8 +++++ serving/pom.xml | 8 +++++ .../redis/writer/RedisCustomIO.java | 6 ++-- .../retriever/RedisOnlineRetrieverTest.java | 8 ++--- .../writer/RedisClusterCustomIO.java | 6 ++-- .../RedisClusterOnlineRetrieverTest.java | 10 +++--- 10 files changed, 69 insertions(+), 31 deletions(-) diff --git a/core/pom.xml b/core/pom.xml index 2f616d5ed41..c4679df5f59 100644 --- a/core/pom.xml +++ b/core/pom.xml @@ -32,6 +32,14 @@ + + org.apache.maven.plugins + maven-compiler-plugin + + 11 + + + org.jacoco jacoco-maven-plugin diff --git a/datatypes/java/pom.xml b/datatypes/java/pom.xml index a127853258e..5810a6db96a 100644 --- a/datatypes/java/pom.xml +++ b/datatypes/java/pom.xml @@ -37,15 +37,6 @@ - - org.apache.maven.plugins - maven-compiler-plugin - - - 8 - - - org.apache.maven.plugins maven-dependency-plugin diff --git a/ingestion/pom.xml b/ingestion/pom.xml index a62d4202ee0..a004c6d9df6 100644 --- a/ingestion/pom.xml +++ b/ingestion/pom.xml @@ -31,15 +31,6 @@ - - org.apache.maven.plugins - maven-compiler-plugin - - - 8 - - - org.apache.maven.plugins maven-shade-plugin @@ -84,6 +75,31 @@ + + org.apache.maven.plugins + maven-enforcer-plugin + + + + enforce-bytecode-version + + enforce + + + + + 1.8 + + + + + + + org.jacoco jacoco-maven-plugin diff --git a/pom.xml b/pom.xml index 018a101adb9..3f4cece4034 100644 --- a/pom.xml +++ b/pom.xml @@ -411,7 +411,8 @@ org.apache.maven.plugins maven-compiler-plugin - 11 + + 8 diff --git a/sdk/java/pom.xml b/sdk/java/pom.xml index 75d82edcc01..3fa2c22435d 100644 --- a/sdk/java/pom.xml +++ b/sdk/java/pom.xml @@ -85,6 +85,14 @@ + + org.apache.maven.plugins + maven-compiler-plugin + + 11 + + + org.apache.maven.plugins diff --git a/serving/pom.xml b/serving/pom.xml index 3754777da07..ce4ee6f49c3 100644 --- a/serving/pom.xml +++ b/serving/pom.xml @@ -40,6 +40,14 @@ + + org.apache.maven.plugins + maven-compiler-plugin + + 11 + + + org.jacoco jacoco-maven-plugin diff --git a/storage/connectors/redis/src/main/java/feast/storage/connectors/redis/writer/RedisCustomIO.java b/storage/connectors/redis/src/main/java/feast/storage/connectors/redis/writer/RedisCustomIO.java index 3fe9148eed5..eeac5b3d964 100644 --- a/storage/connectors/redis/src/main/java/feast/storage/connectors/redis/writer/RedisCustomIO.java +++ b/storage/connectors/redis/src/main/java/feast/storage/connectors/redis/writer/RedisCustomIO.java @@ -54,8 +54,10 @@ public class RedisCustomIO { private static final int DEFAULT_BATCH_SIZE = 1000; private static final int DEFAULT_TIMEOUT = 2000; - private static TupleTag successfulInsertsTag = new TupleTag<>("successfulInserts") {}; - private static TupleTag failedInsertsTupleTag = new TupleTag<>("failedInserts") {}; + private static TupleTag successfulInsertsTag = + new TupleTag("successfulInserts") {}; + private static TupleTag failedInsertsTupleTag = + new TupleTag("failedInserts") {}; private static final Logger log = LoggerFactory.getLogger(RedisCustomIO.class); diff --git a/storage/connectors/redis/src/test/java/feast/storage/connectors/redis/retriever/RedisOnlineRetrieverTest.java b/storage/connectors/redis/src/test/java/feast/storage/connectors/redis/retriever/RedisOnlineRetrieverTest.java index 4ab2ac9e130..adacacb941e 100644 --- a/storage/connectors/redis/src/test/java/feast/storage/connectors/redis/retriever/RedisOnlineRetrieverTest.java +++ b/storage/connectors/redis/src/test/java/feast/storage/connectors/redis/retriever/RedisOnlineRetrieverTest.java @@ -133,7 +133,7 @@ public void shouldReturnResponseWithValuesIfKeysPresent() { when(syncCommands.mget(redisKeyList)).thenReturn(featureRowBytes); List> expected = - List.of( + ImmutableList.of( Lists.newArrayList( FeatureRow.newBuilder() .setEventTimestamp(Timestamp.newBuilder().setSeconds(100)) @@ -153,7 +153,7 @@ public void shouldReturnResponseWithValuesIfKeysPresent() { .build())); List> actual = - redisOnlineRetriever.getOnlineFeatures(entityRows, List.of(featureSetRequest)); + redisOnlineRetriever.getOnlineFeatures(entityRows, ImmutableList.of(featureSetRequest)); assertThat(actual, equalTo(expected)); } @@ -201,7 +201,7 @@ public void shouldReturnResponseWithUnsetValuesIfKeysNotPresent() { when(syncCommands.mget(redisKeyList)).thenReturn(featureRowBytes); List> expected = - List.of( + ImmutableList.of( Lists.newArrayList( FeatureRow.newBuilder() .setEventTimestamp(Timestamp.newBuilder().setSeconds(100)) @@ -220,7 +220,7 @@ public void shouldReturnResponseWithUnsetValuesIfKeysNotPresent() { .build())); List> actual = - redisOnlineRetriever.getOnlineFeatures(entityRows, List.of(featureSetRequest)); + redisOnlineRetriever.getOnlineFeatures(entityRows, ImmutableList.of(featureSetRequest)); assertThat(actual, equalTo(expected)); } diff --git a/storage/connectors/rediscluster/src/main/java/feast/storage/connectors/rediscluster/writer/RedisClusterCustomIO.java b/storage/connectors/rediscluster/src/main/java/feast/storage/connectors/rediscluster/writer/RedisClusterCustomIO.java index 8984dc877cd..712012a2fb7 100644 --- a/storage/connectors/rediscluster/src/main/java/feast/storage/connectors/rediscluster/writer/RedisClusterCustomIO.java +++ b/storage/connectors/rediscluster/src/main/java/feast/storage/connectors/rediscluster/writer/RedisClusterCustomIO.java @@ -54,8 +54,10 @@ public class RedisClusterCustomIO { private static final int DEFAULT_BATCH_SIZE = 1000; private static final int DEFAULT_TIMEOUT = 2000; - private static TupleTag successfulInsertsTag = new TupleTag<>("successfulInserts") {}; - private static TupleTag failedInsertsTupleTag = new TupleTag<>("failedInserts") {}; + private static TupleTag successfulInsertsTag = + new TupleTag("successfulInserts") {}; + private static TupleTag failedInsertsTupleTag = + new TupleTag("failedInserts") {}; private static final Logger log = LoggerFactory.getLogger(RedisClusterCustomIO.class); diff --git a/storage/connectors/rediscluster/src/test/java/feast/storage/connectors/rediscluster/retriever/RedisClusterOnlineRetrieverTest.java b/storage/connectors/rediscluster/src/test/java/feast/storage/connectors/rediscluster/retriever/RedisClusterOnlineRetrieverTest.java index 16ab7962d60..deed53e1ae8 100644 --- a/storage/connectors/rediscluster/src/test/java/feast/storage/connectors/rediscluster/retriever/RedisClusterOnlineRetrieverTest.java +++ b/storage/connectors/rediscluster/src/test/java/feast/storage/connectors/rediscluster/retriever/RedisClusterOnlineRetrieverTest.java @@ -133,7 +133,7 @@ public void shouldReturnResponseWithValuesIfKeysPresent() { when(syncCommands.mget(redisKeyList)).thenReturn(featureRowBytes); List> expected = - List.of( + ImmutableList.of( Lists.newArrayList( FeatureRow.newBuilder() .setEventTimestamp(Timestamp.newBuilder().setSeconds(100)) @@ -153,7 +153,8 @@ public void shouldReturnResponseWithValuesIfKeysPresent() { .build())); List> actual = - redisClusterOnlineRetriever.getOnlineFeatures(entityRows, List.of(featureSetRequest)); + redisClusterOnlineRetriever.getOnlineFeatures( + entityRows, ImmutableList.of(featureSetRequest)); assertThat(actual, equalTo(expected)); } @@ -201,7 +202,7 @@ public void shouldReturnResponseWithUnsetValuesIfKeysNotPresent() { when(syncCommands.mget(redisKeyList)).thenReturn(featureRowBytes); List> expected = - List.of( + ImmutableList.of( Lists.newArrayList( FeatureRow.newBuilder() .setEventTimestamp(Timestamp.newBuilder().setSeconds(100)) @@ -220,7 +221,8 @@ public void shouldReturnResponseWithUnsetValuesIfKeysNotPresent() { .build())); List> actual = - redisClusterOnlineRetriever.getOnlineFeatures(entityRows, List.of(featureSetRequest)); + redisClusterOnlineRetriever.getOnlineFeatures( + entityRows, ImmutableList.of(featureSetRequest)); assertThat(actual, equalTo(expected)); } From 2e0c16ab3a07cb84c4a3ba21bf663fbe4123e251 Mon Sep 17 00:00:00 2001 From: Ches Martin Date: Thu, 21 May 2020 23:22:09 +0700 Subject: [PATCH 2/2] Target Java 8 compatibility for Java SDK --- sdk/java/pom.xml | 8 -------- .../src/test/java/com/gojek/feast/RequestUtilTest.java | 3 ++- 2 files changed, 2 insertions(+), 9 deletions(-) diff --git a/sdk/java/pom.xml b/sdk/java/pom.xml index 3fa2c22435d..75d82edcc01 100644 --- a/sdk/java/pom.xml +++ b/sdk/java/pom.xml @@ -85,14 +85,6 @@ - - org.apache.maven.plugins - maven-compiler-plugin - - 11 - - - org.apache.maven.plugins diff --git a/sdk/java/src/test/java/com/gojek/feast/RequestUtilTest.java b/sdk/java/src/test/java/com/gojek/feast/RequestUtilTest.java index f10d82b8726..60643115558 100644 --- a/sdk/java/src/test/java/com/gojek/feast/RequestUtilTest.java +++ b/sdk/java/src/test/java/com/gojek/feast/RequestUtilTest.java @@ -19,6 +19,7 @@ import static org.junit.jupiter.api.Assertions.assertEquals; import static org.junit.jupiter.api.Assertions.assertThrows; +import com.google.common.collect.ImmutableList; import com.google.protobuf.TextFormat; import feast.proto.serving.ServingAPIProto.FeatureReference; import java.util.Arrays; @@ -82,7 +83,7 @@ void renderFeatureRef_ShouldReturnFeatureRefString( } private static Stream provideInvalidFeatureRefs() { - return Stream.of(Arguments.of(List.of("project/feature", ""))); + return Stream.of(Arguments.of(ImmutableList.of("project/feature", ""))); } @ParameterizedTest