liurenjie1024 commented on PR #241:
URL: https://github.com/apache/iceberg-rust/pull/241#issuecomment-2033371130

   > > which is somehow motivated by @viirya 's 
[pr](https://github.com/apache/iceberg-rust/pull/295/files#diff-a59622727cd67153abdf02031475bf8a1b1921738df4ca9903a685ff6970b7aaR472),
 but move the travsering flow out of trait body.
   > 
   > @liurenjie1024 ...so the traversal flow could then be implemented on e.g. 
the `ManifestEvaluator` itself. For example, `eval()` could call the 
corresponding 'visit_xx' on the visitor that implements 
`BoundPredicateVisitor`. Is this what you mean?
   
   I was thinking about following following structure:
   ```rust
   pub trait BoundPredicateVisitor {
     type T;
   
     fn visit_and(&mut self, values: [Self::T; 2]) -> Result<Self::T>;
     fn visit_or(&mut self, values: [Self::T; 2]) -> Result<Self::T>;
   
     ...
   }
   
   pub fn visit_bound_predicate(visitor: &mut V, predicate: &BoundPredicate) -> 
Result<V::T> {
      match predicate {
       BoundPredicate::And(children) => {
         let ret = [visit_bound_predicate(visitor, 
children[0]),visit_bound_predicate(visitor, children[1])];
         visitor.visit_and(ret)
     },
     ...
    }
   }
   
   pub struct ManifestEvaluator {}
   
   impl BoundPredicateVisitor  for ManifestEvaluator {}
   
   impl ManifestEvaluator  {
   
     pub fn eval(&mut self, predicate: &BoundPredicate) -> bool {
       visit_bound_predicate(self, predicate)?
     } 
   }
   ```


-- 
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: issues-unsubscr...@iceberg.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscr...@iceberg.apache.org
For additional commands, e-mail: issues-h...@iceberg.apache.org

Reply via email to