jesspav commented on code in PR #37:
URL: https://github.com/apache/sedona-db/pull/37#discussion_r2330813391


##########
rust/sedona-functions/src/st_setsrid.rs:
##########
@@ -42,22 +42,61 @@ pub fn st_set_srid_with_engine_udf(
     )
 }
 
+/// ST_SetCRS() scalar UDF implementation without CRS validation
+///
+/// An implementation of ST_SetCRS providing a scalar function implementation
+/// based on an optional [CrsEngine]. If provided, it will be used to validate
+/// The provided CRS (otherwise, all CRS input is applied without validation).
+pub fn st_set_crs_with_engine_udf(
+    engine: Option<Arc<dyn CrsEngine + Send + Sync>>,
+) -> SedonaScalarUDF {
+    SedonaScalarUDF::new(
+        "st_setcrs",
+        vec![Arc::new(STSetCRS { engine })],
+        Volatility::Immutable,
+        Some(set_crs_doc()),
+    )
+}
+
 /// ST_SetSRID() scalar UDF implementation without CRS validation
 ///
 /// See [st_set_srid_with_engine_udf] for a validating version of this function
 pub fn st_set_srid_udf() -> SedonaScalarUDF {
     st_set_srid_with_engine_udf(None)
 }
 
+/// ST_SetCRS() scalar UDF implementation without CRS validation
+///
+/// See [st_set_crs_with_engine_udf] for a validating version of this function
+pub fn st_set_crs_udf() -> SedonaScalarUDF {
+    st_set_crs_with_engine_udf(None)
+}
+
 fn set_srid_doc() -> Documentation {
+    Documentation::builder(
+        DOC_SECTION_OTHER,
+        "Sets the spatial reference system identifier (SRID) of the geometry.",
+        "ST_SetSRID (geom: Geometry, srid: Integer)",
+    )
+    .with_argument("geom", "geometry: Input geometry or geography")
+    .with_argument("srid", "srid: EPSG code to set (e.g., 4326)")
+    .with_sql_example(
+        "SELECT ST_SetSRID(ST_GeomFromWKT('POINT (-64.363049 45.091501)'), 
4326)".to_string(),
+    )
+    .build()
+}
+
+fn set_crs_doc() -> Documentation {
     Documentation::builder(
         DOC_SECTION_OTHER,
         "Set CRS information for a geometry or geography",
         "ST_SetSRID (geom: Geometry, crs: String)",

Review Comment:
   thank you co-pilot! Fixed in new iter. 



##########
rust/sedona-functions/src/st_setsrid.rs:
##########
@@ -42,22 +42,61 @@ pub fn st_set_srid_with_engine_udf(
     )
 }
 
+/// ST_SetCRS() scalar UDF implementation without CRS validation
+///
+/// An implementation of ST_SetCRS providing a scalar function implementation
+/// based on an optional [CrsEngine]. If provided, it will be used to validate
+/// The provided CRS (otherwise, all CRS input is applied without validation).
+pub fn st_set_crs_with_engine_udf(
+    engine: Option<Arc<dyn CrsEngine + Send + Sync>>,
+) -> SedonaScalarUDF {
+    SedonaScalarUDF::new(
+        "st_setcrs",
+        vec![Arc::new(STSetCRS { engine })],
+        Volatility::Immutable,
+        Some(set_crs_doc()),
+    )
+}
+
 /// ST_SetSRID() scalar UDF implementation without CRS validation
 ///
 /// See [st_set_srid_with_engine_udf] for a validating version of this function
 pub fn st_set_srid_udf() -> SedonaScalarUDF {
     st_set_srid_with_engine_udf(None)
 }
 
+/// ST_SetCRS() scalar UDF implementation without CRS validation
+///
+/// See [st_set_crs_with_engine_udf] for a validating version of this function
+pub fn st_set_crs_udf() -> SedonaScalarUDF {
+    st_set_crs_with_engine_udf(None)
+}
+
 fn set_srid_doc() -> Documentation {
+    Documentation::builder(
+        DOC_SECTION_OTHER,
+        "Sets the spatial reference system identifier (SRID) of the geometry.",
+        "ST_SetSRID (geom: Geometry, srid: Integer)",
+    )
+    .with_argument("geom", "geometry: Input geometry or geography")
+    .with_argument("srid", "srid: EPSG code to set (e.g., 4326)")
+    .with_sql_example(
+        "SELECT ST_SetSRID(ST_GeomFromWKT('POINT (-64.363049 45.091501)'), 
4326)".to_string(),
+    )
+    .build()
+}
+
+fn set_crs_doc() -> Documentation {
     Documentation::builder(
         DOC_SECTION_OTHER,
         "Set CRS information for a geometry or geography",
         "ST_SetSRID (geom: Geometry, crs: String)",
     )
     .with_argument("geom", "geometry: Input geometry or geography")
-    .with_argument("crs", "string: Coordinate reference system identifier")
-    .with_argument("crs", "string: CRS identifier to set (e.g., 'OGC:CRS84')")
+    .with_argument(
+        "crs",
+        "string: Coordinate reference system identifier (e.g., 'OGC:CRS84')",
+    )
     .with_sql_example(
         "SELECT ST_SetSRID(ST_GeomFromWKT('POINT (-64.363049 45.091501)'), 
'OGC:CRS84')"

Review Comment:
   thank you co-pilot! Fixed in new iter. 



-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to