Skip to content

Commit 34d0b70

Browse files
steveloughranMarcelo Vanzin
authored andcommitted
[SPARK-12807][YARN] Spark External Shuffle not working in Hadoop clusters with Jackson 2.2.3
Patch to 1. Shade jackson 2.x in spark-yarn-shuffle JAR: core, databind, annotation 2. Use maven antrun to verify the JAR has the renamed classes Being Maven-based, I don't know if the verification phase kicks in on an SBT/jenkins build. It will on a `mvn install` Author: Steve Loughran <[email protected]> Closes #10780 from steveloughran/stevel/patches/SPARK-12807-master-shuffle.
1 parent 68ed363 commit 34d0b70

File tree

1 file changed

+48
-1
lines changed

1 file changed

+48
-1
lines changed

network/yarn/pom.xml

Lines changed: 48 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,8 @@
3535
<sbt.project.name>network-yarn</sbt.project.name>
3636
<!-- Make sure all Hadoop dependencies are provided to avoid repackaging. -->
3737
<hadoop.deps.scope>provided</hadoop.deps.scope>
38+
<shuffle.jar>${project.build.directory}/scala-${scala.binary.version}/spark-${project.version}-yarn-shuffle.jar</shuffle.jar>
39+
<shade>org/spark-project/</shade>
3840
</properties>
3941

4042
<dependencies>
@@ -70,7 +72,7 @@
7072
<artifactId>maven-shade-plugin</artifactId>
7173
<configuration>
7274
<shadedArtifactAttached>false</shadedArtifactAttached>
73-
<outputFile>${project.build.directory}/scala-${scala.binary.version}/spark-${project.version}-yarn-shuffle.jar</outputFile>
75+
<outputFile>${shuffle.jar}</outputFile>
7476
<artifactSet>
7577
<includes>
7678
<include>*:*</include>
@@ -86,6 +88,15 @@
8688
</excludes>
8789
</filter>
8890
</filters>
91+
<relocations>
92+
<relocation>
93+
<pattern>com.fasterxml.jackson</pattern>
94+
<shadedPattern>org.spark-project.com.fasterxml.jackson</shadedPattern>
95+
<includes>
96+
<include>com.fasterxml.jackson.**</include>
97+
</includes>
98+
</relocation>
99+
</relocations>
89100
</configuration>
90101
<executions>
91102
<execution>
@@ -96,6 +107,42 @@
96107
</execution>
97108
</executions>
98109
</plugin>
110+
111+
<!-- probes to validate that those dependencies which must be shaded are -->
112+
<plugin>
113+
<groupId>org.apache.maven.plugins</groupId>
114+
<artifactId>maven-antrun-plugin</artifactId>
115+
<executions>
116+
<execution>
117+
<phase>verify</phase>
118+
<goals>
119+
<goal>run</goal>
120+
</goals>
121+
<configuration>
122+
<target>
123+
<macrodef name="shaded">
124+
<attribute name="resource"/>
125+
<sequential>
126+
<fail message="Not found ${shade}@{resource}">
127+
<condition>
128+
<not>
129+
<resourceexists>
130+
<zipentry zipfile="${shuffle.jar}" name="${shade}@{resource}"/>
131+
</resourceexists>
132+
</not>
133+
</condition>
134+
</fail>
135+
</sequential>
136+
</macrodef>
137+
<echo>Verifying dependency shading</echo>
138+
<shaded resource="com/fasterxml/jackson/core/JsonParser.class" />
139+
<shaded resource="com/fasterxml/jackson/annotation/JacksonAnnotation.class" />
140+
<shaded resource="com/fasterxml/jackson/databind/JsonSerializer.class" />
141+
</target>
142+
</configuration>
143+
</execution>
144+
</executions>
145+
</plugin>
99146
</plugins>
100147
</build>
101148
</project>

0 commit comments

Comments
 (0)