-
Notifications
You must be signed in to change notification settings - Fork 14k
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
fix(20428): Address-Presto/Trino-Poll-Issue-Refactor #20434
fix(20428): Address-Presto/Trino-Poll-Issue-Refactor #20434
Conversation
r Update linter
e554e8c
to
a335ff1
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.
Thanks for authoring the PR.
superset/db_engine_specs/trino.py
Outdated
logger.info("Query %i: Finished", query_id) | ||
break | ||
|
||
completed_splits = float(stats.get("completedSplits")) |
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.
completed_splits = float(stats.get("completedSplits")) | |
completed_splits = float(stats["completedSplits"]) |
superset/db_engine_specs/trino.py
Outdated
break | ||
|
||
completed_splits = float(stats.get("completedSplits")) | ||
total_splits = float(stats.get("totalSplits")) |
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.
total_splits = float(stats.get("totalSplits")) | |
total_splits = float(stats["totalSplits"]) |
@@ -949,11 +949,7 @@ def get_create_view( | |||
sql = f"SHOW CREATE VIEW {schema}.{table}" | |||
try: | |||
cls.execute(cursor, sql) | |||
polled = cursor.poll() |
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.
@Thelin90 let me test this using Presto to ensure this works. I'll report back.
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.
I confirmed, via the /extra_table_metadata/<int:database_id>/<table_name>/<schema>/ route—which is invokes said method for views, that the method works as expected without the polling.
superset/db_engine_specs/trino.py
Outdated
@@ -15,15 +15,20 @@ | |||
# specific language governing permissions and limitations | |||
# under the License. | |||
import logging | |||
from typing import Any, Dict, Optional, TYPE_CHECKING | |||
import time |
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.
You should revert any of the now unnecessary imports.
Codecov Report
@@ Coverage Diff @@
## master #20434 +/- ##
=======================================
Coverage 66.70% 66.71%
=======================================
Files 1739 1739
Lines 65153 65161 +8
Branches 6899 6899
=======================================
+ Hits 43462 43469 +7
- Misses 19938 19939 +1
Partials 1753 1753
Flags with carried forward coverage won't be shown. Click here to find out more.
Continue to review full report at Codecov.
|
* fix(20428)-Address-Presto/Trino-Poll-Issue-Refacto r Update linter * Update to only use BaseEngineSpec handle_cursor * Fix CI Co-authored-by: John Bodley <4567245+john-bodley@users.noreply.github.com> (cherry picked from commit 8b7262f)
* fix(20428)-Address-Presto/Trino-Poll-Issue-Refacto r Update linter * Update to only use BaseEngineSpec handle_cursor * Fix CI Co-authored-by: John Bodley <4567245+john-bodley@users.noreply.github.com>
SUMMARY
Change to modify
TrinoEngineSpec
inherit classPrestoEngineSpec
to address bug when running againstpresto-trino
.Given issue:
Bug
Raised issue: #20428
Slack conversation: https://apache-superset.slack.com/archives/C015WAZL0KH/p1655449901353689
Additional Info:
See quote:
@S Thelin
I don’t believe we can provide query stats given the way the Trino client is configured. Statistics are updated when fetch is called per here, however this also fetches results and we cannot advance the cursor in the handle_cursor method. There could be some trickery we could do, but I think it’s safer to simply fallback to the default method.
@john-bodley