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

[explore, PostgreSQL] filter values not correctly displayed for boolean columns #3007

Closed
3 tasks done
rumbin opened this issue Jun 20, 2017 · 9 comments
Closed
3 tasks done
Labels
.pinned Draws attention

Comments

@rumbin
Copy link
Contributor

rumbin commented Jun 20, 2017

  • I have checked the superset logs for python stacktraces and included it here as text if 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

I mentioned this behavior in #2814 but since this is a Postgres-specific issue, I guess it's best to file a new issue.

Superset version

0.18.4 in combination with Postgres as DB backend

Expected results

The drop down selector shows both existing states (false/true or 0/1) of a boolean column, allowing to select the value to be filtered on — assuming that the column actually features both states.

Actual results

In both kinds of filtering mechanisms — within a filter slice and using filters on the explore page — the drop-down selector for the boolean column shows two rows, however, they are both not labeled.
Selecting either of them results in the corresponding filters on false or true applied, though.
So it seems that this is only an issue regarding the representation of the column values.

The following picture depicts the empty label string that is yielded if any of the values is selected for filtering.

bool_filter_postgres

When doing the same with an SQLite backend, the drop-down list is correctly populated with 0 and 1.

I got the idea that the difference between SQLite's and Postgres' boolean types is that the former uses 0 and 1 as representation, while the latter employs false and true. So maybe it's all about casting these values to the strings that get printed in the selector list.

Steps to reproduce

For simplicity, we just employ the data stored in superset's management DB, which we assume to be running on Prostgres:

  • register the superset maintenance table main.ab_user in superset
  • make the active column filterable
  • create a filter slice using this column and try to select any of the available values of the drop-down selector for this field
  • you may want to make sure that there are both active and non-active users present, so you get two distinct but unlabeled values in the drop-down selector
@rumbin
Copy link
Contributor Author

rumbin commented Jun 20, 2017

Some debugging:

Talking about superset/connectors/sqla/models.py, around line 454.

The values and dtypes of the filter values col, op and eq are as follows, when a filter on a boolean column is applied:

  • col: active, str
  • op: in, str (to no surprise)
  • eq: [False], list
  • eq[0]: False, bool

So, as observed in the query results, the values are handled correctly.
However, I currently have not figured out yet, where the contents of the drop-down selectors are generated...

@rumbin
Copy link
Contributor Author

rumbin commented Jul 15, 2017

@mistercrunch, @xrmx: Could anyone of you give me a hint, please? I actually don't know where to start digging.

@mistercrunch
Copy link
Member

Notice: this issue has been closed because it has been inactive for 281 days. Feel free to comment and request for this issue to be reopened.

@rumbin
Copy link
Contributor Author

rumbin commented Apr 23, 2018

@mistercrunch please reopen.

@mistercrunch
Copy link
Member

This should actually be fixed since #4651

@brunoalano
Copy link

I've the same issue

@ecastillopki
Copy link

This should actually be fixed since #4651

I'm having the same issue but with mssql DB.

@jotarada
Copy link

jotarada commented Sep 8, 2020

Hi,
This issue as mention in #2814 still exists for Impala. The drop down and tables for a boolean column appears as blanks.
I'm using impala 3.2 with superset 0.36

@bkyryliuk
Copy link
Member

yeah same on presto for 0.37

@bkyryliuk bkyryliuk added the .pinned Draws attention label Sep 8, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
.pinned Draws attention
Projects
None yet
Development

No branches or pull requests

6 participants