Skip to content
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

[SQL Lab] Improve autocomplete #8305

Merged

Conversation

etr2460
Copy link
Member

@etr2460 etr2460 commented Sep 26, 2019

CATEGORY

Choose one

  • Bug Fix
  • Enhancement (new features, refinement)
  • Refactor
  • Add tests
  • Build / Development Environment
  • Documentation

SUMMARY

when a user would type sel into the autocomplete, we'd prioritize schemas containing sel as opposed to the SQL keyword SELECT. This fixes that bug, and also refactors some of the code to prevent a similar issue and be clearer (read more immutable).

BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF

image

TEST PLAN

Type sel into the editor, and see SELECT as the autocomplete option

ADDITIONAL INFORMATION

  • Has associated issue:
  • Changes UI
  • Requires DB Migration.
  • Confirm DB Migration upgrade and downgrade tested.
  • Introduces new feature or API
  • Removes existing feature or API

REVIEWERS

@graceguo-supercat @michellethomas @betodealmeida

@codecov-io
Copy link

Codecov Report

Merging #8305 into master will decrease coverage by 5.78%.
The diff coverage is 66.66%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #8305      +/-   ##
==========================================
- Coverage   73.53%   67.75%   -5.79%     
==========================================
  Files         115      451     +336     
  Lines       12396    22702   +10306     
  Branches        0     2370    +2370     
==========================================
+ Hits         9116    15381    +6265     
- Misses       3280     7184    +3904     
- Partials        0      137     +137
Impacted Files Coverage Δ
.../assets/src/SqlLab/components/AceEditorWrapper.jsx 60% <66.66%> (ø)
...sets/src/explore/components/ExploreChartHeader.jsx 50% <0%> (ø)
superset/assets/src/components/Checkbox.jsx 100% <0%> (ø)
...perset/assets/src/dashboard/util/getEmptyLayout.js 0% <0%> (ø)
...ts/src/dashboard/util/getComponentWidthFromDrop.js 95.23% <0%> (ø)
.../assets/src/dashboard/reducers/dashboardFilters.js 88.23% <0%> (ø)
...rc/explore/components/controls/AnnotationLayer.jsx 2.46% <0%> (ø)
superset/assets/src/welcome/DashboardTable.jsx 87.5% <0%> (ø)
...erset/assets/src/dashboard/util/injectCustomCss.js 91.66% <0%> (ø)
...explore/components/controls/ColorPickerControl.jsx 85% <0%> (ø)
... and 327 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 0a8f3eb...826e7e3. Read the comment docs.

@@ -27,6 +27,11 @@ import { areArraysShallowEqual } from '../../reduxUtils';

const langTools = ace.acequire('ace/ext/language_tools');

const SQL_KEYWORD_AUTOCOMPLETE_SCORE = 100;

Choose a reason for hiding this comment

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

where are those score: XXXXX_ SCORE used?

Copy link
Member Author

Choose a reason for hiding this comment

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

They're used by ace editor's autocomplete logic to determine the ordering of autocomplete results

Copy link
Member

@mistercrunch mistercrunch left a comment

Choose a reason for hiding this comment

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

LGTM

const SQL_KEYWORD_AUTOCOMPLETE_SCORE = 100;
const SCHEMA_AUTOCOMPLETE_SCORE = 60;
const TABLE_AUTOCOMPLETE_SCORE = 55;
const COLUMN_AUTOCOMPLETE_SCORE = 50;
Copy link
Member

Choose a reason for hiding this comment

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

When writing a query, one is probably spending more time autocompleting column names than table/schema names. Wondering if having a higher score for column names wrt schema/table names could result in a better user experience, too?

Copy link
Member Author

Choose a reason for hiding this comment

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

Hmm, I'm not sure about this. I'm going to merge this refactor in, reach out to some sql lab powerusers, and come back with the results. I anticipate making some more changes here as we have other feedback about autocomplete to fix.

Copy link
Member

Choose a reason for hiding this comment

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

Absolutely; this was not meant as a blocking comment. Btw, I briefly checked DataGrip, and it seems it gives a higher score/priority for columns than tables, so I might be on to something here after all 😄

@etr2460 etr2460 merged commit f21cc63 into apache:master Oct 1, 2019
@mistercrunch mistercrunch added 🏷️ bot A label used by `supersetbot` to keep track of which PR where auto-tagged with release labels 🚢 0.35.0 labels Feb 28, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🏷️ bot A label used by `supersetbot` to keep track of which PR where auto-tagged with release labels size/M 🚢 0.35.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants