Skip to content

Upgrade Sedona to 1.9.1 so libpostal reads its model data from sc.addFile #45

Description

Problem

The design in docs/python-migration.md ships the libpostal v1.0.0 model data through S3. The job sets spark.sedona.libpostal.dataDir to an S3 prefix. Setup then calls sc.addFile(<prefix>, recursive=True) so every executor gets a copy.

Sedona 1.8.1 does not support this. It hands the data dir straight to jpostal and lets jpostal download data if it is missing. It also defaults spark.sedona.libpostal.useSenzing to true. Executors see the s3:// string, treat it as a missing local folder, and download the Senzing v1.1.0 model instead. Nothing fails. The addresses just parse differently.

We saw this in a parity run of the places setup stage (#27) against the Scala matcher. address_clean differed on about 10.8% of candidates and house_number on about 3.1%. Every column that does not come from libpostal matched.

Fix

Upgrade Sedona to 1.9.1.

Sedona 1.9.0 added LibPostalDataLoader (apache/sedona#2637, for apache/sedona#2360). A remote data dir now resolves through SparkFiles.get(<folder name>). Downloads are turned off for remote dirs, so a missing file fails loudly instead of swapping models.

Sedona 1.9.1 still ships jpostal 1.2.2, the same build as 1.8.1. So parsing stays the same as the build the design tested. The sedona-spark-shaded-3.5_2.12 1.9.1 jar and its geotools-wrapper (1.9.1-33.5) are on Maven Central.

Scope

  • Bump the apache-sedona dev pin in packages/overture_matchers and refresh uv.lock.
  • Update the Sedona version in docs/python-migration.md, and note that sc.addFile data needs 1.9.0 or later.

Alternatives considered

Sedona 1.8.0 doesn't help. LibPostalDataLoader first appears in 1.9.0. In 1.8.0 and 1.8.1, the data dir goes straight to jpostal with downloads turned on.

There is a workaround on 1.8.1. We could set the data dir to the bare folder name, like libpostal_data. Executors would then find the addFile copy relative to their working directory. We rejected it for two reasons:

  • 1.8.x still downloads a model quietly whenever the data is missing. That is the same failure that caused this bug. 1.9.x throws an error instead.
  • It relies on executors finding addFile files in their working directory. It breaks if the parser ever runs on the driver.

Order

This should merge before #27. #27 then removes a runtime spark.conf.set of the data dir, which never reached executors.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

No labels
No labels

Type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions