Skip to content
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
64 changes: 64 additions & 0 deletions python/sedonadb/tests/functions/test_functions.py
Original file line number Diff line number Diff line change
Expand Up @@ -588,6 +588,70 @@ def test_st_point(eng, x, y, expected):
)


@pytest.mark.parametrize("eng", [SedonaDB, PostGIS])
@pytest.mark.parametrize(
("x", "y", "z", "expected"),
[
(None, None, None, None),
(1, None, None, None),
(None, 1, None, None),
(None, None, 1, None),
(1, 1, 1, "POINT Z (1 1 1)"),
(1.0, 1.0, 1.0, "POINT Z (1 1 1)"),
(10, -1.5, 1.0, "POINT Z (10 -1.5 1)"),
],
)
def test_st_pointz(eng, x, y, z, expected):
eng = eng.create_or_skip()
eng.assert_query_result(
f"SELECT ST_PointZ({val_or_null(x)}, {val_or_null(y)}, {val_or_null(z)})",
expected,
)


@pytest.mark.parametrize("eng", [SedonaDB, PostGIS])
@pytest.mark.parametrize(
("x", "y", "m", "expected"),
[
(None, None, None, None),
(1, None, None, None),
(None, 1, None, None),
(None, None, 1, None),
(1, 1, 1, "POINT M (1 1 1)"),
(1.0, 1.0, 1.0, "POINT M (1 1 1)"),
(10, -1.5, 1.0, "POINT M (10 -1.5 1)"),
],
)
def test_st_pointm(eng, x, y, m, expected):
eng = eng.create_or_skip()
eng.assert_query_result(
f"SELECT ST_PointM({val_or_null(x)}, {val_or_null(y)}, {val_or_null(m)})",
expected,
)


@pytest.mark.parametrize("eng", [SedonaDB, PostGIS])
@pytest.mark.parametrize(
("x", "y", "z", "m", "expected"),
[
(None, None, None, None, None),
(1, None, None, None, None),
(None, 1, None, None, None),
(None, None, 1, None, None),
(None, None, None, 1, None),
(1, 1, 1, 1, "POINT ZM (1 1 1 1)"),
(1.0, 1.0, 1.0, 1.0, "POINT ZM (1 1 1 1)"),
(10, -1.5, 1.0, 1.0, "POINT ZM (10 -1.5 1 1)"),
],
)
def test_st_pointzm(eng, x, y, z, m, expected):
eng = eng.create_or_skip()
eng.assert_query_result(
f"SELECT ST_PointZM({val_or_null(x)}, {val_or_null(y)}, {val_or_null(z)}, {val_or_null(m)})",
expected,
)


@pytest.mark.parametrize("eng", [SedonaDB, PostGIS])
@pytest.mark.parametrize(
("geom", "expected"),
Expand Down
37 changes: 37 additions & 0 deletions rust/sedona-functions/benches/native-functions.rs
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,43 @@ fn criterion_benchmark(c: &mut Criterion) {
BenchmarkArgs::ArrayArray(Float64(0.0, 100.0), Float64(0.0, 100.0)),
);

benchmark::scalar(
c,
&f,
"native",
"st_pointz",
BenchmarkArgs::ArrayArrayArray(
Float64(0.0, 100.0),
Float64(0.0, 100.0),
Float64(0.0, 100.0),
),
);

benchmark::scalar(
c,
&f,
"native",
"st_pointm",
BenchmarkArgs::ArrayArrayArray(
Float64(0.0, 100.0),
Float64(0.0, 100.0),
Float64(0.0, 100.0),
),
);

benchmark::scalar(
c,
&f,
"native",
"st_pointzm",
BenchmarkArgs::ArrayArrayArrayArray(
Float64(0.0, 100.0),
Float64(0.0, 100.0),
Float64(0.0, 100.0),
Float64(0.0, 100.0),
),
);

benchmark::scalar(c, &f, "native", "st_hasz", Point);
benchmark::scalar(c, &f, "native", "st_hasz", LineString(10));

Expand Down
1 change: 1 addition & 0 deletions rust/sedona-functions/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ mod st_isempty;
mod st_length;
mod st_perimeter;
mod st_point;
mod st_pointzm;
mod st_setsrid;
mod st_transform;
pub mod st_union_aggr;
Expand Down
3 changes: 3 additions & 0 deletions rust/sedona-functions/src/register.rs
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,9 @@ pub fn default_function_set() -> FunctionSet {
crate::st_perimeter::st_perimeter_udf,
crate::st_point::st_geogpoint_udf,
crate::st_point::st_point_udf,
crate::st_pointzm::st_pointz_udf,
crate::st_pointzm::st_pointm_udf,
crate::st_pointzm::st_pointzm_udf,
crate::st_transform::st_transform_udf,
crate::st_setsrid::st_set_srid_udf,
crate::st_xyzm::st_m_udf,
Expand Down
Loading