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-643] [DOCS] Fix Flink constructor functions signatures & remove redundant docs #1549

Merged
merged 2 commits into from
Aug 15, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
52 changes: 14 additions & 38 deletions docs/api/flink/Constructor.md
Original file line number Diff line number Diff line change
Expand Up @@ -235,6 +235,8 @@ Introduction: Construct a Geometry from WKT. Alias of [ST_GeomFromWKT](#st_geom
Format:
`ST_GeomFromText (Wkt: String)`

`ST_GeomFromText (Wkt: String, srid: Integer)`

Since: `v1.2.1`

Example:
Expand All @@ -249,42 +251,6 @@ Output:
POINT(40.7128 -74.006)
```

## ST_GeomFromEWKB

Introduction: Construct a Geometry from EWKB string or Binary. This function is an alias of [ST_GeomFromWKB](#st_geomfromwkb).

Format:

`ST_GeomFromEWKB (Wkb: String)`

`ST_GeomFromEWKB (Wkb: Binary)`

Since: `v1.6.1`

SQL Example

```sql
SELECT ST_GeomFromEWKB([01 02 00 00 00 02 00 00 00 00 00 00 00 84 D6 00 C0 00 00 00 00 80 B5 D6 BF 00 00 00 60 E1 EF F7 BF 00 00 00 80 07 5D E5 BF])
```

Output:

```
LINESTRING (-2.1047439575195312 -0.354827880859375, -1.49606454372406 -0.6676061153411865)
```

SQL Example

```sql
SELECT ST_asEWKT(ST_GeomFromEWKB('01010000a0e6100000000000000000f03f000000000000f03f000000000000f03f'))
```

Output:

```
SRID=4326;POINT Z(1 1 1)
```

## ST_GeomFromWKB

Introduction: Construct a Geometry from WKB string or Binary. This function also supports EWKB format.
Expand Down Expand Up @@ -340,6 +306,8 @@ Introduction: Construct a Geometry from WKT
Format:
`ST_GeomFromWKT (Wkt: String)`

`ST_GeomFromWKT (Wkt: String, srid: Integer)`

Since: `v1.2.0`

Example:
Expand Down Expand Up @@ -484,7 +452,11 @@ LINESTRING (-2.1047439575195312 -0.354827880859375, -1.49606454372406 -0.6676061

Introduction: Construct a MultiLineString from Text and Optional SRID

Format: `ST_MLineFromText (Text: String, Srid: Integer)`
Format:

`ST_MLineFromText (Wkt: String)`

`ST_MLineFromText (Wkt: String, Srid: Integer)`

Since: `1.3.1`

Expand Down Expand Up @@ -528,7 +500,11 @@ MULTIPOINT ((10 10), (20 20), (30 30))

Introduction: Construct a MultiPolygon from Text and Optional SRID

Format: `ST_MPolyFromText (Text: String, Srid: Integer)`
Format:

`ST_MPolyFromText (Wkt: String)`

`ST_MPolyFromText (Wkt: String, Srid: Integer)`

Since: `1.3.1`

Expand Down
34 changes: 0 additions & 34 deletions docs/api/snowflake/vector-data/Constructor.md
Original file line number Diff line number Diff line change
Expand Up @@ -237,40 +237,6 @@ Output:
POINT(40.7128 -74.006)
```

## ST_GeomFromEWKB

Introduction: Construct a Geometry from EWKB string or Binary. This function is an alias of [ST_GeomFromWKB](#st_geomfromwkb).

Format:

`ST_GeomFromEWKB (Wkb: String)`

`ST_GeomFromEWKB (Wkb: Binary)`

SQL Example

```sql
SELECT ST_GeomFromEWKB([01 02 00 00 00 02 00 00 00 00 00 00 00 84 D6 00 C0 00 00 00 00 80 B5 D6 BF 00 00 00 60 E1 EF F7 BF 00 00 00 80 07 5D E5 BF])
```

Output:

```
LINESTRING (-2.1047439575195312 -0.354827880859375, -1.49606454372406 -0.6676061153411865)
```

SQL Example

```sql
SELECT ST_asEWKT(ST_GeomFromEWKB('01010000a0e6100000000000000000f03f000000000000f03f000000000000f03f'))
```

Output:

```
SRID=4326;POINT Z(1 1 1)
```

## ST_GeomFromWKB

Introduction: Construct a Geometry from WKB string or Binary. This function also supports EWKB format.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -241,6 +241,13 @@ public static class ST_GeomFromWKT extends ScalarFunction {
public Geometry eval(@DataTypeHint("String") String wktString) throws ParseException {
return org.apache.sedona.common.Constructors.geomFromWKT(wktString, 0);
}

@DataTypeHint(value = "RAW", bridgedTo = org.locationtech.jts.geom.Geometry.class)
public Geometry eval(
@DataTypeHint("String") String wktString, @DataTypeHint("Int") Integer srid)
throws ParseException {
return org.apache.sedona.common.Constructors.geomFromWKT(wktString, srid);
}
}

public static class ST_GeomFromEWKT extends ScalarFunction {
Expand Down Expand Up @@ -269,6 +276,13 @@ public static class ST_GeomFromText extends ScalarFunction {
public Geometry eval(@DataTypeHint("String") String wktString) throws ParseException {
return org.apache.sedona.common.Constructors.geomFromWKT(wktString, 0);
}

@DataTypeHint(value = "RAW", bridgedTo = org.locationtech.jts.geom.Geometry.class)
public Geometry eval(
@DataTypeHint("String") String wktString, @DataTypeHint("Int") Integer srid)
throws ParseException {
return org.apache.sedona.common.Constructors.geomFromWKT(wktString, srid);
}
}

public static class ST_GeomFromWKB extends ScalarFunction {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -287,6 +287,18 @@ public void testGeomFromWKT() {
$(polygonColNames[1]));
Row result = last(geomTable);
assertEquals(data.get(data.size() - 1).getField(0).toString(), result.getField(0).toString());

geomTable =
wktTable.select(
call(Constructors.ST_GeomFromWKT.class.getSimpleName(), $(polygonColNames[0]), 1111)
.as(polygonColNames[0]),
$(polygonColNames[1]));
int sridActual =
(int)
last(geomTable.select(
call(Functions.ST_SRID.class.getSimpleName(), $(polygonColNames[0]))))
.getField(0);
assertEquals(1111, sridActual);
}

@Test
Expand Down Expand Up @@ -316,6 +328,18 @@ public void testGeomFromText() {
$(polygonColNames[1]));
Row result = last(geomTable);
assertEquals(data.get(data.size() - 1).getField(0).toString(), result.getField(0).toString());

geomTable =
wktTable.select(
call(Constructors.ST_GeomFromText.class.getSimpleName(), $(polygonColNames[0]), 1111)
.as(polygonColNames[0]),
$(polygonColNames[1]));
int sridActual =
(int)
last(geomTable.select(
call(Functions.ST_SRID.class.getSimpleName(), $(polygonColNames[0]))))
.getField(0);
assertEquals(1111, sridActual);
}

@Test
Expand Down
Loading