tustvold commented on PR #4767:
URL: 
https://github.com/apache/arrow-datafusion/pull/4767#issuecomment-1367945554

   > One thing I wonder about is what happens if the same rule is run multiple 
times?
   
   This will be fine, there is a potential collision if the same rule appears 
multiple times in the same list of optimizers, i.e. something like
   
   
   ```
   let rules: Vec<Arc<dyn OptimizerRule + Sync + Send>> = vec![
       Arc::new(DecorrelateWhereIn::new()),
       Arc::new(ScalarSubqueryToJoin::new()),
       Arc::new(ScalarSubqueryToJoin::new()),
       ...
   ];
   ```
   
   However, this doesn't occur in practice and could easily be worked around by 
using
   
   ```
   let subquery = Arc::new(ScalarSubqueryToJoin::new());
   let rules: Vec<Arc<dyn OptimizerRule + Sync + Send>> = vec![
       Arc::new(DecorrelateWhereIn::new()),
       subquery.clone(),
       subquery,
       ...
   ];
   ```


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