zhaoyongjie opened a new pull request #16107:
URL: https://github.com/apache/superset/pull/16107


   ### SUMMARY
   <!--- Describe the change below, including rationale and design decisions -->
   closes: https://github.com/apache/superset/issues/16081
   Currently, there is an issue with filters that handle boolean values. If the 
database engine does not provide boolean value implicit conversion, will cause 
the query to fail.
   Imagine SQL:
   ```
   SELECT case
              when gender = 'boy' then True
              else False
          end AS boolean_gender,
          count(num) AS "COUNT(num)"
   FROM birth_names
   WHERE case
             when gender = 'boy' then True
             else False
         end IN ('false')
   GROUP BY case
                when gender = 'boy' then True
                else False
            end
   ORDER BY "COUNT(num)" DESC
   LIMIT 10000;
   ```
   
   the derived column(Calculated column in Superset) type is Boolean, and the 
operand is String('true')
   
   ```
   case
       when gender = 'boy' then True
       else False
   end IN ('false')
   ```
   
   
   This PR do a simple conversion when the operand type is boolean
   
   
   ### BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF
   <!--- Skip this if not applicable -->
   
   #### Before
   
   
https://user-images.githubusercontent.com/2016594/128458491-8c8d4e31-efb7-4445-9e2f-7ac50d246b42.mov
   
   
   ### TESTING INSTRUCTIONS
   <!--- Required! What steps can be taken to manually verify the changes? -->
   UT coverage
   
   ### ADDITIONAL INFORMATION
   <!--- Check any relevant boxes with "x" -->
   <!--- HINT: Include "Fixes #nnn" if you are fixing an existing issue -->
   - [x] Has associated issue: https://github.com/apache/superset/issues/16081
   - [ ] Changes UI
   - [ ] Includes DB Migration (follow approval process in 
[SIP-59](https://github.com/apache/superset/issues/13351))
     - [ ] 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
   


-- 
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.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]



---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to