You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
According to the OGC CQL2 documentation, a value of TRUE (case-insensitive) should be interpreted as a booleanLiteral value (see CQL2-Text example 14). So, for example, in the following query we should interpret attr as an attribute and TRUE as a booleanLiteral that we are comparing attr against:
attr = TRUE
However, the current CQL2 Text parser interprets the value of TRUE as an attribute. This leads to errors when we try to translate the AST to a backend like SQLAlchemy.
Steps to Reproduce:
frompygeofilterimportastfrompygeofilter.parsers.cql2_textimportparseresult=parse("attr = TRUE")
assertresult==ast.Equal(
ast.Attribute("attr"),
True,
)
# Assertion fails. The actual object is# ast.Equal(# ast.Attribute("attr"),# ast.Attribute("TRUE")# )
Possible Solution
I will put up a PR shortly with a possible solution that uses Lark's terminal priority to ensure that values of TRUE/true/FALSE/false are parsed as booleanLiteral values.
The text was updated successfully, but these errors were encountered:
System Info
Python Version: 3.10
OS: macOS Ventura 13.6.6
pygeofilter
Version: 0.2.1 (main
branch)Problem Description
According to the OGC CQL2 documentation, a value of
TRUE
(case-insensitive) should be interpreted as abooleanLiteral
value (see CQL2-Text example 14). So, for example, in the following query we should interpretattr
as an attribute andTRUE
as abooleanLiteral
that we are comparingattr
against:However, the current CQL2 Text parser interprets the value of
TRUE
as an attribute. This leads to errors when we try to translate the AST to a backend like SQLAlchemy.Steps to Reproduce:
Possible Solution
I will put up a PR shortly with a possible solution that uses Lark's terminal priority to ensure that values of
TRUE
/true
/FALSE
/false
are parsed asbooleanLiteral
values.The text was updated successfully, but these errors were encountered: