This is an automated email from the ASF dual-hosted git repository.

gangwu pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/iceberg-cpp.git


The following commit(s) were added to refs/heads/main by this push:
     new 93bf6ac0 chore: fix IsBoundVisitor to error on AlwaysTrue & 
AlwaysFalse (#503)
93bf6ac0 is described below

commit 93bf6ac075e468d5f7fe7e24efd5be56a872b322
Author: Junwang Zhao <[email protected]>
AuthorDate: Wed Jan 14 14:21:32 2026 +0800

    chore: fix IsBoundVisitor to error on AlwaysTrue & AlwaysFalse (#503)
---
 src/iceberg/expression/binder.cc            |  8 ++++++--
 src/iceberg/test/expression_visitor_test.cc | 10 +++++-----
 2 files changed, 11 insertions(+), 7 deletions(-)

diff --git a/src/iceberg/expression/binder.cc b/src/iceberg/expression/binder.cc
index 650dc730..9474151d 100644
--- a/src/iceberg/expression/binder.cc
+++ b/src/iceberg/expression/binder.cc
@@ -85,9 +85,13 @@ Result<bool> IsBoundVisitor::IsBound(const 
std::shared_ptr<Expression>& expr) {
   return Visit<bool, IsBoundVisitor>(expr, visitor);
 }
 
-Result<bool> IsBoundVisitor::AlwaysTrue() { return true; }
+Result<bool> IsBoundVisitor::AlwaysTrue() {
+  return InvalidExpression("IsBoundVisitor does not support AlwaysTrue 
expression");
+}
 
-Result<bool> IsBoundVisitor::AlwaysFalse() { return true; }
+Result<bool> IsBoundVisitor::AlwaysFalse() {
+  return InvalidExpression("IsBoundVisitor does not support AlwaysFalse 
expression");
+}
 
 Result<bool> IsBoundVisitor::Not(bool child_result) { return child_result; }
 
diff --git a/src/iceberg/test/expression_visitor_test.cc 
b/src/iceberg/test/expression_visitor_test.cc
index 697c0096..97d70d7a 100644
--- a/src/iceberg/test/expression_visitor_test.cc
+++ b/src/iceberg/test/expression_visitor_test.cc
@@ -296,14 +296,14 @@ TEST_F(BinderTest, ErrorNestedUnboundField) {
 class IsBoundVisitorTest : public ExpressionVisitorTest {};
 
 TEST_F(IsBoundVisitorTest, Constants) {
-  // True and False are always considered bound
+  // True and False should error out
   auto true_expr = Expressions::AlwaysTrue();
-  ICEBERG_UNWRAP_OR_FAIL(auto is_bound_true, 
IsBoundVisitor::IsBound(true_expr));
-  EXPECT_TRUE(is_bound_true);
+  auto result_true = IsBoundVisitor::IsBound(true_expr);
+  EXPECT_THAT(result_true, IsError(ErrorKind::kInvalidExpression));
 
   auto false_expr = Expressions::AlwaysFalse();
-  ICEBERG_UNWRAP_OR_FAIL(auto is_bound_false, 
IsBoundVisitor::IsBound(false_expr));
-  EXPECT_TRUE(is_bound_false);
+  auto result_false = IsBoundVisitor::IsBound(false_expr);
+  EXPECT_THAT(result_false, IsError(ErrorKind::kInvalidExpression));
 }
 
 TEST_F(IsBoundVisitorTest, UnboundPredicate) {

Reply via email to