# Superset - Dremio : Boolean filter becomes 0 or 1

**URL:** <https://community.dremio.com/t/superset-dremio-boolean-filter-becomes-0-or-1/11829>\
**Category:** Uncategorized\
**Created:** [May 15, 2024, 6:00am UTC](https://community.dremio.com/t/superset-dremio-boolean-filter-becomes-0-or-1/11829 "2024-05-15T06:00:32Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Ken](https://sea2.discourse-cdn.com/flex020/user_avatar/community.dremio.com/ken/32/5784_2.png) [@Ken](https://community.dremio.com/u/Ken)\
**Post date:** [May 15, 2024, 6:00am UTC](https://community.dremio.com/t/superset-dremio-boolean-filter-becomes-0-or-1/11829/1 "2024-05-15T06:00:33Z")

</div>

I have a dashboard with a boolean filter **is\_participant\_in\_watchlist**

I am using the field as a dashboard filter for all charts.

When the filter is applied to the charts, the boolean filter’s values becomes 0 and 1.

This caused the below error

```auto
Error: Flight returned invalid argument error, with message: Values passed to IN operator must have compatible types
startLine 7
startColumn 7
endLine 8
endColumn 40
SQL Query SELECT DATE_TRUNC('day', as_of_date) AS as_of_date,
       sehk_code AS sehk_code,
       participant_id AS participant_id,
       max(shareholding_amount) AS "MAX(shareholding_amount)"
FROM "l1-hk-trading"."flat"."flat_hk_stock_shareholding_history"
WHERE sehk_code IN ('00001')
  AND is_participant_in_watchlist IN (0,
                                      1)
  AND as_of_date >= TO_DATE('2024-01-01', 'YYYY-MM-DD')
  AND as_of_date < TO_DATE('2024-05-15', 'YYYY-MM-DD')
GROUP BY DATE_TRUNC('day', as_of_date),
         sehk_code,
         participant_id
ORDER BY "MAX(shareholding_amount)" DESC
LIMIT 10000

```

==========  
**Screenshots**

- Boolean filter NOT applied

 ![image](https://us1.discourse-cdn.com/flex020/uploads/dremio/original/2X/e/e5031d51d8bc372b680e64ad72e2c6c3981106ca.png)

- Boolean filter applied

 ![image](https://us1.discourse-cdn.com/flex020/uploads/dremio/original/2X/6/6b542da3ff4ae5c738e0ac95cc6f9af6599bd0a1.png)

=========

My current workaround is to convery my boolean fields to 0 or 1 just for dashboarding purposes on superset

---

<div class="post-metadata">

**Author:** ![mark\_c](https://sea2.discourse-cdn.com/flex020/user_avatar/community.dremio.com/mark_c/32/3578_2.png) [@mark\_c](https://community.dremio.com/u/mark_c)\
**Post date:** [May 17, 2024, 12:44pm UTC](https://community.dremio.com/t/superset-dremio-boolean-filter-becomes-0-or-1/11829/2 "2024-05-17T12:44:26Z")

</div>

I think what you mean here is that the filter values should be `True` or `False` … however why is the filter in place here anyway since having `IN (true, false)` basically negates the filter doesnt it?

---

<div class="post-metadata">

**Author:** ![Ken](https://sea2.discourse-cdn.com/flex020/user_avatar/community.dremio.com/ken/32/5784_2.png) [@Ken](https://community.dremio.com/u/Ken)\
**Post date:** [May 17, 2024, 1:58pm UTC](https://community.dremio.com/t/superset-dremio-boolean-filter-becomes-0-or-1/11829/3 "2024-05-17T13:58:43Z")

</div>

Hi @mark_c

That’s right.

The SQL sample is just an example.

The actual use case would of course NOT have both true and false in the filter.

All I wanted to show is that True gets translated to 1, and False gets translated to 0 when using superset against Dremio

Thank you!

---

<div class="post-metadata">

**Author:** ![mark\_c](https://sea2.discourse-cdn.com/flex020/user_avatar/community.dremio.com/mark_c/32/3578_2.png) [@mark\_c](https://community.dremio.com/u/mark_c)\
**Post date:** [May 20, 2024, 1:58pm UTC](https://community.dremio.com/t/superset-dremio-boolean-filter-becomes-0-or-1/11829/4 "2024-05-20T13:58:22Z")

</div>

Hi @Ken so my colleague @Simon_Ashley ran some tests with superset and what we found out was that the default `IN` filter seems to be the one that comes up when you run a query  
 ![image](https://us1.discourse-cdn.com/flex020/uploads/dremio/original/2X/7/7c7f221c9a6474ff01d3a04a16d2ed513d99d7d9.png)  
If you choose the `is:true` or `is:false` then the SQL sent through to dremio is valid. You can also use the custom SQL and create a valid query  
 ![image (1)](https://us1.discourse-cdn.com/flex020/uploads/dremio/original/2X/c/c9019ef4b943c09482dcbeb90ec5ff8f13d55c85.png)  
as you can see the valid values are `true|false` or `'0'|'1'`

So the problem is really how superset is forming the SQL (presenting those as INT values) and the error you see in Dremio is valid.

---

<div class="post-metadata">

**Author:** ![Ken](https://sea2.discourse-cdn.com/flex020/user_avatar/community.dremio.com/ken/32/5784_2.png) [@Ken](https://community.dremio.com/u/Ken)\
**Post date:** [May 25, 2024, 5:42pm UTC](https://community.dremio.com/t/superset-dremio-boolean-filter-becomes-0-or-1/11829/5 "2024-05-25T17:42:01Z")

</div>

Hi mark,

THank you for following up on the issue.

I now resort to using STRING (e.g. ‘TRUE’, ‘FALSE’) when it comes to filtering in superset.

It should be fine.

THank you so much for looking into the issue 🙏
