Skip to content
Merged
Show file tree
Hide file tree
Changes from 5 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
1 change: 0 additions & 1 deletion c/sedona-geos/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,6 @@ mod st_minimumclearance_line;
mod st_normalize;
mod st_nrings;
mod st_numinteriorrings;
mod st_numpoints;
mod st_perimeter;
mod st_polygonize;
mod st_polygonize_agg;
Expand Down
1 change: 0 additions & 1 deletion c/sedona-geos/src/register.rs
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,6 @@ pub fn scalar_kernels() -> Vec<(&'static str, Vec<ScalarKernelRef>)> {
"st_normalize" => crate::st_normalize::st_normalize_impl,
"st_nrings" => crate::st_nrings::st_nrings_impl,
"st_numinteriorrings" => crate::st_numinteriorrings::st_num_interior_rings_impl,
"st_numpoints" => crate::st_numpoints::st_num_points_impl,
"st_overlaps" => crate::binary_predicates::st_overlaps_impl,
"st_perimeter" => crate::st_perimeter::st_perimeter_impl,
"st_polygonize" => crate::st_polygonize::st_polygonize_impl,
Expand Down
146 changes: 0 additions & 146 deletions c/sedona-geos/src/st_numpoints.rs

This file was deleted.

2 changes: 2 additions & 0 deletions docs/reference/sql/st_npoints.qmd
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,8 @@ kernels:

Returns the total number of coordinate points in the geometry, counting all vertices across all components.

Aliases: `ST_NumPoints`.

## Examples

```sql
Expand Down
22 changes: 11 additions & 11 deletions python/sedonadb/tests/functions/test_functions.py
Original file line number Diff line number Diff line change
Expand Up @@ -3772,23 +3772,23 @@ def test_st_numinteriorrings_basic(eng, geom, expected):
("geom", "expected"),
[
(None, None),
("POINT EMPTY", None),
("POINT EMPTY", 0),
("LINESTRING EMPTY", 0),
("POLYGON EMPTY", None),
("MULTIPOINT EMPTY", None),
("MULTILINESTRING EMPTY", None),
("MULTIPOLYGON EMPTY", None),

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Sorry to bikeshed here, but can we just remove this test and add a second line to the ST_NPoints test? That will ensure that the behaviour stays in sync and any added parameters always apply to both.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

@paleolimbot Done - standalone test_st_numpoints removed and ST_NumPoints assertion added directly into test_st_points alongside ST_NPoints, sharing the same parametrized cases.

("GEOMETRYCOLLECTION EMPTY", None),
("POINT (1 2)", None),
("POLYGON EMPTY", 0),
("MULTIPOINT EMPTY", 0),
("MULTILINESTRING EMPTY", 0),
("MULTIPOLYGON EMPTY", 0),
("GEOMETRYCOLLECTION EMPTY", 0),
("POINT (1 2)", 1),
("LINESTRING (0 0, 1 1, 2 2)", 3),
("LINESTRING (0 0, 1 1, 0 0)", 3),
("LINESTRING Z (0 0 0, 1 1 1, 2 2 2, 3 3 3)", 4),
("LINESTRING M (0 0 0, 1 1 1, 2 2 2, 3 3 3)", 4),
("LINESTRING ZM (0 0 0 2, 1 1 1 4)", 2),
("POLYGON ((0 0, 4 0, 4 4, 0 4, 0 0))", None),
("MULTILINESTRING ((0 0, 0 1, 1 1, 0 0),(0 0, 1 1))", None),
("GEOMETRYCOLLECTION (LINESTRING (0 0, 0 1, 1 1, 0 0))", None),
("POLYGON ((0 0,6 0,6 6,0 6,0 0),(2 2,4 2,4 4,2 4,2 2))", None),
("POLYGON ((0 0, 4 0, 4 4, 0 4, 0 0))", 5),
("MULTILINESTRING ((0 0, 0 1, 1 1, 0 0),(0 0, 1 1))", 6),
("GEOMETRYCOLLECTION (LINESTRING (0 0, 0 1, 1 1, 0 0))", 4),
("POLYGON ((0 0,6 0,6 6,0 6,0 0),(2 2,4 2,4 4,2 4,2 2))", 10),
],
)
def test_st_numpoints(eng, geom, expected):
Expand Down
7 changes: 7 additions & 0 deletions rust/sedona-functions/src/st_points.rs
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,7 @@ pub fn st_npoints_udf() -> SedonaScalarUDF {
ItemCrsKernel::wrap_impl(vec![Arc::new(STNPoints)]),
Volatility::Immutable,
)
.with_aliases(vec!["st_numpoints".to_string()])
}

#[derive(Debug)]
Expand Down Expand Up @@ -296,6 +297,12 @@ mod tests {
assert!(st_npoints_udf.documentation().is_none());
}

#[test]
fn npoints_aliases() {
let udf: ScalarUDF = st_npoints_udf().into();
assert!(udf.aliases().contains(&"st_numpoints".to_string()));
}

#[rstest]
fn udf(#[values(WKB_GEOMETRY, WKB_GEOGRAPHY)] sedona_type: SedonaType) {
use arrow_array::UInt64Array;
Expand Down
Loading