@@ -130,7 +130,7 @@ class InclusiveMetricsVisitor : public BoundVisitor<bool> {
130130 // because lower <= a for all values of a in the file, f(lower) <= f(a).
131131 // when f(lower) >= X then f(a) >= f(lower) >= X, so there is no a such that f(a) < X
132132 // f(lower) >= X means rows cannot match
133- if (lit >= lower ) {
133+ if (lower >= lit ) {
134134 return ROWS_CANNOT_MATCH;
135135 }
136136
@@ -156,7 +156,7 @@ class InclusiveMetricsVisitor : public BoundVisitor<bool> {
156156 // because lower <= a for all values of a in the file, f(lower) <= f(a).
157157 // when f(lower) > X then f(a) >= f(lower) > X, so there is no a such that f(a) <= X
158158 // f(lower) > X means rows cannot match
159- if (lit > lower ) {
159+ if (lower > lit ) {
160160 return ROWS_CANNOT_MATCH;
161161 }
162162
@@ -176,7 +176,7 @@ class InclusiveMetricsVisitor : public BoundVisitor<bool> {
176176 }
177177 const auto & upper = upper_result.value ();
178178
179- if (lit <= upper ) {
179+ if (upper <= lit ) {
180180 return ROWS_CANNOT_MATCH;
181181 }
182182
@@ -195,7 +195,7 @@ class InclusiveMetricsVisitor : public BoundVisitor<bool> {
195195 return ROWS_MIGHT_MATCH;
196196 }
197197 const auto & upper = upper_result.value ();
198- if (lit < upper ) {
198+ if (upper < lit ) {
199199 return ROWS_CANNOT_MATCH;
200200 }
201201
@@ -222,7 +222,7 @@ class InclusiveMetricsVisitor : public BoundVisitor<bool> {
222222 return ROWS_MIGHT_MATCH;
223223 }
224224 const auto & upper = upper_result.value ();
225- if (upper != lit) {
225+ if (upper < lit) {
226226 return ROWS_CANNOT_MATCH;
227227 }
228228
@@ -257,7 +257,7 @@ class InclusiveMetricsVisitor : public BoundVisitor<bool> {
257257 const auto & lower = lower_result.value ();
258258 std::vector<Literal> literals;
259259 for (const auto & lit : literal_set) {
260- if (lit >= lower ) {
260+ if (lower <= lit ) {
261261 literals.emplace_back (lit);
262262 }
263263 }
@@ -317,7 +317,7 @@ class InclusiveMetricsVisitor : public BoundVisitor<bool> {
317317 // prefix
318318 int length = std::min (prefix.size (), lower_str.size ());
319319 // if prefix of lower bound is greater than prefix, rows cannot match
320- if (lower_str.substr (0 , length) > prefix. substr ( 0 , length) ) {
320+ if (lower_str.substr (0 , length) > prefix) {
321321 return ROWS_CANNOT_MATCH;
322322 }
323323
@@ -331,7 +331,7 @@ class InclusiveMetricsVisitor : public BoundVisitor<bool> {
331331 // prefix
332332 length = std::min (prefix.size (), upper_str.size ());
333333 // if prefix of upper bound is less than prefix, rows cannot match
334- if (upper_str.substr (0 , length) < prefix. substr ( 0 , length) ) {
334+ if (upper_str.substr (0 , length) < prefix) {
335335 return ROWS_CANNOT_MATCH;
336336 }
337337
@@ -524,10 +524,11 @@ InclusiveMetricsEvaluator::InclusiveMetricsEvaluator(
524524InclusiveMetricsEvaluator::~InclusiveMetricsEvaluator () = default ;
525525
526526Result<std::unique_ptr<InclusiveMetricsEvaluator>> InclusiveMetricsEvaluator::Make (
527- std::shared_ptr<Expression> expr, const Schema& schema, bool case_sensitive) {
527+ std::shared_ptr<Expression> expr, const std::shared_ptr<Schema>& schema,
528+ bool case_sensitive) {
528529 ICEBERG_ASSIGN_OR_RAISE (auto rewrite_expr, RewriteNot::Visit (std::move (expr)));
529530 ICEBERG_ASSIGN_OR_RAISE (auto bound_expr,
530- Binder::Bind (schema, rewrite_expr, case_sensitive));
531+ Binder::Bind (* schema, rewrite_expr, case_sensitive));
531532 return std::unique_ptr<InclusiveMetricsEvaluator>(
532533 new InclusiveMetricsEvaluator (std::move (bound_expr)));
533534}
0 commit comments