Skip to content

Shapefile reader fails on Spark distributions with extra checkAndGlobPathIfNecessary overloads (e.g. Dataproc) #3554

Closed

Description

@sguhathakurata-CLGX

Expected behavior

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:

DataSource.getClass.getMethods
  .filter(_.getName == "checkAndGlobPathIfNecessary")
  .headOption

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

  1. Run Sedona 1.9.1 (or master) on a Spark build that declares both a 6- and an 8-parameter DataSource.checkAndGlobPathIfNecessary.
  2. spark.read.format("shapefile").load(path).
  3. 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.

Settings

Sedona version = 1.9.1 (also on master)

Apache Spark version = 3.5.3, 4.1.2

API type = Scala / Python

Scala version = 2.12 / 2.13

Environment = Google Dataproc

Activity

  1. added this to the sedona-2.0.0 milestone on Nov 17, 2026
  2. added a commit that references this issue on Nov 17, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions