Skip to content

Commit 4540bca

Browse files
authored
[GH-1996] Shade S2 and Guava into runtime JARs (#2054)
1 parent 7a93715 commit 4540bca

10 files changed

Lines changed: 134 additions & 14 deletions

File tree

common/pom.xml

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,6 @@
8787
<dependency>
8888
<groupId>org.datasyslab</groupId>
8989
<artifactId>s2-geometry-library</artifactId>
90-
<version>20250620-rc1</version>
9190
</dependency>
9291
<dependency>
9392
<groupId>com.uber</groupId>
@@ -113,6 +112,14 @@
113112
<groupId>edu.ucar</groupId>
114113
<artifactId>cdm-core</artifactId>
115114
</dependency>
115+
<!-- For shading a janino package that works with Spark for jiffle. We don't add this to
116+
dependencyManagement in parent pom.xml because we don't want to mess up with the
117+
janino versions required by Spark. -->
118+
<dependency>
119+
<groupId>org.codehaus.janino</groupId>
120+
<artifactId>janino</artifactId>
121+
<version>${janino-version}</version>
122+
</dependency>
116123
</dependencies>
117124
<build>
118125
<sourceDirectory>src/main/java</sourceDirectory>
@@ -163,7 +170,6 @@
163170
<include>it.geosolutions.jaiext.jiffle:*</include>
164171
<include>org.antlr:*</include>
165172
<include>org.codehaus.janino:*</include>
166-
<include>org.datasyslab:s2-geometry-library</include>
167173
</includes>
168174
</artifactSet>
169175
<relocations>
@@ -182,10 +188,6 @@
182188
<pattern>org.codehaus</pattern>
183189
<shadedPattern>org.apache.sedona.shaded.codehaus</shadedPattern>
184190
</relocation>
185-
<relocation>
186-
<pattern>com.google.common.geometry</pattern>
187-
<shadedPattern>org.apache.sedona.shaded.s2</shadedPattern>
188-
</relocation>
189191
</relocations>
190192
<filters>
191193
<!-- filter to address "Invalid signature file" issue - see http://stackoverflow.com/a/6743609/589215 -->

flink-shaded/pom.xml

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,27 @@
8888
<exclude>org.scala-lang:scala-library</exclude>
8989
</excludes>
9090
</artifactSet>
91+
<relocations>
92+
<!--
93+
We relocate our own released version of s2-geometry-library to avoid conflicts with
94+
any other official com.google.geometry:s2-geometry in the runtime environment.
95+
96+
Our new s2-geometry-library requires a version of guava higher than what Spark
97+
ships with, so we relocate it as well to make s2-geometry-library work.
98+
-->
99+
<relocation>
100+
<pattern>com.google.common.geometry</pattern>
101+
<shadedPattern>org.apache.sedona.shaded.s2</shadedPattern>
102+
</relocation>
103+
<relocation>
104+
<pattern>com.google.common</pattern>
105+
<shadedPattern>org.apache.sedona.shaded.guava</shadedPattern>
106+
</relocation>
107+
<relocation>
108+
<pattern>it.unimi.dsi.fastutil</pattern>
109+
<shadedPattern>org.apache.sedona.shaded.fastutil</shadedPattern>
110+
</relocation>
111+
</relocations>
91112
<filters>
92113
<!-- filter to address "Invalid signature file" issue - see http://stackoverflow.com/a/6743609/589215 -->
93114
<filter>

flink/pom.xml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,16 @@
4242
<groupId>org.apache.sedona</groupId>
4343
<artifactId>sedona-common</artifactId>
4444
<version>${project.version}</version>
45+
<exclusions>
46+
<exclusion>
47+
<groupId>it.geosolutions.jaiext.jiffle</groupId>
48+
<artifactId>*</artifactId>
49+
</exclusion>
50+
<exclusion>
51+
<groupId>org.codehaus.janino</groupId>
52+
<artifactId>*</artifactId>
53+
</exclusion>
54+
</exclusions>
4555
</dependency>
4656
<dependency>
4757
<groupId>org.apache.flink</groupId>

pom.xml

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,8 @@
8989

9090
<flink.version>1.19.0</flink.version>
9191
<slf4j.version>1.7.36</slf4j.version>
92-
<googles2.version>2.0.0</googles2.version>
92+
<googles2.version>20250620-rc1</googles2.version>
93+
<guava.version>33.4.7-jre</guava.version>
9394
<uberh3.version>4.1.1</uberh3.version>
9495
<scalatest.version>3.1.1</scalatest.version>
9596
<scala-collection-compat.version>2.5.0</scala-collection-compat.version>
@@ -344,22 +345,22 @@
344345
<version>4.0.2</version>
345346
<scope>provided</scope>
346347
</dependency>
347-
<dependency>
348-
<groupId>org.codehaus.janino</groupId>
349-
<artifactId>janino</artifactId>
350-
<version>${janino-version}</version>
351-
</dependency>
352348
<dependency>
353349
<groupId>junit</groupId>
354350
<artifactId>junit</artifactId>
355351
<version>4.13.1</version>
356352
<scope>test</scope>
357353
</dependency>
358354
<dependency>
359-
<groupId>com.google.geometry</groupId>
360-
<artifactId>s2-geometry</artifactId>
355+
<groupId>org.datasyslab</groupId>
356+
<artifactId>s2-geometry-library</artifactId>
361357
<version>${googles2.version}</version>
362358
</dependency>
359+
<dependency>
360+
<groupId>com.google.guava</groupId>
361+
<artifactId>guava</artifactId>
362+
<version>${guava.version}</version>
363+
</dependency>
363364
<dependency>
364365
<groupId>com.uber</groupId>
365366
<artifactId>h3</artifactId>

snowflake/pom.xml

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,14 @@
4747
<groupId>com.fasterxml.jackson.core</groupId>
4848
<artifactId>*</artifactId>
4949
</exclusion>
50+
<exclusion>
51+
<groupId>it.geosolutions.jaiext.jiffle</groupId>
52+
<artifactId>jt-jiffle-language</artifactId>
53+
</exclusion>
54+
<exclusion>
55+
<groupId>org.codehaus.janino</groupId>
56+
<artifactId>*</artifactId>
57+
</exclusion>
5058
</exclusions>
5159
</dependency>
5260
<dependency>
@@ -123,6 +131,27 @@
123131
<exclude>org.scala-lang:scala-library</exclude>
124132
</excludes>
125133
</artifactSet>
134+
<relocations>
135+
<!--
136+
We relocate our own released version of s2-geometry-library to avoid conflicts with
137+
any other official com.google.geometry:s2-geometry in the runtime environment.
138+
139+
Our new s2-geometry-library requires a version of guava higher than what Spark
140+
ships with, so we relocate it as well to make s2-geometry-library work.
141+
-->
142+
<relocation>
143+
<pattern>com.google.common.geometry</pattern>
144+
<shadedPattern>org.apache.sedona.shaded.s2</shadedPattern>
145+
</relocation>
146+
<relocation>
147+
<pattern>com.google.common</pattern>
148+
<shadedPattern>org.apache.sedona.shaded.guava</shadedPattern>
149+
</relocation>
150+
<relocation>
151+
<pattern>it.unimi.dsi.fastutil</pattern>
152+
<shadedPattern>org.apache.sedona.shaded.fastutil</shadedPattern>
153+
</relocation>
154+
</relocations>
126155
<filters>
127156
<!-- filter to address "Invalid signature file" issue - see http://stackoverflow.com/a/6743609/589215 -->
128157
<filter>

spark-shaded/pom.xml

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,10 @@
5252
<groupId>it.geosolutions.jaiext.jiffle</groupId>
5353
<artifactId>jt-jiffle-language</artifactId>
5454
</exclusion>
55+
<exclusion>
56+
<groupId>org.codehaus.janino</groupId>
57+
<artifactId>*</artifactId>
58+
</exclusion>
5559
</exclusions>
5660
</dependency>
5761
<dependency>
@@ -237,6 +241,27 @@
237241
<exclude>commons-logging:commons-logging</exclude>
238242
</excludes>
239243
</artifactSet>
244+
<relocations>
245+
<!--
246+
We relocate our own released version of s2-geometry-library to avoid conflicts with
247+
any other official com.google.geometry:s2-geometry in the runtime environment.
248+
249+
Our new s2-geometry-library requires a version of guava higher than what Spark
250+
ships with, so we relocate it as well to make s2-geometry-library work.
251+
-->
252+
<relocation>
253+
<pattern>com.google.common.geometry</pattern>
254+
<shadedPattern>org.apache.sedona.shaded.s2</shadedPattern>
255+
</relocation>
256+
<relocation>
257+
<pattern>com.google.common</pattern>
258+
<shadedPattern>org.apache.sedona.shaded.guava</shadedPattern>
259+
</relocation>
260+
<relocation>
261+
<pattern>it.unimi.dsi.fastutil</pattern>
262+
<shadedPattern>org.apache.sedona.shaded.fastutil</shadedPattern>
263+
</relocation>
264+
</relocations>
240265
<filters>
241266
<!-- filter to address "Invalid signature file" issue - see http://stackoverflow.com/a/6743609/589215 -->
242267
<filter>

spark/common/pom.xml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,14 @@
4646
<groupId>com.fasterxml.jackson.core</groupId>
4747
<artifactId>*</artifactId>
4848
</exclusion>
49+
<exclusion>
50+
<groupId>it.geosolutions.jaiext.jiffle</groupId>
51+
<artifactId>*</artifactId>
52+
</exclusion>
53+
<exclusion>
54+
<groupId>org.codehaus.janino</groupId>
55+
<artifactId>*</artifactId>
56+
</exclusion>
4957
</exclusions>
5058
</dependency>
5159
<dependency>

spark/spark-3.4/pom.xml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,14 @@
4646
<groupId>com.fasterxml.jackson.core</groupId>
4747
<artifactId>*</artifactId>
4848
</exclusion>
49+
<exclusion>
50+
<groupId>it.geosolutions.jaiext.jiffle</groupId>
51+
<artifactId>*</artifactId>
52+
</exclusion>
53+
<exclusion>
54+
<groupId>org.codehaus.janino</groupId>
55+
<artifactId>*</artifactId>
56+
</exclusion>
4957
</exclusions>
5058
</dependency>
5159
<dependency>

spark/spark-3.5/pom.xml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,14 @@
4646
<groupId>com.fasterxml.jackson.core</groupId>
4747
<artifactId>*</artifactId>
4848
</exclusion>
49+
<exclusion>
50+
<groupId>it.geosolutions.jaiext.jiffle</groupId>
51+
<artifactId>*</artifactId>
52+
</exclusion>
53+
<exclusion>
54+
<groupId>org.codehaus.janino</groupId>
55+
<artifactId>*</artifactId>
56+
</exclusion>
4957
</exclusions>
5058
</dependency>
5159
<dependency>

spark/spark-4.0/pom.xml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,14 @@
4646
<groupId>com.fasterxml.jackson.core</groupId>
4747
<artifactId>*</artifactId>
4848
</exclusion>
49+
<exclusion>
50+
<groupId>it.geosolutions.jaiext.jiffle</groupId>
51+
<artifactId>*</artifactId>
52+
</exclusion>
53+
<exclusion>
54+
<groupId>org.codehaus.janino</groupId>
55+
<artifactId>*</artifactId>
56+
</exclusion>
4957
</exclusions>
5058
</dependency>
5159
<dependency>

0 commit comments

Comments
 (0)