marvinlanhenke commented on code in PR #347:
URL: https://github.com/apache/iceberg-rust/pull/347#discussion_r1583517231


##########
crates/iceberg/src/expr/visitors/inclusive_metrics_evaluator.rs:
##########
@@ -0,0 +1,744 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements.  See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership.  The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License.  You may obtain a copy of the License at
+//
+//   http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied.  See the License for the
+// specific language governing permissions and limitations
+// under the License.
+
+use crate::expr::visitors::bound_predicate_visitor::{visit, 
BoundPredicateVisitor};
+use crate::expr::{BoundPredicate, BoundReference};
+use crate::spec::{DataFile, Datum, Literal, PrimitiveLiteral};
+use crate::{Error, ErrorKind};
+use fnv::FnvHashSet;
+
+const IN_PREDICATE_LIMIT: usize = 200;
+const ROWS_MIGHT_MATCH: crate::Result<bool> = Ok(true);
+const ROWS_CANNOT_MATCH: crate::Result<bool> = Ok(false);
+
+pub(crate) struct InclusiveMetricsEvaluator<'a> {
+    data_file: &'a DataFile,
+}
+
+impl<'a> InclusiveMetricsEvaluator<'a> {
+    fn new(data_file: &'a DataFile) -> Self {
+        InclusiveMetricsEvaluator { data_file }
+    }
+
+    /// Evaluate this `InclusiveMetricsEvaluator`'s filter predicate against 
the
+    /// provided [`DataFile`]'s metrics. Used by [`TableScan`] to
+    /// see if this `DataFile` contains data that could match
+    /// the scan's filter.
+    pub(crate) fn eval(
+        filter: &'a BoundPredicate,

Review Comment:
   just an idea:
   Can we accept `&'a Option<BoundPredicate>` here?
   This way we can move the check if we have a row_filter at all from scan.rs 
into the `InclusiveMetricsEvaluator` itself and simply return 
`ROWS_MIGHT_MATCH` if BoundPredicate is None?



##########
crates/iceberg/src/scan.rs:
##########
@@ -218,6 +230,18 @@ impl TableScan {
 
                 let mut manifest_entries = 
iter(manifest.entries().iter().filter(|e| e.is_alive()));
                 while let Some(manifest_entry) = manifest_entries.next().await 
{
+
+                    if let Some(ref bound_predicate) = bound_predicate {

Review Comment:
   move the check into `InclusiveMetricsEvaluator` (see other comment), which 
returns ROWS_MIGHT_MATCH if bound_predicate is None. This way we could entangle 
the already involved plan_files method?
   



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