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
Yes, and the PR name follows the format [GH-XXX] my subject. Closes #<issue_number>
What changes were proposed in this PR?
ST_DWithin(A, B, d) — returns true iff the minimum geodesic distance between Geographies A
and B (in meters) is <= d. Delegates to the existing Functions.distance(Geography, Geography),
which uses S2ClosestEdgeQuery on the two ShapeIndexGeographys and already has point-point /
point-complex fast paths; the new dWithin simply compares the returned meters against the threshold.
Match is inclusive (<=) and has no short-circuit, identical to sedona-db's s2_distance-then-compare flow. 3-arg only — the Geometry-side useSpheroid 4th argument has no
Geography analogue because Geography is already spherical.
ST_Within(A, B) — returns true iff Geography A is fully inside B on the sphere. Implemented
as contains(B, A), the OGC identity. The underlying contains path runs S2BooleanOperation
containment over two ShapeIndexGeographys via the existing Predicates helper. The Catalyst ST_Within case class is migrated from ST_Predicate + CodegenFallback to InferredExpression
dual-dispatch (same migration already applied to ST_Contains); JoinQueryDetector is updated to
match it at the outer level with a Geography guard so spatial-join planning continues to skip
Geography inputs.
How was this patch tested?
`mvn -pl common -Dtest=FunctionTest test
GeographyFunctionTest gains SQL + DataFrame API coverage for both functions
Did this PR include necessary documentation updates?
Both implementations reduce ST_DWithin(A, B, d) to comparing the minimum geodesic distance between two geography entities using S2ClosestEdgeQuery over each side's S2ShapeIndex. sedona-db calls this via its C++ s2_distance helper; Sedona reuses the existing Functions.distance(Geography, Geography), which wraps Distance.S2_distance(ShapeIndexGeography, ShapeIndexGeography) — the same S2 query, just in Java.
Neither implementation short-circuits via S2ClosestEdgeQuery::Options::set_max_distance; both compute the full minimum and compare. Boundary semantics (<=), point fast paths (S1Angle for point-point, PointTarget for point-complex), and null propagation therefore line up exactly — the Java version is a thin shim over the same S2 primitive.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Did you read the Contributor Guide?
Is this PR related to a ticket?
[GH-XXX] my subject. Closes #<issue_number>What changes were proposed in this PR?
ST_DWithin(A, B, d)— returnstrueiff the minimum geodesic distance between Geographies Aand B (in meters) is
<= d. Delegates to the existingFunctions.distance(Geography, Geography),which uses
S2ClosestEdgeQueryon the twoShapeIndexGeographys and already has point-point /point-complex fast paths; the new
dWithinsimply compares the returned meters against the threshold.Match is inclusive (
<=) and has no short-circuit, identical tosedona-db'ss2_distance-then-compare flow. 3-arg only — the Geometry-sideuseSpheroid4th argument has noGeography analogue because Geography is already spherical.
ST_Within(A, B)— returnstrueiff Geography A is fully inside B on the sphere. Implementedas
contains(B, A), the OGC identity. The underlyingcontainspath runsS2BooleanOperationcontainment over two
ShapeIndexGeographys via the existingPredicateshelper. The CatalystST_Withincase class is migrated fromST_Predicate + CodegenFallbacktoInferredExpressiondual-dispatch (same migration already applied to
ST_Contains);JoinQueryDetectoris updated tomatch it at the outer level with a Geography guard so spatial-join planning continues to skip
Geography inputs.
How was this patch tested?
GeographyFunctionTestgains SQL + DataFrame API coverage for both functionsDid this PR include necessary documentation updates?