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


##########
rust/sedona-spatial-join/src/stream.rs:
##########
@@ -213,16 +232,97 @@ impl SpatialJoinStream {
         }
     }
 
-    fn wait_build_index(
+    fn wait_create_spatial_join_components(
         &mut self,
         cx: &mut std::task::Context<'_>,
     ) -> Poll<Result<StatefulStreamResult<Option<RecordBatch>>>> {
-        let index = ready!(self.once_fut_spatial_index.get_shared(cx))?;
-        self.spatial_index = Some(index);
-        self.state = SpatialJoinStreamState::FetchProbeBatch;
+        if self.index_provider.is_none() {
+            let spatial_join_components =
+                ready!(self.once_fut_spatial_join_components.get_shared(cx))?;
+            let provider = 
Arc::clone(&spatial_join_components.partitioned_index_provider);
+            self.num_regular_partitions = 
Some(provider.num_regular_partitions() as u32);
+            self.index_provider = Some(provider);
+        }
+
+        let num_partitions = self
+            .num_regular_partitions
+            .expect("num_regular_partitions should be available");

Review Comment:
   I don't think so. `num_regular_partitions` must exist at this point and this 
can be easily proved. Something must be going very very wrong if `expect` 
panics. The same applies to the remaining .expect calls.



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