YinZheng-Sun opened a new pull request, #1004:
URL: https://github.com/apache/iceberg-cpp/pull/1004
## What
`IsBoundVisitor` previously returned an error for `AlwaysTrue`/`AlwaysFalse`,
so any expression tree that still contained a constant (e.g. built via
`And::Make` / `Or::Make` without folding) could not be checked.
This PR changes the visitor's internal result type to `std::optional<bool>`:
- `std::nullopt` means the subtree contains no references (`True`/`False`),
so constants are neutral when combining binding states:
`And(True, unbound)` is unbound and `And(True, bound)` is bound.
- Mixing bound and unbound predicates is now rejected with
`Found partially bound expression` instead of silently returning `false`.
- The public `IsBoundVisitor::IsBound()` API still returns a definite `bool`
(an expression with only constants is reported as not bound).
This follows Java's `IsBoundVisitor`.
## Why
Split out from #956
## Tests
- Updated `IsBoundVisitorTest` for constants and mixed binding states.
- Added `AndWithConstants` / `OrWithConstants` cases.
--
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]