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
I'd like to suggest a small and trivial fix for trino-python-client.
To make it working through https://github.com/stackabletech/trino-lb I had to make a small change.
Instead following line
if "error" in response:
write
if response.get("error") is not None:
Without this change there is TypeError: 'NoneType' object is not subscriptable error from the line below it
The key difference is having a key in JSON with null (None) value.
I've tried to figure out what is the correct behavior for for the protocol (whether it is the issue in python driver of in trino-lb project).
The documentation says following about the error attribute: "If query failed, the error attribute contains a QueryError object. That object contains a message, an errorCode and other information about the error. See the io.trino.client.QueryError class in module trino-client in the client directory for more details."
In the source code of Trino the object QueryResult is serialized to JSON from structure using Jackson library. So the null value of field is omitted in the serialization. It does not specify any attributes about this field.
I think that generally speaking statically typed languages such as Go, Java, Rust by default don't make any difference on cases if key is missing or its value is null.
Giving all these thoughts above I feel that suggested change in the trino-python-client worth to be done
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
I'd like to suggest a small and trivial fix for trino-python-client.
To make it working through https://github.com/stackabletech/trino-lb I had to make a small change.
Instead following line
write
Without this change there is
TypeError: 'NoneType' object is not subscriptable
error from the line below itThe key difference is having a key in JSON with null (None) value.
I've tried to figure out what is the correct behavior for for the protocol (whether it is the issue in python driver of in trino-lb project).
The documentation says following about the error attribute: "If query failed, the error attribute contains a QueryError object. That object contains a message, an errorCode and other information about the error. See the io.trino.client.QueryError class in module trino-client in the client directory for more details."
In the source code of Trino the object QueryResult is serialized to JSON from structure using Jackson library. So the null value of field is omitted in the serialization. It does not specify any attributes about this field.
I think that generally speaking statically typed languages such as Go, Java, Rust by default don't make any difference on cases if key is missing or its value is null.
Giving all these thoughts above I feel that suggested change in the trino-python-client worth to be done
Beta Was this translation helpful? Give feedback.
All reactions