Skip to content

Add ST_Relate implementation using GEOS#691

Draft
Mehak3010 wants to merge 20 commits intoapache:mainfrom
Mehak3010:feat/st-relate-text
Draft

Add ST_Relate implementation using GEOS#691
Mehak3010 wants to merge 20 commits intoapache:mainfrom
Mehak3010:feat/st-relate-text

Conversation

@Mehak3010
Copy link
Contributor

This PR implements the ST_Relate function using the GEOS relate operation to compute the DE-9IM (Dimensionally Extended 9-Intersection Model) relationship between two geometries. The implementation integrates with the existing GEOS execution framework in Sedona and returns the resulting DE-9IM intersection matrix as a UTF-8 text string. The changes include adding the GEOS kernel implementation in sedona-geos, creating the corresponding scalar UDF wrapper in sedona-functions, and registering the function so it can be used through the SQL interface. This enables users to evaluate spatial relationships between geometries and obtain the DE-9IM matrix representation directly. This work addresses issue #539 and is part of the broader implementation tracked in #174.

Copy link
Contributor

@petern48 petern48 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I know you're still working on this, but I figured I'd leave a bit of hints to help guide you along the way.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It looks like you've deleted many files in the submodules, presumably accidentally. This is causing CI failures. Could you revert these deletions?

Don't be afraid to ask if you need help with figuring out how to undo this.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

let me see... and will surely get back if some help is needed


executor.finish(Arc::new(builder.finish()))
}
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In addition to the actual rust implementation. We're going to need to add Rust tests in this file as well as python integration tests. You can take a look at this example PR (#288) to guide you if you'd like.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

oki, let me check

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We are still missing rust and python tests. Both of these are very important to have before we merge. The example PR has examples of these as well.

The rust tests should exist in this file, starting with:

#[cfg(test)]
mod tests {

The new python tests for st_relate should go in test_predicates.py (since st_relate is a predicate). Make sure to read my comment (#288 (comment)) about how to iterate on developing Python integration tests

Copy link
Contributor Author

@Mehak3010 Mehak3010 Mar 12, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the guidance! I’ll add the Rust tests in the module using #[cfg(test)] mod tests {} and implement the Python tests for st_relate in test_predicates.py, following the approach in #288.

@Mehak3010 Mehak3010 force-pushed the feat/st-relate-text branch from 6e098db to 760ac4c Compare March 10, 2026 14:29
@Mehak3010 Mehak3010 force-pushed the feat/st-relate-text branch from 43722df to c6623a4 Compare March 10, 2026 14:58
@Mehak3010 Mehak3010 force-pushed the feat/st-relate-text branch from 718eb17 to cedfd67 Compare March 10, 2026 15:31
@Mehak3010 Mehak3010 marked this pull request as draft March 10, 2026 15:35
@Mehak3010 Mehak3010 marked this pull request as ready for review March 11, 2026 07:43
@Mehak3010 Mehak3010 marked this pull request as draft March 11, 2026 07:44
@Mehak3010 Mehak3010 force-pushed the feat/st-relate-text branch from 5dad3ab to 5136544 Compare March 11, 2026 07:54
@Mehak3010 Mehak3010 force-pushed the feat/st-relate-text branch from 357366b to c5f171e Compare March 11, 2026 08:23
@Mehak3010 Mehak3010 force-pushed the feat/st-relate-text branch from 5fc9681 to 9646893 Compare March 11, 2026 08:37
@Mehak3010 Mehak3010 force-pushed the feat/st-relate-text branch from c867b56 to 40d256e Compare March 11, 2026 08:49
@Mehak3010 Mehak3010 force-pushed the feat/st-relate-text branch from 1a330ef to 4b467fc Compare March 11, 2026 12:36
@Mehak3010 Mehak3010 force-pushed the feat/st-relate-text branch from be0152e to 156993f Compare March 11, 2026 13:27
@Mehak3010 Mehak3010 marked this pull request as ready for review March 11, 2026 14:10
@Mehak3010
Copy link
Contributor Author

Thanks for the suggestions! I have reverted the submodule changes and aligned the implementation with the structure used in PR #288 as recommended. All CI checks are now passing and the PR should be ready for review/merge.

Copy link
Contributor

@petern48 petern48 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice job. This is a good start. I've left some feedback. Mainly, we need to add tests.

crate::st_xyzm::st_y_udf,
crate::st_xyzm::st_z_udf,
crate::st_zmflag::st_zmflag_udf,
crate::st_relate::st_relate_udf,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: let's place this in alphabetical order too


executor.finish(Arc::new(builder.finish()))
}
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We are still missing rust and python tests. Both of these are very important to have before we merge. The example PR has examples of these as well.

The rust tests should exist in this file, starting with:

#[cfg(test)]
mod tests {

The new python tests for st_relate should go in test_predicates.py (since st_relate is a predicate). Make sure to read my comment (#288 (comment)) about how to iterate on developing Python integration tests

@Mehak3010 Mehak3010 force-pushed the feat/st-relate-text branch from bd9f15e to 64359d7 Compare March 12, 2026 17:46
@Mehak3010 Mehak3010 force-pushed the feat/st-relate-text branch 2 times, most recently from 7f4b79d to e178a68 Compare March 12, 2026 19:28
@Mehak3010 Mehak3010 marked this pull request as draft March 12, 2026 20:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants