pwrliang commented on code in PR #465:
URL: https://github.com/apache/sedona-db/pull/465#discussion_r2705666043
##########
rust/sedona-spatial-join/src/exec.rs:
##########
@@ -1151,26 +1156,195 @@ mod tests {
let df = ctx.sql(sql).await?;
let actual_schema = df.schema().as_arrow().clone();
let plan = df.clone().create_physical_plan().await?;
- let spatial_join_execs = collect_spatial_join_exec(&plan)?;
+ let spatial_join_count = collect_spatial_join_exec(&plan)?;
if is_optimized_spatial_join {
- assert_eq!(spatial_join_execs.len(), 1);
+ assert_eq!(spatial_join_count, 1);
} else {
- assert!(spatial_join_execs.is_empty());
+ assert_eq!(spatial_join_count, 0);
}
let result_batches = df.collect().await?;
let result_batch =
arrow::compute::concat_batches(&Arc::new(actual_schema),
&result_batches)?;
Ok(result_batch)
}
- fn collect_spatial_join_exec(plan: &Arc<dyn ExecutionPlan>) ->
Result<Vec<&SpatialJoinExec>> {
- let mut spatial_join_execs = Vec::new();
+ fn collect_spatial_join_exec(plan: &Arc<dyn ExecutionPlan>) ->
Result<usize> {
+ let mut count = 0;
plan.apply(|node| {
- if let Some(spatial_join_exec) =
node.as_any().downcast_ref::<SpatialJoinExec>() {
- spatial_join_execs.push(spatial_join_exec);
+ if node.as_any().downcast_ref::<SpatialJoinExec>().is_some() {
+ count += 1;
+ }
+ #[cfg(feature = "gpu")]
+ if node
+ .as_any()
+ .downcast_ref::<sedona_spatial_join_gpu::GpuSpatialJoinExec>()
+ .is_some()
+ {
+ count += 1;
}
Ok(TreeNodeRecursion::Continue)
})?;
- Ok(spatial_join_execs)
+ Ok(count)
+ }
+
+ #[cfg(feature = "gpu")]
+ #[tokio::test]
+ #[ignore] // Requires GPU hardware
Review Comment:
Fixed.
--
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]