rdblue commented on code in PR #4815:
URL: https://github.com/apache/iceberg/pull/4815#discussion_r883871712
##########
python/tests/expressions/test_expressions_base.py:
##########
@@ -257,3 +317,111 @@ def test_bound_reference(table_schema_simple, foo_struct):
assert bound_ref1.eval(foo_struct) == "foovalue"
assert bound_ref2.eval(foo_struct) == 123
assert bound_ref3.eval(foo_struct) == True
+
+
+def test_boolean_expression_visitor():
+ """Test post-order traversal of boolean expression visit method"""
+ expr = base.And(
+ base.Or(base.Not(TestExpressionA()), base.Not(TestExpressionB()),
TestExpressionA(), TestExpressionB()),
+ base.Not(TestExpressionA()),
+ TestExpressionB(),
+ )
+ visitor = TestBooleanExpressionVisitor()
+ result = base.visit(expr, visitor=visitor)
+ assert result == [
+ "TestExpressionA",
+ "NOT",
+ "TestExpressionB",
+ "NOT",
+ "OR",
+ "TestExpressionA",
+ "OR",
+ "TestExpressionB",
+ "OR",
+ "TestExpressionA",
+ "NOT",
+ "AND",
+ "TestExpressionB",
+ "AND",
+ ]
+
+
+def test_or_with_always_true():
Review Comment:
This doesn't test the visitor, it is testing `Or.__new__` that simplifies
the expression as it is created. I think you can remove these and/or/false/true
tests and just go with the one above for now.
--
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]