Skip to content

Commit d86ab6e

Browse files
authored
Allow leading underscore in column name used in row filter (#1358)
* Update parser.py Allow leading underscore in column name used in row filter. * Update test_parser.py * Update test_parser.py * Update test_parser.py
1 parent 7a83695 commit d86ab6e

File tree

2 files changed

+5
-1
lines changed

2 files changed

+5
-1
lines changed

pyiceberg/expressions/parser.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@
7979
NAN = CaselessKeyword("nan")
8080
LIKE = CaselessKeyword("like")
8181

82-
unquoted_identifier = Word(alphas, alphanums + "_$")
82+
unquoted_identifier = Word(alphas + "_", alphanums + "_$")
8383
quoted_identifier = Suppress('"') + unquoted_identifier + Suppress('"')
8484
identifier = MatchFirst([unquoted_identifier, quoted_identifier]).set_results_name("identifier")
8585
column = DelimitedList(identifier, delim=".", combine=False).set_results_name("column")

tests/expressions/test_parser.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,10 @@ def test_quoted_column() -> None:
5353
assert EqualTo("foo", True) == parser.parse('"foo" = TRUE')
5454

5555

56+
def test_leading_underscore() -> None:
57+
assert EqualTo("_foo", True) == parser.parse("_foo = true")
58+
59+
5660
def test_equals_true() -> None:
5761
assert EqualTo("foo", True) == parser.parse("foo = true")
5862
assert EqualTo("foo", True) == parser.parse("foo == TRUE")

0 commit comments

Comments
 (0)