xgbtxy opened a new pull request, #2793:
URL: https://github.com/apache/iceberg-go/pull/2793
## Summary
Fixes `SanitizeExpression` dropping the parent struct path on bound
predicates over nested struct columns.
## Problem
In `visitors.go`, `sanitizeVisitor.VisitBound` previously reconstructed the
unbound column reference using:
```go
ref := Reference(pred.Term().Ref().Field().Name)
```
For nested struct fields (e.g., `user.email` or `bucket[16](user.id)`),
`Field().Name` contains only the leaf name (`email`, `id`), whereas `boundRef`
preserves the canonical dotted schema path in `fullName` via `referenceName()`
(already used by `boundRef.MarshalJSON` and `BoundTransform.MarshalJSON` in
`expr_json.go`).
This caused `SanitizeExpression` to silently drop parent struct prefixes
when given a bound expression:
- `SanitizeExpression(unbound("user.email"))` produced `"term": "user.email"`
- `SanitizeExpression(bound("user.email"))` produced `"term": "email"`
## Changes
- Extract unexported `boundRefName(ref BoundReference) string` helper in
`expr_json.go` (reused by `BoundTransform.MarshalJSON`).
- Use `boundRefName(pred.Term().Ref())` in `sanitizeVisitor.VisitBound`
(`visitors.go`).
- Add `TestSanitizeExpressionBoundNestedField` in `visitors_test.go`
covering bound nested literal, set (`IN`), unary (`IS NULL`), transform
(`bucket[16]`), and case-insensitive predicates.
## Verification
- Confirmed `TestSanitizeExpressionBoundNestedField` failed before the fix
(`"email"` / `"id"` instead of `"user.email"` / `"user.id"`).
- Ran `go test .` and `go vet .` (all passing).
--
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]