Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

[explore] When switching from Simple to Custom SQL for a filter, it translates INT to string #12293

Closed
2 of 3 tasks
zuzana-vej opened this issue Jan 5, 2021 · 3 comments · Fixed by #12350
Closed
2 of 3 tasks
Assignees
Labels
!deprecated-label:bug Deprecated label - Use #bug instead explore:filter Related to filters in Explore hold! On hold

Comments

@zuzana-vej
Copy link
Contributor

Simple SQL correctly encodes the values as INTegers. and technically it's displaying incorrectly views IN ('5', '10') even though it's encoded correctly and the query is working - therefore this is a minor issue but can confuse users.

Expected results

Displayed as integer in the Custom SQL box.

Actual results

Transforms into string in the Custom SQL box.

Screenshots

Filter:
Screen Shot 2021-01-05 at 3 36 22 PM

Generated SQL Query
Screen Shot 2021-01-05 at 3 37 02 PM

How to reproduce the bug

  1. Go to Explore
  2. Create chart and go to WHERE filter box
  3. Specify multiple IN integer values
  4. See error

Environment

(please complete the following information):

  • superset version: master
  • python version: python --version
  • node.js version: node -v

Checklist

Make sure to follow these steps before submitting your issue - thank you!

  • I have checked the superset logs for python stacktraces and included it here as text if there are any.
  • I have reproduced the issue with at least the latest released version of superset.
  • I have checked the issue tracker for the same issue and I haven't found one similar.

Additional context

This has been introduced a while back - some time in September, but user consider it a feature request, not a bug.

@zuzana-vej
Copy link
Contributor Author

Related bug: #11639

@zuzana-vej zuzana-vej added !deprecated-label:bug Deprecated label - Use #bug instead explore:filter Related to filters in Explore labels Jan 5, 2021
@zuzana-vej zuzana-vej changed the title When switching from Simple to Custom SQL for a filter, it translates INT to string [explore] When switching from Simple to Custom SQL for a filter, it translates INT to string Jan 5, 2021
@junlincc
Copy link
Member

junlincc commented Jan 7, 2021

There are few other issues(old or regression) around this area that we would like to address together. Tagging this issue Hold! and removing original assignee @michael-s-molina, thanks for all the investigation and testing!

Problem 1
Select a simple text filter like City
Switch to Custom SQL and change the value
It will present an error because the generated WHERE clause is invalid
To fix the user has to enter the quotes and double quotes manually
Screen Shot 2021-01-07 at 4 08 31 PM
Screen Shot 2021-01-07 at 4 09 17 PM
Screen Shot 2021-01-07 at 4 10 18 PM

Problem 2:
Create a new Custom SQL filter like “City” = ‘Las Vegas’
Switch to Simple and fill a different filter like Month = 10
Switch back to Custom SQL and you will see that the value showing is “City” = ‘Las Vegas’ but if you select the text area the value will change to Month = 10
Screen Shot 2021-01-07 at 4 21 38 PM
Screen Shot 2021-01-07 at 4 22 30 PM

Problem 3:
Enable filter suggestions in dataset configuration
Select a date as a filter
All the suggestions are in a format not accepted by the database which will result in an error
Screen Shot 2021-01-07 at 4 05 37 PM

cc @villebro @kgabryje
FYI @eugeniamz

@villebro
Copy link
Member

villebro commented Jan 8, 2021

FYI this was an old bug, not a regression caused by recent changes.

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
!deprecated-label:bug Deprecated label - Use #bug instead explore:filter Related to filters in Explore hold! On hold
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants