-
Notifications
You must be signed in to change notification settings - Fork 389
[Trino] Adding explain query method #3645
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
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good, I've left few review comments.
be2754e
to
106a871
Compare
result = query_client.execute() | ||
|
||
return { | ||
'status': 0, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Will the TrinoQuery.execute() throws any exception?
If any exception, should the status be updated to -1?
Take a look existing beeswax API examples: response = {'status': -1, 'message': ''} are defined at the beginning of menthod.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added the try catch.
We need to send the {'status': 0} to capture the output in UI.
For the ref https://github.com/cloudera/hue/blob/master/desktop/libs/notebook/src/notebook/connectors/hiveserver2.py#L591
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@wing2fly we should try to move away from using the status flag, today API users expect the proper http error code when something goes bad. That being said the UI might have some old code that checks for status == 0.
7b844f5
to
023df9d
Compare
023df9d
to
8d5bbc2
Compare
result = query_client.execute() | ||
explanation = result.rows | ||
except Exception as e: | ||
explanation = str(e) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Adding error in explanation?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, that's what we are doing in the Hive also
https://github.com/cloudera/hue/blob/master/desktop/libs/notebook/src/notebook/connectors/hiveserver2.py#L608
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@JohanAhlen Is UI expecting this for both editor v1 and editor v2?
Just a heads up, we need to improve all this flow then once we pick up this roadmap item. cc @agl29
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's a bit odd indeed, @agl29 did you try how the UI behave if you would return a 500 request with the error message instead?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM!
3e340f6
to
ae00b20
Compare
ae00b20
to
c4dcfa4
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice! Good to improve the exception handing a bit. In some cases we shouldn't follow old patterns, test it case-by-case and perhaps add a TODO or comment in case it's too much work for the task at hand
(cherry picked from commit 1f64dee) (cherry picked from commit cb74ef31234d72d22a282cac6a0b18fdda6891ce) Change-Id: I0d530fc3e68a8005cf2512b2733ef36401a4af74 (cherry picked from commit 38920cb119157f6c54794a18e4ad6949dcb8fac2)
(cherry picked from commit 1f64dee) (cherry picked from commit cb74ef31234d72d22a282cac6a0b18fdda6891ce) Change-Id: I0d530fc3e68a8005cf2512b2733ef36401a4af74
What changes were proposed in this pull request?
How was this patch tested?