-
Notifications
You must be signed in to change notification settings - Fork 662
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-303] Port all Sedona Spark functions to Sedona Flink -- Step 1 #881
Merged
Merged
Changes from 5 commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
8000e06
feat: port 5 functions to flink
yyy1000 0a5e5de
feat: add convexHull
yyy1000 89f9fbf
feat: adjust function param in st_difference
yyy1000 c1200d9
fix: test ST_Dump
yyy1000 c105a4a
docs: add doc for newly added port flink functions
yyy1000 cf01592
docs: update version and format Example
yyy1000 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -431,6 +431,60 @@ Input: `MULTILINESTRING((0 0, 10 0, 10 10, 0 10, 0 0),(10 10, 20 10, 20 20, 10 2 | |
|
||
Output: `MULTIPOLYGON(((0 0,0 10,10 10,10 0,0 0)),((10 10,10 20,20 20,20 10,10 10)))` | ||
|
||
## ST_Centroid | ||
|
||
Introduction: Return the centroid point of A | ||
|
||
Format: `ST_Centroid (A:geometry)` | ||
|
||
Since: `v1.0.0` | ||
|
||
Spark SQL example: | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Don't use |
||
```sql | ||
SELECT ST_Centroid(polygondf.countyshape) | ||
FROM polygondf | ||
``` | ||
|
||
## ST_CollectionExtract | ||
|
||
Introduction: Returns a homogeneous multi-geometry from a given geometry collection. | ||
|
||
The type numbers are: | ||
1. POINT | ||
2. LINESTRING | ||
3. POLYGON | ||
|
||
If the type parameter is omitted a multi-geometry of the highest dimension is returned. | ||
|
||
Format: `ST_CollectionExtract (A:geometry)` | ||
|
||
Format: `ST_CollectionExtract (A:geometry, type:Int)` | ||
|
||
Since: `v1.2.1` | ||
|
||
Example: | ||
|
||
```sql | ||
WITH test_data as ( | ||
ST_GeomFromText( | ||
'GEOMETRYCOLLECTION(POINT(40 10), POLYGON((0 0, 0 5, 5 5, 5 0, 0 0)))' | ||
) as geom | ||
) | ||
SELECT ST_CollectionExtract(geom) as c1, ST_CollectionExtract(geom, 1) as c2 | ||
FROM test_data | ||
|
||
``` | ||
|
||
Result: | ||
|
||
``` | ||
+----------------------------------------------------------------------------+ | ||
|c1 |c2 | | ||
+----------------------------------------------------------------------------+ | ||
|MULTIPOLYGON(((0 0, 0 5, 5 5, 5 0, 0 0))) |MULTIPOINT(40 10) | | | ||
+----------------------------------------------------------------------------+ | ||
``` | ||
|
||
## ST_ConcaveHull | ||
|
||
Introduction: Return the Concave Hull of polgyon A, with alpha set to pctConvex[0, 1] in the Delaunay Triangulation method, the concave hull will not contain a hole unless allowHoles is set to true | ||
|
@@ -452,6 +506,20 @@ Input: `Polygon ((0 0, 1 2, 2 2, 3 2, 5 0, 4 0, 3 1, 2 1, 1 0, 0 0))` | |
|
||
Output: `POLYGON ((1 2, 2 2, 3 2, 5 0, 4 0, 1 0, 0 0, 1 2))` | ||
|
||
## ST_ConvexHull | ||
|
||
Introduction: Return the Convex Hull of polgyon A | ||
|
||
Format: `ST_ConvexHull (A:geometry)` | ||
|
||
Since: `v1.0.0` | ||
|
||
Spark SQL example: | ||
```sql | ||
SELECT ST_ConvexHull(polygondf.countyshape) | ||
FROM polygondf | ||
``` | ||
|
||
## ST_Dimension | ||
|
||
Introduction: Return the topological dimension of this Geometry object, which must be less than or equal to the coordinate dimension. OGC SPEC s2.1.1.1 - returns 0 for POINT, 1 for LINESTRING, 2 for POLYGON, and the largest dimension of the components of a GEOMETRYCOLLECTION. If the dimension is unknown (e.g. for an empty GEOMETRYCOLLECTION) 0 is returned. | ||
|
@@ -546,6 +614,42 @@ SELECT ST_Degrees(0.19739555984988044) | |
|
||
Output: 11.309932474020195 | ||
|
||
## ST_Difference | ||
|
||
Introduction: Return the difference between geometry A and B (return part of geometry A that does not intersect geometry B) | ||
|
||
Format: `ST_Difference (A:geometry, B:geometry)` | ||
|
||
Since: `v1.2.0` | ||
|
||
Example: | ||
|
||
```sql | ||
SELECT ST_Difference(ST_GeomFromWKT('POLYGON ((-3 -3, 3 -3, 3 3, -3 3, -3 -3))'), ST_GeomFromWKT('POLYGON ((0 -4, 4 -4, 4 4, 0 4, 0 -4))')) | ||
``` | ||
|
||
Result: | ||
|
||
``` | ||
POLYGON ((0 -3, -3 -3, -3 3, 0 3, 0 -3)) | ||
``` | ||
|
||
## ST_Dump | ||
|
||
Introduction: It expands the geometries. If the geometry is simple (Point, Polygon Linestring etc.) it returns the geometry | ||
itself, if the geometry is collection or multi it returns record for each of collection components. | ||
|
||
Format: `ST_Dump(geom: geometry)` | ||
|
||
Since: `v1.0.0` | ||
|
||
SQL example: | ||
```sql | ||
SELECT ST_Dump(ST_GeomFromText('MULTIPOINT ((10 40), (40 30), (20 20), (30 10))')) | ||
``` | ||
|
||
Output: `[POINT (10 40), POINT (40 30), POINT (20 20), POINT (30 10)]` | ||
|
||
## ST_Envelope | ||
|
||
Introduction: Return the envelop boundary of A | ||
|
This file contains 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
This file contains 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
This file contains 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
Oops, something went wrong.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
All version number should be
1.5.0
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Updated the docs.