You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@sedona.apache.org by "petern48 (via GitHub)" <gi...@apache.org> on 2025/11/02 04:05:21 UTC
Re: [PR] feat(rust/sedona-functions): Add ST_Translate() [sedona-db]
petern48 commented on code in PR #267:
URL: https://github.com/apache/sedona-db/pull/267#discussion_r2484174734
##########
python/sedonadb/tests/functions/test_transforms.py:
##########
@@ -93,3 +93,32 @@ def test_st_crs_sedonadb(eng):
"SELECT ST_CRS(ST_SetCrs(ST_GeomFromText('POINT (1 1)'), NULL))",
None,
)
+
+
+@pytest.mark.parametrize("eng", [SedonaDB, PostGIS])
+@pytest.mark.parametrize(
+ ("geom", "dx", "dy", "expected"),
+ [
+ (None, None, None, None),
Review Comment:
```suggestion
(None, None, None, None),
(None, 1.0, 2.0, None),
```
nit: While I don't think it's necessary to test every single combination of nulls, I think it's nice to at least have a case for each arg where *only* that arg is null, so we know that arg on it's own is enough to trigger a null output. There are currently cases for only dx null, only dy null, but not "only geometry null" (which I'd guess is the most likely case).
##########
python/sedonadb/tests/functions/test_transforms.py:
##########
@@ -93,3 +93,32 @@ def test_st_crs_sedonadb(eng):
"SELECT ST_CRS(ST_SetCrs(ST_GeomFromText('POINT (1 1)'), NULL))",
None,
)
+
+
+@pytest.mark.parametrize("eng", [SedonaDB, PostGIS])
+@pytest.mark.parametrize(
+ ("geom", "dx", "dy", "expected"),
+ [
+ (None, None, None, None),
+ ("POINT (0 1)", 1.0, None, None),
+ ("POINT (0 1)", None, 2.0, None),
+ # WKT output of geoarrow-c is causing this (both correctly output
+ # empties)
+ ("POINT EMPTY", 1.0, 2.0, "POINT (nan nan)"),
+ ("POINT Z EMPTY", 1.0, 2.0, "POINT Z (nan nan nan)"),
+ ("POINT (0 1)", 1.0, 2.0, "POINT (1 3)"),
+ ("POINT Z (0 1 2)", 1.0, 2.0, "POINT Z (1 3 2)"),
+ ("LINESTRING EMPTY", 1.0, 2.0, "LINESTRING EMPTY"),
Review Comment:
optional: A few cases that aren't tested anywhere (in python or rust). I don't think any would fail, but I think some would be nice to test. Particularly non-point geoms, so it's clear it works on them too. Personally, I often look at tests to see how I can use a function when documentation isn't specific enough.
- geometry arg
- non-empty geometries other than POINT (e.g polygon, multi-*)
- any `M` dimension
- dx/dy arg
- zero or negative
- integers (inspired by this https://github.com/apache/sedona-db/pull/32)
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@sedona.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org