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-294 | SEDONA-310] Add ST_Angle and ST_Degrees to sedona #870

Merged
merged 15 commits into from
Jun 29, 2023

Conversation

iGN5117
Copy link
Contributor

@iGN5117 iGN5117 commented Jun 24, 2023

Did you read the Contributor Guide?

Is this PR related to a JIRA ticket?

What changes were proposed in this PR?

  • Add ST_Angle to sedona
  • Add a utility function ST_Degrees to help convert radian angle to degrees, intended to be used with st_angle.

How was this patch tested?

Did this PR include necessary documentation updates?

  • Yes, I am adding a new API. I am using the 1.5.0 in since vX.Y.Z format.

# Conflicts:
#	common/src/main/java/org/apache/sedona/common/Functions.java
#	common/src/main/java/org/apache/sedona/common/utils/GeomUtils.java
#	common/src/test/java/org/apache/sedona/common/FunctionsTest.java
#	flink/src/main/java/org/apache/sedona/flink/Catalog.java
#	flink/src/test/java/org/apache/sedona/flink/FunctionTest.java
#	python/sedona/sql/st_functions.py
#	python/tests/sql/test_dataframe_api.py
#	python/tests/sql/test_function.py
#	sql/common/src/main/scala/org/apache/sedona/sql/UDF/Catalog.scala
#	sql/common/src/main/scala/org/apache/spark/sql/sedona_sql/expressions/Functions.scala
#	sql/common/src/test/scala/org/apache/sedona/sql/dataFrameAPITestScala.scala
#	sql/common/src/test/scala/org/apache/sedona/sql/functionTestScala.scala
# Conflicts:
#	common/src/test/java/org/apache/sedona/common/FunctionsTest.java
#	flink/src/main/java/org/apache/sedona/flink/Catalog.java
#	python/sedona/sql/st_functions.py
#	python/tests/sql/test_function.py
#	sql/common/src/main/scala/org/apache/sedona/sql/UDF/Catalog.scala
#	sql/common/src/main/scala/org/apache/spark/sql/sedona_sql/expressions/Functions.scala
#	sql/common/src/main/scala/org/apache/spark/sql/sedona_sql/expressions/st_functions.scala
#	sql/common/src/test/scala/org/apache/sedona/sql/dataFrameAPITestScala.scala
#	sql/common/src/test/scala/org/apache/sedona/sql/functionTestScala.scala
…_Angle

# Conflicts:
#	common/src/main/java/org/apache/sedona/common/Functions.java
#	common/src/main/java/org/apache/sedona/common/utils/GeomUtils.java
#	common/src/test/java/org/apache/sedona/common/FunctionsTest.java
#	docs/api/flink/Function.md
#	docs/api/sql/Function.md
#	flink/src/main/java/org/apache/sedona/flink/Catalog.java
#	flink/src/test/java/org/apache/sedona/flink/FunctionTest.java
#	python/sedona/sql/st_functions.py
#	python/tests/sql/test_dataframe_api.py
#	python/tests/sql/test_function.py
#	sql/common/src/main/scala/org/apache/sedona/sql/UDF/Catalog.scala
#	sql/common/src/main/scala/org/apache/spark/sql/sedona_sql/expressions/NullSafeExpressions.scala
#	sql/common/src/main/scala/org/apache/spark/sql/sedona_sql/expressions/st_functions.scala
#	sql/common/src/test/scala/org/apache/sedona/sql/dataFrameAPITestScala.scala
#	sql/common/src/test/scala/org/apache/sedona/sql/functionTestScala.scala
@@ -481,6 +515,11 @@ public static void affineGeom(Geometry geometry, Double a, Double b, Double d, D
geometry.geometryChanged();
}

public static double getFrechetDistance(Geometry g1, Geometry g2) {
Copy link
Member

Choose a reason for hiding this comment

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

Why is this PR adding getFrechetDistance?

@jiayuasu jiayuasu added this to the sedona-1.5.0 milestone Jun 26, 2023
# Conflicts:
#	common/src/main/java/org/apache/sedona/common/utils/GeomUtils.java
#	python/sedona/sql/st_functions.py
#	sql/common/src/test/scala/org/apache/sedona/sql/functionTestScala.scala
@jiayuasu
Copy link
Member

@iGN5117 Please refer to Kristin's latest PR for overloaded functions and fix your PR accordingly: https://github.com/apache/sedona/pull/874/files

# Conflicts:
#	sql/common/src/main/scala/org/apache/spark/sql/sedona_sql/expressions/Functions.scala
#	sql/common/src/main/scala/org/apache/spark/sql/sedona_sql/expressions/InferredExpression.scala
#	sql/common/src/test/scala/org/apache/sedona/sql/functionTestScala.scala
@jiayuasu
Copy link
Member

@iGN5117 Please this accordingly

# Conflicts:
#	common/src/main/java/org/apache/sedona/common/utils/GeomUtils.java
#	sql/common/src/main/scala/org/apache/spark/sql/sedona_sql/expressions/InferredExpression.scala
Computes the angle formed by vectors S1 - E1 and S2 - E2, where S and E denote start and end points respectively

!!!Note
If any other geometry type is provided, ST_Angle throws an IllegalArgumentException.
Copy link
Member

Choose a reason for hiding this comment

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

This needs to have indent otherwise mkdocs-materials cannot render it properly

Copy link
Member

Choose a reason for hiding this comment

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

Please fix this issue in both Spark and Flink docs

Copy link
Contributor Author

@iGN5117 iGN5117 Jun 29, 2023

Choose a reason for hiding this comment

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

Sorry about that, this got misplaced while resolving conflicts. This is now fixed

@jiayuasu jiayuasu merged commit cc3a012 into apache:master Jun 29, 2023
37 of 39 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.

None yet

2 participants