Hacktoberfest 2026: the issues maintainers tagged for October, open and beginner-friendly. Browse Hacktoberfest issues

Snowflake ST_Distance and ST_HausdorffDistance throw NullPointerException on an empty geometry

Closed
#3,453 0 comments 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 1 day

A pull request for this has already been merged.

  • #3454 by @jiayuasu — merged

Assessment

Difficulty
2/5
Estimated time
1-3 hours
Newbie friendliness
35/100
Issue type
Bug
Clarity
Clearly specified
Activity status
Stale
Tech stack
java
Domain
backend, databases

Research direction

Start with the Snowflake UDF overloads in UDFs and UDFsV2, then check how Functions.distance and Functions.hausdorffDistance handle empty geometries and compare the Spark and Flink behavior. Done means both functions return NULL for empty geometries without throwing, and the Hausdorff distance documentation matches that behavior. An open linked pull request (#3454) is already addressing this issue.

Written by the indexing model from the issue text.

Description

The Snowflake UDFs ST_Distance and ST_HausdorffDistance (both overloads, in UDFs and UDFsV2) are declared to return a primitive double, but Functions.distance and Functions.hausdorffDistance return null when either geometry is empty. The unboxing throws a NullPointerException instead of returning NULL, as these functions do in Spark and Flink.

Repro: SELECT sedona.ST_Distance(sedona.ST_GeomFromText('POINT(1 2)'), sedona.ST_GeomFromText('POLYGON EMPTY'))

The ST_HausdorffDistance docs also say an empty geometry gives 0.0, but it has returned NULL since #2730.

Dominant language
Java
Stars
2.4k
Forks
787
Avg merge
1d 23h
Merged PRs (30d)
52

Getting set up

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from apache/sedona

All issues in apache/sedona

Similar issues

More Java issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.