Skip to content

Commit

Permalink
[FLINK-6982] [guava] Integrate flink-shaded-guava-18
Browse files Browse the repository at this point in the history
This closes apache#4503.
  • Loading branch information
zentol committed Aug 14, 2017
1 parent e30eb13 commit 8dfb9d0
Show file tree
Hide file tree
Showing 97 changed files with 302 additions and 163 deletions.
31 changes: 31 additions & 0 deletions flink-connectors/flink-connector-elasticsearch2/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -91,4 +91,35 @@ under the License.

</dependencies>

<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-shade-plugin</artifactId>
<executions>
<execution>
<id>shade-flink</id>
<configuration>
<artifactSet>
<includes>
<include>com.google.guava:guava</include>
</includes>
</artifactSet>
<relocations>
<relocation>
<pattern>com.google</pattern>
<shadedPattern>org.apache.flink.elasticsearch.shaded.com.google</shadedPattern>
<excludes>
<exclude>com.google.protobuf.**</exclude>
<exclude>com.google.inject.**</exclude>
</excludes>
</relocation>
</relocations>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>

</project>
Original file line number Diff line number Diff line change
Expand Up @@ -45,13 +45,13 @@
import org.apache.flink.test.util.SuccessException;
import org.apache.flink.util.Preconditions;

import com.google.common.collect.ImmutableSet;
import org.apache.kafka.clients.consumer.ConsumerRecord;
import org.junit.Test;

import java.io.Serializable;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
Expand Down Expand Up @@ -285,7 +285,7 @@ public int partition(Integer record, byte[] key, byte[] value, String targetTopi
properties,
topic,
partition,
ImmutableSet.copyOf(getIntegersSequence(BrokerRestartingMapper.numElementsBeforeSnapshot)),
Collections.unmodifiableSet(new HashSet<>(getIntegersSequence(BrokerRestartingMapper.numElementsBeforeSnapshot))),
30000L);

deleteTestTopic(topic);
Expand Down
11 changes: 11 additions & 0 deletions flink-connectors/flink-connector-twitter/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -77,12 +77,23 @@ under the License.
<artifactSet>
<includes combine.children="append">
<!-- We include all dependencies that transitively depend on guava -->
<include>com.google.guava:guava</include>
<include>com.twitter:hbc-core</include>
<include>com.twitter:joauth</include>
<include>org.apache.httpcomponents:httpclient</include>
<include>org.apache.httpcomponents:httpcore</include>
</includes>
</artifactSet>
<relocations>
<relocation>
<pattern>com.google</pattern>
<shadedPattern>org.apache.flink.twitter.shaded.com.google</shadedPattern>
<excludes>
<exclude>com.google.protobuf.**</exclude>
<exclude>com.google.inject.**</exclude>
</excludes>
</relocation>
</relocations>
<transformers>
<transformer implementation="org.apache.maven.plugins.shade.resource.ApacheNoticeResourceTransformer"/>
</transformers>
Expand Down
8 changes: 0 additions & 8 deletions flink-connectors/flink-hbase/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -127,14 +127,6 @@ under the License.
<artifactId>flink-streaming-java_${scala.binary.version}</artifactId>
<version>${project.version}</version>
<scope>provided</scope>

<!--Exclude Guava in order to run the HBaseMiniCluster during testing-->
<exclusions>
<exclusion>
<groupId>com.google.guava</groupId>
<artifactId>guava</artifactId>
</exclusion>
</exclusions>
</dependency>

<!-- HBase server needed for TableOutputFormat -->
Expand Down
26 changes: 26 additions & 0 deletions flink-connectors/flink-hcatalog/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,32 @@ under the License.

<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-shade-plugin</artifactId>
<executions>
<execution>
<id>shade-flink</id>
<configuration>
<artifactSet>
<includes>
<include>com.google.guava:guava</include>
</includes>
</artifactSet>
<relocations>
<relocation>
<pattern>com.google</pattern>
<shadedPattern>org.apache.flink.hcatalog.shaded.com.google</shadedPattern>
<excludes>
<exclude>com.google.protobuf.**</exclude>
<exclude>com.google.inject.**</exclude>
</excludes>
</relocation>
</relocations>
</configuration>
</execution>
</executions>
</plugin>
<!-- Scala Compiler -->
<plugin>
<groupId>net.alchim31.maven</groupId>
Expand Down
5 changes: 5 additions & 0 deletions flink-contrib/flink-storm-examples/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,11 @@ under the License.

<!-- test dependencies -->

<dependency>
<groupId>org.apache.flink</groupId>
<artifactId>flink-shaded-guava</artifactId>
</dependency>

<dependency>
<groupId>org.apache.flink</groupId>
<artifactId>flink-test-utils_${scala.binary.version}</artifactId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@

import org.apache.flink.streaming.util.StreamingProgramTestBase;

import com.google.common.base.Joiner;
import org.apache.flink.shaded.guava18.com.google.common.base.Joiner;

/**
* Test for the SingleJoin example.
Expand Down
9 changes: 4 additions & 5 deletions flink-libraries/flink-cep/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -52,11 +52,10 @@ under the License.
<scope>provided</scope>
</dependency>

<dependency>
<groupId>com.google.guava</groupId>
<artifactId>guava</artifactId>
<version>${guava.version}</version>
</dependency>
<dependency>
<groupId>org.apache.flink</groupId>
<artifactId>flink-shaded-guava</artifactId>
</dependency>

<!-- test dependencies -->

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,8 @@
import org.apache.flink.streaming.api.windowing.time.Time;
import org.apache.flink.util.Preconditions;

import com.google.common.base.Predicate;
import com.google.common.collect.Iterators;
import org.apache.flink.shaded.guava18.com.google.common.base.Predicate;
import org.apache.flink.shaded.guava18.com.google.common.collect.Iterators;

import javax.annotation.Nullable;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,8 @@
import org.apache.flink.cep.pattern.conditions.NotCondition;
import org.apache.flink.streaming.api.windowing.time.Time;

import com.google.common.base.Predicate;
import com.google.common.collect.Iterators;
import org.apache.flink.shaded.guava18.com.google.common.base.Predicate;
import org.apache.flink.shaded.guava18.com.google.common.collect.Iterators;

import javax.annotation.Nullable;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,8 @@
import org.apache.flink.streaming.runtime.streamrecord.StreamRecord;
import org.apache.flink.util.TestLogger;

import com.google.common.collect.Lists;
import org.apache.flink.shaded.guava18.com.google.common.collect.Lists;

import org.junit.Test;

import java.util.ArrayList;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,8 @@
import org.apache.flink.streaming.runtime.streamrecord.StreamRecord;
import org.apache.flink.util.TestLogger;

import com.google.common.collect.Lists;
import org.apache.flink.shaded.guava18.com.google.common.collect.Lists;

import org.junit.Test;

import java.util.ArrayList;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,8 @@
import org.apache.flink.streaming.runtime.streamrecord.StreamRecord;
import org.apache.flink.util.TestLogger;

import com.google.common.collect.Lists;
import org.apache.flink.shaded.guava18.com.google.common.collect.Lists;

import org.junit.Assert;
import org.junit.Test;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@
import org.apache.flink.cep.Event;
import org.apache.flink.streaming.runtime.streamrecord.StreamRecord;

import com.google.common.primitives.Doubles;
import org.junit.Assert;

import java.util.ArrayList;
Expand Down Expand Up @@ -96,7 +95,7 @@ private static class EventComparator implements Comparator<Event> {
@Override
public int compare(Event o1, Event o2) {
int nameComp = o1.getName().compareTo(o2.getName());
int priceComp = Doubles.compare(o1.getPrice(), o2.getPrice());
int priceComp = Double.compare(o1.getPrice(), o2.getPrice());
int idComp = Integer.compare(o1.getId(), o2.getId());
if (nameComp == 0) {
if (priceComp == 0) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,8 @@
import org.apache.flink.streaming.runtime.streamrecord.StreamRecord;
import org.apache.flink.util.TestLogger;

import com.google.common.collect.Lists;
import org.apache.flink.shaded.guava18.com.google.common.collect.Lists;

import org.junit.Test;

import java.util.ArrayList;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,9 @@
import org.apache.flink.streaming.runtime.streamrecord.StreamRecord;
import org.apache.flink.util.TestLogger;

import com.google.common.collect.Iterators;
import com.google.common.collect.Lists;
import org.apache.flink.shaded.guava18.com.google.common.collect.Iterators;
import org.apache.flink.shaded.guava18.com.google.common.collect.Lists;

import org.junit.Test;

import java.util.ArrayList;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,8 @@
import org.apache.flink.streaming.runtime.streamrecord.StreamRecord;
import org.apache.flink.util.TestLogger;

import com.google.common.collect.Lists;
import org.apache.flink.shaded.guava18.com.google.common.collect.Lists;

import org.junit.Test;

import java.util.ArrayList;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,8 @@
import org.apache.flink.cep.pattern.conditions.SimpleCondition;
import org.apache.flink.streaming.runtime.streamrecord.StreamRecord;

import com.google.common.collect.Lists;
import org.apache.flink.shaded.guava18.com.google.common.collect.Lists;

import org.junit.Test;

import java.util.ArrayList;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,8 @@
import org.apache.flink.cep.pattern.conditions.SimpleCondition;
import org.apache.flink.util.TestLogger;

import org.apache.flink.shaded.guava18.com.google.common.collect.Sets;

import org.junit.Rule;
import org.junit.Test;
import org.junit.rules.ExpectedException;
Expand All @@ -42,7 +44,6 @@
import java.util.Map;
import java.util.Set;

import static com.google.common.collect.Sets.newHashSet;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertTrue;

Expand Down Expand Up @@ -142,22 +143,22 @@ public void testNFACompilerWithSimplePattern() {
State<Event> startState = stateMap.get("start");
assertTrue(startState.isStart());
final Set<Tuple2<String, StateTransitionAction>> startTransitions = unfoldTransitions(startState);
assertEquals(newHashSet(
assertEquals(Sets.newHashSet(
Tuple2.of("middle", StateTransitionAction.TAKE)
), startTransitions);

assertTrue(stateMap.containsKey("middle"));
State<Event> middleState = stateMap.get("middle");
final Set<Tuple2<String, StateTransitionAction>> middleTransitions = unfoldTransitions(middleState);
assertEquals(newHashSet(
assertEquals(Sets.newHashSet(
Tuple2.of("middle", StateTransitionAction.IGNORE),
Tuple2.of("end", StateTransitionAction.TAKE)
), middleTransitions);

assertTrue(stateMap.containsKey("end"));
State<Event> endState = stateMap.get("end");
final Set<Tuple2<String, StateTransitionAction>> endTransitions = unfoldTransitions(endState);
assertEquals(newHashSet(
assertEquals(Sets.newHashSet(
Tuple2.of(NFACompiler.ENDING_STATE_NAME, StateTransitionAction.TAKE)
), endTransitions);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,8 @@
import org.apache.flink.types.Either;
import org.apache.flink.util.TestLogger;

import com.google.common.collect.Lists;
import org.apache.flink.shaded.guava18.com.google.common.collect.Lists;

import org.junit.After;
import org.junit.Assert;
import org.junit.Rule;
Expand Down
3 changes: 2 additions & 1 deletion flink-libraries/flink-table/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -218,8 +218,9 @@ under the License.
<include>org.apache.calcite:*</include>
<include>org.apache.calcite.avatica:*</include>
<include>net.hydromatic:*</include>
<include>org.reflections:*</include>
<include>org.reflections:*</include>
<include>org.codehaus.janino:*</include>
<include>com.google.guava:guava</include>
</includes>
</artifactSet>
<relocations>
Expand Down
5 changes: 2 additions & 3 deletions flink-optimizer/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -57,9 +57,8 @@ under the License.
</dependency>

<dependency>
<groupId>com.google.guava</groupId>
<artifactId>guava</artifactId>
<version>${guava.version}</version>
<groupId>org.apache.flink</groupId>
<artifactId>flink-shaded-guava</artifactId>
</dependency>

<!-- test dependencies -->
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@
import org.apache.flink.runtime.operators.shipping.ShipStrategyType;
import org.apache.flink.util.Visitor;

import com.google.common.collect.Sets;
import org.apache.flink.shaded.guava18.com.google.common.collect.Sets;

/**
* A node in the optimizer's program representation for an operation with a single input.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@
import org.apache.flink.runtime.operators.shipping.ShipStrategyType;
import org.apache.flink.util.Visitor;

import com.google.common.collect.Sets;
import org.apache.flink.shaded.guava18.com.google.common.collect.Sets;

/**
* A node in the optimizer plan that represents an operator with a two different inputs, such as Join,
Expand Down
9 changes: 4 additions & 5 deletions flink-runtime-web/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -61,14 +61,13 @@ under the License.
</dependency>

<dependency>
<groupId>org.javassist</groupId>
<artifactId>javassist</artifactId>
<groupId>org.apache.flink</groupId>
<artifactId>flink-shaded-guava</artifactId>
</dependency>

<dependency>
<groupId>com.google.guava</groupId>
<artifactId>guava</artifactId>
<version>${guava.version}</version>
<groupId>org.javassist</groupId>
<artifactId>javassist</artifactId>
</dependency>

<!-- ===================================================
Expand Down
Loading

0 comments on commit 8dfb9d0

Please sign in to comment.