This is an automated email from the ASF dual-hosted git repository.

jiayu pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/sedona.git


The following commit(s) were added to refs/heads/master by this push:
     new 4540bcaf59 [GH-1996] Shade S2 and Guava into runtime JARs (#2054)
4540bcaf59 is described below

commit 4540bcaf590ed246b0ff39f8c62db32f2e34efa8
Author: Kristin Cowalcijk <kontinuat...@apache.org>
AuthorDate: Fri Jul 4 12:46:08 2025 +0800

    [GH-1996] Shade S2 and Guava into runtime JARs (#2054)
---
 common/pom.xml          | 14 ++++++++------
 flink-shaded/pom.xml    | 21 +++++++++++++++++++++
 flink/pom.xml           | 10 ++++++++++
 pom.xml                 | 17 +++++++++--------
 snowflake/pom.xml       | 29 +++++++++++++++++++++++++++++
 spark-shaded/pom.xml    | 25 +++++++++++++++++++++++++
 spark/common/pom.xml    |  8 ++++++++
 spark/spark-3.4/pom.xml |  8 ++++++++
 spark/spark-3.5/pom.xml |  8 ++++++++
 spark/spark-4.0/pom.xml |  8 ++++++++
 10 files changed, 134 insertions(+), 14 deletions(-)

diff --git a/common/pom.xml b/common/pom.xml
index b5127e0e00..3108ecf99c 100644
--- a/common/pom.xml
+++ b/common/pom.xml
@@ -87,7 +87,6 @@
         <dependency>
             <groupId>org.datasyslab</groupId>
             <artifactId>s2-geometry-library</artifactId>
-            <version>20250620-rc1</version>
         </dependency>
         <dependency>
             <groupId>com.uber</groupId>
@@ -113,6 +112,14 @@
             <groupId>edu.ucar</groupId>
             <artifactId>cdm-core</artifactId>
         </dependency>
+        <!-- For shading a janino package that works with Spark for jiffle. We 
don't add this to
+             dependencyManagement in parent pom.xml because we don't want to 
mess up with the
+             janino versions required by Spark. -->
+        <dependency>
+            <groupId>org.codehaus.janino</groupId>
+            <artifactId>janino</artifactId>
+            <version>${janino-version}</version>
+        </dependency>
     </dependencies>
     <build>
         <sourceDirectory>src/main/java</sourceDirectory>
@@ -163,7 +170,6 @@
                                     
<include>it.geosolutions.jaiext.jiffle:*</include>
                                     <include>org.antlr:*</include>
                                     <include>org.codehaus.janino:*</include>
-                                    
<include>org.datasyslab:s2-geometry-library</include>
                                 </includes>
                             </artifactSet>
                             <relocations>
@@ -182,10 +188,6 @@
                                     <pattern>org.codehaus</pattern>
                                     
<shadedPattern>org.apache.sedona.shaded.codehaus</shadedPattern>
                                 </relocation>
-                                <relocation>
-                                    
<pattern>com.google.common.geometry</pattern>
-                                    
<shadedPattern>org.apache.sedona.shaded.s2</shadedPattern>
-                                </relocation>
                             </relocations>
                             <filters>
                                 <!--  filter to address "Invalid signature 
file" issue - see http://stackoverflow.com/a/6743609/589215 -->
diff --git a/flink-shaded/pom.xml b/flink-shaded/pom.xml
index 05d84a6714..ede1c84f67 100644
--- a/flink-shaded/pom.xml
+++ b/flink-shaded/pom.xml
@@ -88,6 +88,27 @@
                                     
<exclude>org.scala-lang:scala-library</exclude>
                                 </excludes>
                             </artifactSet>
+                            <relocations>
+                                <!--
+                                  We relocate our own released version of 
s2-geometry-library to avoid conflicts with
+                                  any other official 
com.google.geometry:s2-geometry in the runtime environment.
+
+                                  Our new s2-geometry-library requires a 
version of guava higher than what Spark
+                                  ships with, so we relocate it as well to 
make s2-geometry-library work.
+                                -->
+                                <relocation>
+                                    
<pattern>com.google.common.geometry</pattern>
+                                    
<shadedPattern>org.apache.sedona.shaded.s2</shadedPattern>
+                                </relocation>
+                                <relocation>
+                                    <pattern>com.google.common</pattern>
+                                    
<shadedPattern>org.apache.sedona.shaded.guava</shadedPattern>
+                                </relocation>
+                                <relocation>
+                                    <pattern>it.unimi.dsi.fastutil</pattern>
+                                    
<shadedPattern>org.apache.sedona.shaded.fastutil</shadedPattern>
+                                </relocation>
+                            </relocations>
                             <filters>
                                 <!--  filter to address "Invalid signature 
file" issue - see http://stackoverflow.com/a/6743609/589215 -->
                                 <filter>
diff --git a/flink/pom.xml b/flink/pom.xml
index 4255fecff3..96d952293d 100644
--- a/flink/pom.xml
+++ b/flink/pom.xml
@@ -42,6 +42,16 @@
             <groupId>org.apache.sedona</groupId>
             <artifactId>sedona-common</artifactId>
             <version>${project.version}</version>
+            <exclusions>
+                <exclusion>
+                    <groupId>it.geosolutions.jaiext.jiffle</groupId>
+                    <artifactId>*</artifactId>
+                </exclusion>
+                <exclusion>
+                    <groupId>org.codehaus.janino</groupId>
+                    <artifactId>*</artifactId>
+                </exclusion>
+            </exclusions>
         </dependency>
         <dependency>
             <groupId>org.apache.flink</groupId>
diff --git a/pom.xml b/pom.xml
index fe1a092267..9487e959c0 100644
--- a/pom.xml
+++ b/pom.xml
@@ -89,7 +89,8 @@
 
         <flink.version>1.19.0</flink.version>
         <slf4j.version>1.7.36</slf4j.version>
-        <googles2.version>2.0.0</googles2.version>
+        <googles2.version>20250620-rc1</googles2.version>
+        <guava.version>33.4.7-jre</guava.version>
         <uberh3.version>4.1.1</uberh3.version>
         <scalatest.version>3.1.1</scalatest.version>
         
<scala-collection-compat.version>2.5.0</scala-collection-compat.version>
@@ -344,11 +345,6 @@
                 <version>4.0.2</version>
                 <scope>provided</scope>
             </dependency>
-            <dependency>
-                <groupId>org.codehaus.janino</groupId>
-                <artifactId>janino</artifactId>
-                <version>${janino-version}</version>
-            </dependency>
             <dependency>
                 <groupId>junit</groupId>
                 <artifactId>junit</artifactId>
@@ -356,10 +352,15 @@
                 <scope>test</scope>
             </dependency>
             <dependency>
-                <groupId>com.google.geometry</groupId>
-                <artifactId>s2-geometry</artifactId>
+                <groupId>org.datasyslab</groupId>
+                <artifactId>s2-geometry-library</artifactId>
                 <version>${googles2.version}</version>
             </dependency>
+            <dependency>
+                <groupId>com.google.guava</groupId>
+                <artifactId>guava</artifactId>
+                <version>${guava.version}</version>
+            </dependency>
             <dependency>
                 <groupId>com.uber</groupId>
                 <artifactId>h3</artifactId>
diff --git a/snowflake/pom.xml b/snowflake/pom.xml
index 8b6df4ad2e..a162f6f38a 100644
--- a/snowflake/pom.xml
+++ b/snowflake/pom.xml
@@ -47,6 +47,14 @@
                     <groupId>com.fasterxml.jackson.core</groupId>
                     <artifactId>*</artifactId>
                 </exclusion>
+                <exclusion>
+                    <groupId>it.geosolutions.jaiext.jiffle</groupId>
+                    <artifactId>jt-jiffle-language</artifactId>
+                </exclusion>
+                <exclusion>
+                    <groupId>org.codehaus.janino</groupId>
+                    <artifactId>*</artifactId>
+                </exclusion>
             </exclusions>
         </dependency>
         <dependency>
@@ -123,6 +131,27 @@
                                     
<exclude>org.scala-lang:scala-library</exclude>
                                 </excludes>
                             </artifactSet>
+                            <relocations>
+                                <!--
+                                  We relocate our own released version of 
s2-geometry-library to avoid conflicts with
+                                  any other official 
com.google.geometry:s2-geometry in the runtime environment.
+
+                                  Our new s2-geometry-library requires a 
version of guava higher than what Spark
+                                  ships with, so we relocate it as well to 
make s2-geometry-library work.
+                                -->
+                                <relocation>
+                                    
<pattern>com.google.common.geometry</pattern>
+                                    
<shadedPattern>org.apache.sedona.shaded.s2</shadedPattern>
+                                </relocation>
+                                <relocation>
+                                    <pattern>com.google.common</pattern>
+                                    
<shadedPattern>org.apache.sedona.shaded.guava</shadedPattern>
+                                </relocation>
+                                <relocation>
+                                    <pattern>it.unimi.dsi.fastutil</pattern>
+                                    
<shadedPattern>org.apache.sedona.shaded.fastutil</shadedPattern>
+                                </relocation>
+                            </relocations>
                             <filters>
                                 <!--  filter to address "Invalid signature 
file" issue - see http://stackoverflow.com/a/6743609/589215 -->
                                 <filter>
diff --git a/spark-shaded/pom.xml b/spark-shaded/pom.xml
index 145100f24c..119a335a6e 100644
--- a/spark-shaded/pom.xml
+++ b/spark-shaded/pom.xml
@@ -52,6 +52,10 @@
                     <groupId>it.geosolutions.jaiext.jiffle</groupId>
                     <artifactId>jt-jiffle-language</artifactId>
                 </exclusion>
+                <exclusion>
+                    <groupId>org.codehaus.janino</groupId>
+                    <artifactId>*</artifactId>
+                </exclusion>
             </exclusions>
         </dependency>
         <dependency>
@@ -237,6 +241,27 @@
                                     
<exclude>commons-logging:commons-logging</exclude>
                                 </excludes>
                             </artifactSet>
+                            <relocations>
+                                <!--
+                                  We relocate our own released version of 
s2-geometry-library to avoid conflicts with
+                                  any other official 
com.google.geometry:s2-geometry in the runtime environment.
+
+                                  Our new s2-geometry-library requires a 
version of guava higher than what Spark
+                                  ships with, so we relocate it as well to 
make s2-geometry-library work.
+                                -->
+                                <relocation>
+                                    
<pattern>com.google.common.geometry</pattern>
+                                    
<shadedPattern>org.apache.sedona.shaded.s2</shadedPattern>
+                                </relocation>
+                                <relocation>
+                                    <pattern>com.google.common</pattern>
+                                    
<shadedPattern>org.apache.sedona.shaded.guava</shadedPattern>
+                                </relocation>
+                                <relocation>
+                                    <pattern>it.unimi.dsi.fastutil</pattern>
+                                    
<shadedPattern>org.apache.sedona.shaded.fastutil</shadedPattern>
+                                </relocation>
+                            </relocations>
                             <filters>
                                 <!--  filter to address "Invalid signature 
file" issue - see http://stackoverflow.com/a/6743609/589215 -->
                                 <filter>
diff --git a/spark/common/pom.xml b/spark/common/pom.xml
index 84e0a87bda..fab7c9fd09 100644
--- a/spark/common/pom.xml
+++ b/spark/common/pom.xml
@@ -46,6 +46,14 @@
                     <groupId>com.fasterxml.jackson.core</groupId>
                     <artifactId>*</artifactId>
                 </exclusion>
+                <exclusion>
+                    <groupId>it.geosolutions.jaiext.jiffle</groupId>
+                    <artifactId>*</artifactId>
+                </exclusion>
+                <exclusion>
+                    <groupId>org.codehaus.janino</groupId>
+                    <artifactId>*</artifactId>
+                </exclusion>
             </exclusions>
         </dependency>
         <dependency>
diff --git a/spark/spark-3.4/pom.xml b/spark/spark-3.4/pom.xml
index 552e8ec3a8..6b5fe78a4d 100644
--- a/spark/spark-3.4/pom.xml
+++ b/spark/spark-3.4/pom.xml
@@ -46,6 +46,14 @@
                     <groupId>com.fasterxml.jackson.core</groupId>
                     <artifactId>*</artifactId>
                 </exclusion>
+                <exclusion>
+                    <groupId>it.geosolutions.jaiext.jiffle</groupId>
+                    <artifactId>*</artifactId>
+                </exclusion>
+                <exclusion>
+                    <groupId>org.codehaus.janino</groupId>
+                    <artifactId>*</artifactId>
+                </exclusion>
             </exclusions>
         </dependency>
         <dependency>
diff --git a/spark/spark-3.5/pom.xml b/spark/spark-3.5/pom.xml
index b1d08e2eba..f9478f1d96 100644
--- a/spark/spark-3.5/pom.xml
+++ b/spark/spark-3.5/pom.xml
@@ -46,6 +46,14 @@
                     <groupId>com.fasterxml.jackson.core</groupId>
                     <artifactId>*</artifactId>
                 </exclusion>
+                <exclusion>
+                    <groupId>it.geosolutions.jaiext.jiffle</groupId>
+                    <artifactId>*</artifactId>
+                </exclusion>
+                <exclusion>
+                    <groupId>org.codehaus.janino</groupId>
+                    <artifactId>*</artifactId>
+                </exclusion>
             </exclusions>
         </dependency>
         <dependency>
diff --git a/spark/spark-4.0/pom.xml b/spark/spark-4.0/pom.xml
index 35895740ff..ee4b30724c 100644
--- a/spark/spark-4.0/pom.xml
+++ b/spark/spark-4.0/pom.xml
@@ -46,6 +46,14 @@
                     <groupId>com.fasterxml.jackson.core</groupId>
                     <artifactId>*</artifactId>
                 </exclusion>
+                <exclusion>
+                    <groupId>it.geosolutions.jaiext.jiffle</groupId>
+                    <artifactId>*</artifactId>
+                </exclusion>
+                <exclusion>
+                    <groupId>org.codehaus.janino</groupId>
+                    <artifactId>*</artifactId>
+                </exclusion>
             </exclusions>
         </dependency>
         <dependency>

Reply via email to