You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Shapefile reader fails on Spark distributions with extra checkAndGlobPathIfNecessary overloads (e.g. Dataproc) #3554
Reading a Shapefile / GeoPackage / GeoParquet metadata with Sedona 1.9.x works on any Spark distribution, regardless of which overloads of DataSource.checkAndGlobPathIfNecessary it declares.
Actual behavior
SedonaFileIndexHelper (added in #2660) resolves the method by name and takes the first one returned:
Class.getMethods does not guarantee any order. Apache Spark declares a single 6-parameter overload, so this works there. Google Dataproc's Spark builds additionally declare an 8-parameter overload. When it is returned first, getParameterCount match { case 6 => ...; case _ => ... } falls into the Databricks 5-argument branch and Method.invoke fails with an argument mismatch.
The order can differ between runs and clusters, even with identical jars, so the same job passes on one cluster and fails on another. Observed with Spark 3.5.3 (Dataproc 2.2.x) and Spark 4.1.2 (Dataproc 3.0.x).
Steps to reproduce
Run Sedona 1.9.1 (or master) on a Spark build that declares both a 6- and an 8-parameter DataSource.checkAndGlobPathIfNecessary.
spark.read.format("shapefile").load(path).
Fails or succeeds depending on the order returned by getMethods.
Proposed fix
Select the overload by its parameter types (OSS 6-parameter signature first, then the Databricks 5-parameter signature) and fail with the list of candidates if neither is found, instead of relying on name and order.
Activity
[GH-3554] Use signature matching for checkAndGlobPathIfNecessary meth…