Skip to content

Commit

Permalink
Allow leading underscore in column name used in row filter (#1358)
Browse files Browse the repository at this point in the history
* 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
  • Loading branch information
vincenzon authored Nov 22, 2024
1 parent 7a83695 commit d86ab6e
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
2 changes: 1 addition & 1 deletion pyiceberg/expressions/parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@
NAN = CaselessKeyword("nan")
LIKE = CaselessKeyword("like")

unquoted_identifier = Word(alphas, alphanums + "_$")
unquoted_identifier = Word(alphas + "_", alphanums + "_$")
quoted_identifier = Suppress('"') + unquoted_identifier + Suppress('"')
identifier = MatchFirst([unquoted_identifier, quoted_identifier]).set_results_name("identifier")
column = DelimitedList(identifier, delim=".", combine=False).set_results_name("column")
Expand Down
4 changes: 4 additions & 0 deletions tests/expressions/test_parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,10 @@ def test_quoted_column() -> None:
assert EqualTo("foo", True) == parser.parse('"foo" = TRUE')


def test_leading_underscore() -> None:
assert EqualTo("_foo", True) == parser.parse("_foo = true")


def test_equals_true() -> None:
assert EqualTo("foo", True) == parser.parse("foo = true")
assert EqualTo("foo", True) == parser.parse("foo == TRUE")
Expand Down

0 comments on commit d86ab6e

Please sign in to comment.