Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TSQL conditions raise error on empty values #262

Closed
goodmami opened this issue Dec 20, 2019 · 1 comment
Closed

TSQL conditions raise error on empty values #262

goodmami opened this issue Dec 20, 2019 · 1 comment
Labels
Milestone

Comments

@goodmami
Copy link
Member

goodmami commented Dec 20, 2019

Executing a TSQL regex-match condition on a column with empty values can raise an error as these values are cast to None:

$ delphin select 'i-id where error ~ "lexical gap"' mrs/
Traceback (most recent call last):
[...]
  File "/home/mwg/repos/pydelphin/delphin/tsql.py", line 422, in func
    return re.search(body[1], value)
  File "/usr/local/lib/python3.6/re.py", line 182, in search
    return _compile(pattern, flags).search(string)
TypeError: expected string or bytes-like object

The problem is that value (in tsql.py) is None. A similar error occurs when the query's datatype doesn't match the column's datatype (see #261) but this problem with None also occurs even when they do match.

Edit: changed the title and text because it occurs with other operators and datatypes (e.g, doing an inequality comparison on a missing :date value).

@goodmami goodmami changed the title TSQL regex-match conditions raise error on empty values TSQL conditions raise error on empty values Dec 20, 2019
@goodmami
Copy link
Member Author

Note that this behavior may be affected by #258, e.g., if the meaning of tsdb.cast() changes.

@goodmami goodmami added this to the v1.1.0 milestone Dec 20, 2019
@goodmami goodmami added the bug label Dec 20, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant