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

Fix bug where lists in queries cannot contain multiple types #8032

Merged
merged 2 commits into from
Aug 13, 2019
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion superset/utils/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -907,7 +907,7 @@ def get_filter_key(f):
if isinstance(existing_filters[filter_key], list):
# Add filters for unequal lists
# order doesn't matter
if sorted(existing_filters[filter_key]) != sorted(
if set(existing_filters[filter_key]) != set(
filtr["val"]
):
form_data["adhoc_filters"].append(to_adhoc(filtr))
Expand Down
15 changes: 15 additions & 0 deletions tests/utils_tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -301,6 +301,7 @@ def test_merge_extra_filters_ignores_equal_filters(self):
"extra_filters": [
{"col": "a", "op": "in", "val": "someval"},
{"col": "B", "op": "==", "val": ["c1", "c2"]},
{"col": "c", "op": "in", "val": ["c1", 1, None]},
],
"adhoc_filters": [
{
Expand All @@ -317,6 +318,13 @@ def test_merge_extra_filters_ignores_equal_filters(self):
"operator": "==",
"subject": "B",
},
{
"clause": "WHERE",
"comparator": ["c1", 1, None],
"expressionType": "SIMPLE",
"operator": "in",
"subject": "c",
},
],
}
expected = {
Expand All @@ -335,6 +343,13 @@ def test_merge_extra_filters_ignores_equal_filters(self):
"operator": "==",
"subject": "B",
},
{
"clause": "WHERE",
"comparator": ["c1", 1, None],
"expressionType": "SIMPLE",
"operator": "in",
"subject": "c",
},
]
}
merge_extra_filters(form_data)
Expand Down