Kontinuation commented on code in PR #508:
URL: https://github.com/apache/sedona-db/pull/508#discussion_r2684818015


##########
rust/sedona-spatial-join/src/exec.rs:
##########
@@ -1173,4 +1202,157 @@ mod tests {
         })?;
         Ok(spatial_join_execs)
     }
+
+    fn extract_geoms_and_ids(partitions: &[Vec<RecordBatch>]) -> Vec<(i32, 
geo::Geometry<f64>)> {
+        let mut result = Vec::new();
+        for partition in partitions {
+            for batch in partition {
+                let id_idx = batch.schema().index_of("id").expect("Id column 
not found");
+                let ids = batch
+                    .column(id_idx)
+                    .as_any()
+                    .downcast_ref::<arrow_array::Int32Array>()
+                    .expect("Column 'id' should be Int32");
+
+                let geom_idx = batch
+                    .schema()
+                    .index_of("geometry")
+                    .expect("Geometry column not found");
+                let geoms_col = batch.column(geom_idx);
+                let geoms_binary = geoms_col
+                    .as_any()
+                    .downcast_ref::<arrow_array::BinaryArray>();
+                let geoms_binary_view = geoms_col
+                    .as_any()
+                    .downcast_ref::<arrow_array::BinaryViewArray>();
+
+                if geoms_binary.is_none() && geoms_binary_view.is_none() {
+                    panic!(
+                        "Column 'geometry' should be Binary or BinaryView. 
Schema: {:?}",
+                        batch.schema()
+                    );
+                }

Review Comment:
   Refactored this code to use an executor.



-- 
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