We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent bfb46a6 commit 9657a5eCopy full SHA for 9657a5e
5 files changed
python/sedonadb/tests/functions/test_transforms.py
@@ -50,19 +50,17 @@ def test_st_setsrid(eng, geom, srid, expected_srid):
50
assert df.crs == pyproj.CRS(expected_srid)
51
52
53
-# PostGIS does not handle String CRS input to ST_SetSrid
+# PostGIS does not have an API ST_SetCrs
54
@pytest.mark.parametrize("eng", [SedonaDB])
55
@pytest.mark.parametrize(
56
- ("geom", "srid", "expected_srid"),
+ ("geom", "crs", "expected_srid"),
57
[
58
("POINT (1 1)", "EPSG:26920", 26920),
59
("POINT (1 1)", pyproj.CRS("EPSG:26920").to_json(), 26920),
60
],
61
)
62
-def test_st_setsrid_sedonadb(eng, geom, srid, expected_srid):
+def test_st_setcrs_sedonadb(eng, geom, crs, expected_srid):
63
eng = eng.create_or_skip()
64
- result = eng.execute_and_collect(
65
- f"SELECT ST_SetSrid({geom_or_null(geom)}, '{srid}')"
66
- )
+ result = eng.execute_and_collect(f"SELECT ST_SetCrs({geom_or_null(geom)}, '{crs}')")
67
df = eng.result_to_pandas(result)
68
assert df.crs.to_epsg() == expected_srid
python/sedonadb/tests/io/test_parquet.py
@@ -102,7 +102,7 @@ def test_read_geoparquet_pruned(geoarrow_data, name):
102
result = eng.execute_and_collect(
103
f"""
104
SELECT "OBJECTID", geometry FROM tab
105
- WHERE ST_Intersects(geometry, ST_SetSRID({geom_or_null(wkt_filter)}, '{gdf.crs.to_json()}'))
+ WHERE ST_Intersects(geometry, ST_SetCRS({geom_or_null(wkt_filter)}, '{gdf.crs.to_json()}'))
106
ORDER BY "OBJECTID";
107
"""
108
@@ -127,7 +127,7 @@ def test_read_geoparquet_pruned(geoarrow_data, name):
127
128
129
SELECT * FROM tab_dataset
130
131
132
133
rust/sedona-expr/src/scalar_udf.rs
@@ -207,6 +207,11 @@ impl ArgMatcher {
207
Arc::new(IsGeography {})
208
}
209
210
+ /// Matches a null argument
211
+ pub fn is_null() -> Arc<dyn TypeMatcher + Send + Sync> {
212
+ Arc::new(IsNull {})
213
+ }
214
+
215
/// Matches any numeric argument
216
pub fn is_numeric() -> Arc<dyn TypeMatcher + Send + Sync> {
217
Arc::new(IsNumeric {})
@@ -371,6 +376,14 @@ impl TypeMatcher for IsBoolean {
371
376
372
377
373
378
379
+#[derive(Debug)]
380
+struct IsNull {}
381
+impl TypeMatcher for IsNull {
382
+ fn match_type(&self, arg: &SedonaType) -> bool {
383
+ matches!(arg, SedonaType::Arrow(DataType::Null))
384
385
+}
386
374
387
/// Type definition for a Scalar kernel implementation function
375
388
pub type SedonaScalarKernelImpl =
389
Arc<dyn Fn(&[SedonaType], &[ColumnarValue]) -> Result<ColumnarValue> + Send + Sync>;
@@ -602,6 +615,9 @@ mod tests {
602
615
603
616
assert!(ArgMatcher::is_boolean().match_type(&SedonaType::Arrow(DataType::Boolean)));
604
617
assert!(!ArgMatcher::is_boolean().match_type(&SedonaType::Arrow(DataType::Int32)));
618
619
+ assert!(ArgMatcher::is_null().match_type(&SedonaType::Arrow(DataType::Null)));
620
+ assert!(!ArgMatcher::is_null().match_type(&SedonaType::Arrow(DataType::Int32)));
605
621
606
622
607
623
#[test]
rust/sedona-functions/src/register.rs
@@ -85,6 +85,7 @@ pub fn default_function_set() -> FunctionSet {
85
crate::st_pointzm::st_pointm_udf,
86
crate::st_pointzm::st_pointzm_udf,
87
crate::st_transform::st_transform_udf,
88
+ crate::st_setsrid::st_set_crs_udf,
89
crate::st_setsrid::st_set_srid_udf,
90
crate::st_srid::st_srid_udf,
91
crate::st_xyzm::st_m_udf,
@@ -124,6 +125,7 @@ pub mod stubs {
124
125
pub use crate::st_area::st_area_udf;
126
pub use crate::st_length::st_length_udf;
pub use crate::st_perimeter::st_perimeter_udf;
+ pub use crate::st_setsrid::st_set_crs_with_engine_udf;
pub use crate::st_setsrid::st_set_srid_with_engine_udf;
pub use crate::st_transform::st_transform_udf;
0 commit comments