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

fix(explore): Incorrect conversion from simple bool filter to custom sql #21293

Merged
merged 2 commits into from
Sep 1, 2022

Conversation

kgabryje
Copy link
Member

@kgabryje kgabryje commented Sep 1, 2022

SUMMARY

This PR removes brackets around true and false when automatically converting boolean simple adhoc filter to a custom sql filter.

BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF

Before:

Screen.Recording.2022-09-01.at.15.07.52.mov

After:

Screen.Recording.2022-09-01.at.15.06.40.mov

TESTING INSTRUCTIONS

  1. Add a simple adhoc filter with a boolean column
  2. Covert it to custom sql
  3. Verify that there are no brackets around true or false and that query works correctly

ADDITIONAL INFORMATION

  • Has associated issue:
  • Required feature flags:
  • Changes UI
  • Includes DB Migration (follow approval process in SIP-59)
    • Migration is atomic, supports rollback & is backwards-compatible
    • Confirm DB migration upgrade and downgrade tested
    • Runtime estimates and downtime expectations provided
  • Introduces new feature or API
  • Removes existing feature or API

@@ -66,10 +66,10 @@ export function optionLabel(opt) {
return EMPTY_STRING;
}
if (opt === true) {
return '<true>';
return 'true';
Copy link
Member

Choose a reason for hiding this comment

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

Can we use the TRUE_STRING and FALSE_STRING constants?

Copy link
Member Author

Choose a reason for hiding this comment

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

Done! Though now we'll have TRUE instead of true in the labels

@@ -28,9 +28,9 @@ describe('utils/common', () => {
it('converts values as expected', () => {
expect(optionFromValue(false)).toEqual({
value: false,
label: '<false>',
Copy link
Member

Choose a reason for hiding this comment

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

Can we use the constants here as well?

Copy link
Member Author

Choose a reason for hiding this comment

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

👍

@pull-request-size pull-request-size bot added size/S and removed size/XS labels Sep 1, 2022
@codecov
Copy link

codecov bot commented Sep 1, 2022

Codecov Report

Merging #21293 (8f635e2) into master (9fd7520) will not change coverage.
The diff coverage is 100.00%.

@@           Coverage Diff           @@
##           master   #21293   +/-   ##
=======================================
  Coverage   66.42%   66.42%           
=======================================
  Files        1784     1784           
  Lines       68237    68237           
  Branches     7263     7263           
=======================================
  Hits        45328    45328           
  Misses      21040    21040           
  Partials     1869     1869           
Flag Coverage Δ
javascript 52.48% <100.00%> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
superset-frontend/src/utils/common.js 90.00% <100.00%> (ø)

📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more

Copy link
Member

@michael-s-molina michael-s-molina left a comment

Choose a reason for hiding this comment

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

LGTM. I'm fine with applying a toLowerCase here.

@kgabryje kgabryje merged commit 076af60 into apache:master Sep 1, 2022
@mistercrunch mistercrunch added 🏷️ bot A label used by `supersetbot` to keep track of which PR where auto-tagged with release labels 🚢 2.1.0 and removed 🚢 2.1.3 labels Mar 13, 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/S 🚢 2.1.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants