laskoviymishka opened a new pull request, #2623: URL: https://github.com/apache/iceberg-go/pull/2623
`iceberg.VisitBoundPredicateRef` was exported and gated only by an `internal.BoundPredicateRef` parameter, but a caller in another module could still call it by letting generic type inference supply the zero value of the token, the same hole the decision log describes for `Schema.FieldsRef`. This PR removes the function and moves the zero-copy IN / NOT IN dispatch, including the precomputed extrema path through `VisitInWithExtrema`, into `VisitBoundPredicate`. That path is taken only for visitors with a `BorrowBoundSets(internal.BoundPredicateRef)` marker method, which code outside the module cannot declare because it cannot name the parameter type. The four evaluators in `table/evaluators.go` get the marker; they are unexported and not returned by any exported API, so they cannot be embedded from outside to inherit it. No exported signature mentions the token, and `releases.md` gets a compatibility note. The no-allocation and extrema tests now run through `VisitBoundPredicate` with a marked test visitor, plus a case showing that an unmarked visitor declaring `VisitInWithExtrema` gets `VisitIn`. A new test in `iceberg_test` checks that an external visitor receives detached sets for IN and NOT IN over string and binary literals: `Add` and mutating a `BinaryLiteral` do not reach the predicate, each visit gets its own set, and the extrema method is never called. I checked that the trusted tests fail when the marker is ignored and the external test fails when every visitor is treated as trusted. `go build ./...`, `go vet ./...` and the tests of the root, `internal` and `table` packages pass. The change also reflows one composite literal in `catalog/dynamodb/dynamodb_integration_test.go`, which already failed `golangci-lint fmt --diff` on main. Benchmarks with `-count=10 -benchmem`, main against this branch, for `BenchmarkManifestEvaluatorInPredicate`, `BenchmarkInclusiveMetricsEvalInPredicate`, `BenchmarkManifestEvaluatorBuiltInPartitions` and `BenchmarkInclusiveMetricsUnfiltered`: B/op and allocs/op are identical for every case. The time geomeans, before and after, are 134.3ns and 133.9ns for the manifest IN benchmark (-0.27%), 6.870ms and 7.092ms for the inclusive metrics IN benchmark (+3.22%), 21.06µs and 20.33µs for the built-in partitions benchmark (-3.46%), and 18.74ns and 19.06ns for the unfiltered inclusive metrics benchmark (+1.71%), or 42.42µs and 42.90µs (+1.14%) across all of them. Individual cases move by up to about 15% in both directions with wide confidence intervals on both sides, so I read this as noise rather than a cost of the extra type assertion. The marker method is exported in name only, since the types are unexported; reaching it through `reflect` grants nothing because it is a no-op. Part of #2062. AI-assisted, reviewed by a human. -- 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] --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
