nastra commented on code in PR #118: URL: https://github.com/apache/iceberg-go/pull/118#discussion_r1719871272
########## table/evaluators.go: ########## @@ -0,0 +1,1125 @@ +// 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. + +package table + +import ( + "fmt" + "math" + "slices" + + "github.com/apache/iceberg-go" + "github.com/google/uuid" +) + +const ( + rowsMightMatch, rowsMustMatch = true, true + rowsCannotMatch, rowsMightNotMatch = false, false + inPredicateLimit = 200 +) + +// newManifestEvaluator returns a function that can be used to evaluate whether a particular +// manifest file has rows that might or might not match a given partition filter by using +// the stats provided in the partitions (UpperBound/LowerBound/ContainsNull/ContainsNaN). +func newManifestEvaluator(spec iceberg.PartitionSpec, schema *iceberg.Schema, partitionFilter iceberg.BooleanExpression, caseSensitive bool) (func(iceberg.ManifestFile) (bool, error), error) { + partType := spec.PartitionType(schema) + partSchema := iceberg.NewSchema(0, partType.FieldList...) + filter, err := iceberg.RewriteNotExpr(partitionFilter) + if err != nil { + return nil, err + } + + boundFilter, err := iceberg.BindExpr(partSchema, filter, caseSensitive) + if err != nil { + return nil, err + } + + return (&manifestEvalVisitor{partitionFilter: boundFilter}).Eval, nil +} + +type manifestEvalVisitor struct { Review Comment: I'm a little confused, is this new code or just code that has been moved around? -- 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