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

"not in" filter is not working for 0 value #663

Closed
kkalyan opened this issue Jun 23, 2016 · 12 comments
Closed

"not in" filter is not working for 0 value #663

kkalyan opened this issue Jun 23, 2016 · 12 comments
Labels
enhancement:request Enhancement request submitted by anyone from the community

Comments

@kkalyan
Copy link
Contributor

kkalyan commented Jun 23, 2016

The following filter does not get applied.
image

Output Table still contains entries with 0.

@apitts
Copy link

apitts commented Jun 23, 2016

Have you tried wrapping the 0 in quotes? i.e. '0'.

@kkalyan
Copy link
Contributor Author

kkalyan commented Jun 23, 2016

@apitts I did with '0' as well, but does not work.

@apitts
Copy link

apitts commented Jun 23, 2016

Mmmm....I'm not sure then @kkalyan. You may want to try using the having clause in the SQL input instead.

@kkalyan
Copy link
Contributor Author

kkalyan commented Jun 25, 2016

SQL where clause shows up only for Tables, not Druid Datasources.

@x4base
Copy link
Contributor

x4base commented Jun 25, 2016

None/NaN values are displayed as 0 (by using df.fillna(0) in https://github.com/airbnb/caravel/blob/d5b8414fde5e1a000f0faab9b801ba899959560a/caravel/viz.py#L161), so id_type=0 should be filtered out successfully, what you see should be id_type=None or NaN.
If you want to verify this, you can group by id_type and see if there are more than one records with id_type=0. If there are two records, then one of them is id_type=0, while the other one is id_type=None/NaN.
@mistercrunch Should we do something like fillna('(NaN)') or just don't fillna at all?

@kkalyan
Copy link
Contributor Author

kkalyan commented Jun 26, 2016

Thanks @x4base for looking into this.

group by id_type

image

Filter in '0' is also not working.

@x4base
Copy link
Contributor

x4base commented Jun 26, 2016

Do you mean
filter "in 0": no records
filter "not in 0" 1 record
If so, there is only id_type=null in your datasource.

If you know how to send Druid query in the terminal, it will be clear to see the difference.

@kkalyan
Copy link
Contributor Author

kkalyan commented Jul 7, 2016

this seems to be fixed in 0.10.0

@kkalyan kkalyan closed this as completed Jul 7, 2016
@kkalyan kkalyan reopened this Jul 27, 2016
@kkalyan
Copy link
Contributor Author

kkalyan commented Jul 27, 2016

Re-opening the issue as I understood the issue correctly.

  • when the data stored in druid in null, Caravel shows as 0.
  • users may add the value shown in the filter, which will result in druid query like this
    "filter": { "type": "selector", "dimension": "id_type", "value": 0 }
  • If the user uses null in the filter, the resulting druid query is 'null'
    "filter": { "type": "selector", "dimension": "id_type", "value": 'null' }
  • Both of these are incorrect, the following filter will work.
    "filter": { "type": "selector", "dimension": "id_type", "value": null }

I'll send PR for this.
cc @x4base and @mistercrunch please suggest.

@xrmx xrmx added the enhancement:request Enhancement request submitted by anyone from the community label Aug 9, 2016
@kkalyan
Copy link
Contributor Author

kkalyan commented May 8, 2017

workaround for this is to use regex match with an expression like .+

@kkalyan kkalyan closed this as completed May 8, 2017
@kkalyan kkalyan reopened this Oct 3, 2017
@xrmx
Copy link
Contributor

xrmx commented Oct 3, 2017

@kkalyan Please add some references when reopening a bug more than one year later :)

@kkalyan
Copy link
Contributor Author

kkalyan commented Nov 1, 2017

@xrmx I think this got re-opened accidentally :) closing it now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement:request Enhancement request submitted by anyone from the community
Projects
None yet
Development

No branches or pull requests

4 participants