jerry-024 commented on code in PR #760:
URL: https://github.com/apache/paimon-rust/pull/760#discussion_r3879744790
##########
crates/integrations/datafusion/src/lateral_vector_search.rs:
##########
@@ -398,17 +505,35 @@ impl LateralVectorSearchExec {
return empty_batch(self.output_schema.clone());
}
- let mut builder = self.target_table.new_batch_vector_search_builder();
- let results = builder
+ let (target_table, include_row_ids) = match &self.filter {
+ Some(filter) => {
+ let prepared = self
+ .prepared_filter
+ .get_or_try_init(|| {
+ self.target_table
+ .prepare_vector_search_filter(filter.clone())
+ })
+ .await
+ .map_err(to_datafusion_error)?;
+ (
+ prepared.table(),
Review Comment:
<!-- dlf-review -->
**[MAJOR]** The prepared scalar filter is cached for the lifetime of the
physical execution plan, so re-executing the same plan after the target table
advances keeps querying the snapshot selected by the first execution.
Scope the `OnceCell` to one query execution rather than storing it
permanently on the reusable `ExecutionPlan`; share only an execution-scoped
cache across partitions and batches.
--
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]