Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[SEDONA-607] Return geometry with ST functions with exceptions #1525

Merged
merged 12 commits into from
Jul 23, 2024

Conversation

zhangfengcdt
Copy link
Contributor

Did you read the Contributor Guide?

Is this PR related to a JIRA ticket?

What changes were proposed in this PR?

This PR make it feasible to return the geometry with the exception when ST functions fail and it will allow users to more quickly root cause exception and failures in their application.

How was this patch tested?

All unit tests and new unit tests on failed st function should throw expected error messages.

Did this PR include necessary documentation updates?

  • Yes, I have updated the documentation. [TODO]

@zhangfengcdt zhangfengcdt changed the title Sedona 607 add safe geom [SEDONA-607] Return geometry with ST functions with exceptions Jul 17, 2024
@zhangfengcdt zhangfengcdt marked this pull request as ready for review July 18, 2024 17:02
Copy link
Member

@jiayuasu jiayuasu left a comment

Choose a reason for hiding this comment

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

@Kontinuation @zhangfengcdt Can we also emit the values of non-spatial fields to provide more hints?

@Kontinuation
Copy link
Member

@Kontinuation @zhangfengcdt Can we also emit the values of non-spatial fields to provide more hints?

I don't think it is possible given the current approach to solve this problem.

Another concern is: sometimes the exceptions is not raised by ourselves, but somewhere inside JTS. This mostly happens in overlay functions (intersection, union, etc) and some topology-preserving transformation functions. We have to catch exceptions thrown by JTS and convert them to our own IllegalGeometryException exception, this is very tedious and certainly not what we want to do.

@jiayuasu jiayuasu added this to the sedona-1.6.1 milestone Jul 20, 2024
@zhangfengcdt
Copy link
Contributor Author

@Kontinuation @zhangfengcdt Can we also emit the values of non-spatial fields to provide more hints?

I don't think it is possible given the current approach to solve this problem.

Another concern is: sometimes the exceptions is not raised by ourselves, but somewhere inside JTS. This mostly happens in overlay functions (intersection, union, etc) and some topology-preserving transformation functions. We have to catch exceptions thrown by JTS and convert them to our own IllegalGeometryException exception, this is very tedious and certainly not what we want to do.

Thanks, @Kontinuation @jiayuasu for the suggestions. I have refactor the code to add the input row string to the exceptions. Also, in case input is null (e.g., rows are created in test using SQL literals), I add the literals to the exception. This will help with the debug cases as well.

@jiayuasu jiayuasu merged commit 9cdb052 into apache:master Jul 23, 2024
50 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants