-
Notifications
You must be signed in to change notification settings - Fork 20
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
Crash when using where true
query
#151
Comments
Hi, thank you for opening this issue! Definitely a bug, I'll take a look later or early next week 😌 |
Wrote a test in #152, which passes. There is also no |
Yes. Looking at the backtrace, |
Hi @martijnthe, Could you provide a raw failing event json like from your screen capture above? I may have mis-transcribed something when I tried to replicate your issue: from dataclasses import dataclass
from dacite import from_dict
from enum import Enum
from typing import Optional
from axiom_py.query import QueryResult, MessagePriority
import json
testcase = {
"format": "legacy",
"status": {
"elapsedTime": 0,
"blocksExamined": 0,
"rowsExamined": 0,
"rowsMatched": 0,
"numGroups": 0,
"isPartial": False,
"continuationToken": None,
"isEstimate": None,
"minBlockTime": None,
"maxBlockTime": None,
"messages": [
{
"priority": MessagePriority.WARN,
"count": 1,
"code": "apl_possibly_causing harm which is bad - sorry martin!",
"msg": "line 5, col 20 where clause evaluates to computer says no"
}
],
"minCursor": None,
"maxCursor": None,
}
}
def dataclass_to_dict(obj):
if hasattr(obj, "__dataclass_fields__"):
return {k: dataclass_to_dict(v) for k, v in obj.__dict__.items()}
elif isinstance(obj, list):
return [dataclass_to_dict(i) for i in obj]
elif isinstance(obj, Enum):
return obj.value
else:
return obj
user = from_dict(QueryResult, testcase)
as_json = dataclass_to_dict(user)
print(json.dumps(as_json)) Oddly no direct reference to By running: $ python3 test.py | jq I get a JSON document as follows: {
"request": null,
"status": {
"elapsedTime": 0,
"blocksExamined": 0,
"rowsExamined": 0,
"rowsMatched": 0,
"numGroups": 0,
"isPartial": false,
"continuationToken": null,
"isEstimate": null,
"minBlockTime": null,
"maxBlockTime": null,
"messages": [
{
"priority": "warn",
"count": 1,
"code": "apl_possibly_causing harm which is bad - sorry martin!",
"msg": "line 5, col 20 where clause evaluates to computer says no"
}
],
"maxCursor": null,
"minCursor": null
},
"matches": null,
"buckets": null,
"tables": null,
"dataset_names": [],
"savedQueryID": null
} If you can an error/exception that would be interesting. Python version for the above: $ python --version
Python 3.13.0 |
Another useful check would be:
And make sure the version is v0.7 or more recent. Prior to v0.7 Please let us know how you get along @martijnthe |
Library version: v0.8.1
When including
where true
in an APL query, the library crashes with this exception:See below for the full backtrace.
In the Axiom webapp/console, the query runs fine. I do see a warning in the response:
![image](https://private-user-images.githubusercontent.com/193881/382392396-00356f93-1336-4a12-a073-42ebb05d008e.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MzkzODA4MzAsIm5iZiI6MTczOTM4MDUzMCwicGF0aCI6Ii8xOTM4ODEvMzgyMzkyMzk2LTAwMzU2ZjkzLTEzMzYtNGExMi1hMDczLTQyZWJiMDVkMDA4ZS5wbmc_WC1BbXotQWxnb3JpdGhtPUFXUzQtSE1BQy1TSEEyNTYmWC1BbXotQ3JlZGVudGlhbD1BS0lBVkNPRFlMU0E1M1BRSzRaQSUyRjIwMjUwMjEyJTJGdXMtZWFzdC0xJTJGczMlMkZhd3M0X3JlcXVlc3QmWC1BbXotRGF0ZT0yMDI1MDIxMlQxNzE1MzBaJlgtQW16LUV4cGlyZXM9MzAwJlgtQW16LVNpZ25hdHVyZT03ZWQzZGIzMzFlNGQ5Y2Y3ZGEzY2MzMzM3NzEzY2Y1ZGIxYzVmNzQyZGY5ZDMyZWY1YmYxNDU3OTRkMDM0NWFhJlgtQW16LVNpZ25lZEhlYWRlcnM9aG9zdCJ9.AzHekUDyCMkAzS3qdR-BupHCswK0oPbolm5ckpX9Ams)
Even though it's a useless query clause, the library shouldn't crash on the response.
The same happens with
where false
, but then the value that the library chokes on isapl_whereclausealwaysevaluatestoFALSEwhichwillexcludealldata_5
.The text was updated successfully, but these errors were encountered: