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-333] Implement ST_GeomFromEWKT #937

Merged
merged 10 commits into from
Aug 2, 2023
Merged

Conversation

yyy1000
Copy link
Contributor

@yyy1000 yyy1000 commented Aug 1, 2023

Did you read the Contributor Guide?

Is this PR related to a JIRA ticket?

What changes were proposed in this PR?

Add ST_GeomFromEWKTto sedona-common, sedona-sql, sedona-flink, and the dataframe/python API.

How was this patch tested?

  1. Comprehensive unit tests in sedona-common
  2. Integration unit tests in sedona-sql, sedona-flink, and python.

Did this PR include necessary documentation updates?

  • Yes, I have updated the documentation update.

public void geomFromEWKT() throws ParseException {
assertNull(Constructors.geomFromEWKT(null));

Geometry geom = Constructors.geomFromEWKT("POINT (1 1)");
Copy link
Member

Choose a reason for hiding this comment

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

Please add one more test case SRID=4269;POINT (1 1) (no space between semicolon and the wkt string)


SQL example:
```sql
SELECT ST_GeomFromEWKT('SRID=4269;POINT(40.7128 -74.0060)')
Copy link
Member

Choose a reason for hiding this comment

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

Please print the result using ST_AsEWKT or ST_AsText . This will print SRID

def test_st_geom_from_ewkt(self):
input_df = self.spark.createDataFrame([("SRID=4269;LineString(1 2, 3 4)",)], ["ewkt"])
input_df.createOrReplaceTempView("input_ewkt")
line_df = self.spark.sql("select ST_LineFromText(ewkt) as geom from input_ewkt")
Copy link
Member

Choose a reason for hiding this comment

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

This test is not using ST_GeomFromEWKT

@@ -94,6 +94,13 @@ class dataFrameAPITestScala extends TestBaseScala {
assert(actualResult.getSRID == 4326)
}

it("passed st_geomfromewkt") {
val df = sparkSession.sql("SELECT ST_GeomFromEWKT('SRID=4269;POINT(0.0 1.0)')")
Copy link
Member

Choose a reason for hiding this comment

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

This test didn't test the DataFrame API

@@ -132,6 +133,17 @@ def ST_GeomFromWKT(wkt: ColumnOrName) -> Column:
"""
return _call_constructor_function("ST_GeomFromWKT", wkt)

@validate_argument_types
def ST_GeomFromEWKT(ewkt: ColumnOrName) -> Column:
Copy link
Member

Choose a reason for hiding this comment

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

This function is not tested.

@jiayuasu jiayuasu added this to the sedona-1.5.0 milestone Aug 1, 2023
@jiayuasu jiayuasu merged commit c340a97 into apache:master Aug 2, 2023
39 checks passed
@jiayuasu jiayuasu deleted the ewkt branch August 2, 2023 03:51
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