Kontinuation commented on code in PR #590:
URL: https://github.com/apache/sedona-db/pull/590#discussion_r2793621590
##########
rust/sedona-raster-functions/src/rs_srid.rs:
##########
@@ -97,45 +96,17 @@ impl SedonaScalarKernel for RsSrid {
let executor = RasterExecutor::new(arg_types, args);
let mut builder =
UInt32Builder::with_capacity(executor.num_iterations());
+ let mut crs_to_srid_mapping =
+ CachedCrsToSRIDMapping::with_capacity(executor.num_iterations());
executor.execute_raster_void(|_i, raster_opt| {
- match raster_opt {
- None => builder.append_null(),
- Some(raster) => {
- match raster.crs() {
- None => {
- // When no CRS is set, SRID is 0
- builder.append_value(0);
- }
- Some(crs_str) => {
- let crs = deserialize_crs(crs_str).map_err(|e| {
- DataFusionError::Execution(format!(
- "Failed to deserialize CRS: {e}"
- ))
- })?;
-
- match crs {
- Some(crs_ref) => {
- let srid = crs_ref.srid().map_err(|e| {
- DataFusionError::Execution(format!(
- "Failed to get SRID from CRS: {e}"
- ))
- })?;
-
- match srid {
- Some(srid_val) =>
builder.append_value(srid_val),
- None => {
- return
Err(DataFusionError::Execution(
- "CRS has no SRID".to_string(),
- ))
- }
- }
- }
- None => builder.append_value(0),
- }
- }
- }
- }
- }
+ let Some(raster) = raster_opt else {
+ builder.append_null();
+ return Ok(());
+ };
+
+ let maybe_crs = raster.crs_str_ref();
Review Comment:
This is intentional. crs_str_ref() returns reference with longer lifetime.
--
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]