Skip to content

[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

Merged
merged 1 commit into from
Mar 15, 2024
Merged

[Trino] Adding explain query method #3645

merged 1 commit into from
Mar 15, 2024

Conversation

agl29
Copy link
Collaborator

@agl29 agl29 commented Mar 7, 2024

What changes were proposed in this pull request?

  • Explain query method added

How was this patch tested?

  • Manually
  • Unittest added

Copy link
Collaborator

@Harshg999 Harshg999 left a 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.

@agl29 agl29 force-pushed the trino_query_explain branch 2 times, most recently from be2754e to 106a871 Compare March 8, 2024 11:16
@agl29 agl29 enabled auto-merge (squash) March 8, 2024 11:17
result = query_client.execute()

return {
'status': 0,
Copy link
Collaborator

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.

Copy link
Collaborator Author

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

Copy link
Contributor

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.

@agl29 agl29 force-pushed the trino_query_explain branch 2 times, most recently from 7b844f5 to 023df9d Compare March 15, 2024 05:15
@agl29 agl29 requested review from wing2fly and Harshg999 March 15, 2024 05:18
@agl29 agl29 force-pushed the trino_query_explain branch from 023df9d to 8d5bbc2 Compare March 15, 2024 05:33
result = query_client.execute()
explanation = result.rows
except Exception as e:
explanation = str(e)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Adding error in explanation?

Copy link
Collaborator Author

@agl29 agl29 Mar 15, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Collaborator

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

Copy link
Contributor

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?

Copy link
Collaborator

@Harshg999 Harshg999 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

@agl29 agl29 force-pushed the trino_query_explain branch 2 times, most recently from 3e340f6 to ae00b20 Compare March 15, 2024 08:10
@agl29 agl29 force-pushed the trino_query_explain branch from ae00b20 to c4dcfa4 Compare March 15, 2024 08:23
Copy link
Contributor

@JohanAhlen JohanAhlen left a 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

@agl29 agl29 merged commit 1f64dee into master Mar 15, 2024
@agl29 agl29 deleted the trino_query_explain branch March 15, 2024 11:41
athithyaaselvam pushed a commit that referenced this pull request Jun 10, 2024
(cherry picked from commit 1f64dee)
(cherry picked from commit cb74ef31234d72d22a282cac6a0b18fdda6891ce)
Change-Id: I0d530fc3e68a8005cf2512b2733ef36401a4af74
(cherry picked from commit 38920cb119157f6c54794a18e4ad6949dcb8fac2)
Alterrien pushed a commit to Alterrien/hue that referenced this pull request Dec 19, 2024
tabraiz12 pushed a commit that referenced this pull request Jan 27, 2025
(cherry picked from commit 1f64dee)
(cherry picked from commit cb74ef31234d72d22a282cac6a0b18fdda6891ce)
Change-Id: I0d530fc3e68a8005cf2512b2733ef36401a4af74
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants