diff --git a/pyiceberg/expressions/parser.py b/pyiceberg/expressions/parser.py index d6d5bdb794..6b3eba91ac 100644 --- a/pyiceberg/expressions/parser.py +++ b/pyiceberg/expressions/parser.py @@ -252,4 +252,4 @@ def handle_or(result: ParseResults) -> Or: def parse(expr: str) -> BooleanExpression: """Parse a boolean expression.""" - return boolean_expression.parse_string(expr)[0] + return boolean_expression.parse_string(expr, parse_all=True)[0] diff --git a/tests/expressions/test_parser.py b/tests/expressions/test_parser.py index f4bebca066..fdfdcf55fc 100644 --- a/tests/expressions/test_parser.py +++ b/tests/expressions/test_parser.py @@ -166,3 +166,10 @@ def test_starts_with() -> None: def test_not_starts_with() -> None: assert NotStartsWith("foo", "data") == parser.parse("foo NOT LIKE 'data'") + + +def test_with_function() -> None: + with pytest.raises(ParseException) as exc_info: + parser.parse("foo = 1 and lower(bar) = '2'") + + assert "Expected end of text, found 'and'" in str(exc_info)