paleolimbot commented on code in PR #90:
URL: https://github.com/apache/sedona-db/pull/90#discussion_r2352581521


##########
rust/sedona-functions/src/executor.rs:
##########
@@ -119,6 +119,43 @@ impl<'a, 'b, Factory0: GeometryFactory, Factory1: 
GeometryFactory>
         }
     }
 
+    /// Execute a function by iterating over [Wkb]'s raw binary representation.
+    /// The provided `func` can assume its input bytes is a valid [Wkb] binary.
+    ///
+    /// This function assumes the first argument from the executor is either a 
[SedonaType::Wkb]
+    /// or [SedonaType::WkbView] type. If other type is provided, an error 
will be
+    /// thrown.
+    pub fn execute_wkb_bytes_void<F: FnMut(Option<&'b [u8]>) -> Result<()>>(
+        &self,
+        mut func: F,
+    ) -> Result<()> {

Review Comment:
   It would probably be better to use the `GeometryFactory`/generic executor to 
do this. I believe something like this works (and is what we do for iterating 
over things that aren't `wkb::Wkb` from other libraries).
   
   ```rust
   struct WkbBytesFactory {}
   
   impl GeometryFactory for WkbBytesFactory {
   
       fn try_from_wkb<'a>(&self, wkb_bytes: &'a [u8]) -> Result<&'a [u8]> { 
Ok(wkb_bytes) }
   
   }
   
   type WkbBytesExecutor = GenericExecutor<WkbBytesFactory, WkbBytesFactory>;
   ```



-- 
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-unsubscr...@sedona.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to