You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@superset.apache.org by GitBox <gi...@apache.org> on 2019/09/04 16:03:55 UTC

[GitHub] [incubator-superset] betodealmeida opened a new pull request #8172: Allow users to estimate query cost before executing them

betodealmeida opened a new pull request #8172: Allow users to estimate query cost before executing them
URL: https://github.com/apache/incubator-superset/pull/8172
 
 
   ### CATEGORY
   
   Choose one
   
   - [ ] Bug Fix
   - [X] Enhancement (new features, refinement)
   - [ ] Refactor
   - [ ] Add tests
   - [ ] Build / Development Environment
   - [ ] Documentation
   
   ### SUMMARY
   <!--- Describe the change below, including rationale and design decisions -->
   
   We currently added to Presto support for estimating the number of bytes scanned (https://github.com/prestosql/presto/pull/806), and we'd like to surface that information to SQL Lab users before they actually run a query.
   
   This PR extends the DB specs with an `allows_cost_estimate` attribute and associated methods, allowing pre-execution costs to be computed from DBs that support it.
   
   In order to use it, the feature flag `ESTIMATE_QUERY_COST` must be enabled, and it needs to be explicitly turned on for each database that supports query cost estimation. When all those conditions are met, a new button will show up in SQL Lab, allowing users to run cost estimates for the whole query or for the selected SQL.
   
   ### BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF
   <!--- Skip this if not applicable -->
   
   DBs where the feature is not supported or not enabled are unmodified:
   
   <img width="1698" alt="Screen Shot 2019-09-04 at 8 48 46 AM" src="https://user-images.githubusercontent.com/1534870/64271606-72816180-cef2-11e9-93ea-d379c1fb2ed5.png">
   
   Here's a Presto DB:
   
   <img width="1698" alt="Screen Shot 2019-09-04 at 8 59 15 AM" src="https://user-images.githubusercontent.com/1534870/64271663-917ff380-cef2-11e9-931a-6b32bd843a2f.png">
   
   The result:
   
   <img width="1698" alt="Screen Shot 2019-09-04 at 8 58 57 AM" src="https://user-images.githubusercontent.com/1534870/64271692-a066a600-cef2-11e9-8e30-4f4a6bcb6752.png">
   
   And how errors (timeout, syntax errors) are surfaced:
   
   <img width="1698" alt="Screen Shot 2019-09-04 at 8 53 07 AM" src="https://user-images.githubusercontent.com/1534870/64271726-b2e0df80-cef2-11e9-8be8-35c5cce58f46.png">
   
   ### TEST PLAN
   <!--- What steps should be taken to verify the changes -->
   
   Tested with a Presto cluster that supports query cost estimation.
   
   ### ADDITIONAL INFORMATION
   <!--- Check any relevant boxes with "x" -->
   <!--- HINT: Include "Fixes #nnn" if you are fixing an existing issue -->
   - [ ] Has associated issue:
   - [X] Changes UI
   - [X] Requires DB Migration.
   - [X] Confirm DB Migration upgrade and downgrade tested.
   - [X] Introduces new feature or API
   - [ ] Removes existing feature or API
   
   ### REVIEWERS
   
   @etr2460 @mistercrunch 

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org