villebro commented on a change in pull request #16139:
URL: https://github.com/apache/superset/pull/16139#discussion_r685075080
##########
File path: superset/utils/core.py
##########
@@ -1238,16 +1260,16 @@ def convert_legacy_filters_into_adhoc( # pylint:
disable=invalid-name
) -> None:
mapping = {"having": "having_filters", "where": "filters"}
- if not form_data.get("adhoc_filters"):
- form_data["adhoc_filters"] = []
+ adhoc_filters: List[AdhocFilterClause] = form_data.get("adhoc_filters", [])
+ form_data["adhoc_filters"] = adhoc_filters
- for clause, filters in mapping.items():
- if clause in form_data and form_data[clause] != "":
- form_data["adhoc_filters"].append(to_adhoc(form_data, "SQL",
clause))
+ for clause, filters in mapping.items():
+ if clause in form_data and form_data[clause] != "":
+ adhoc_filters.append(form_data_to_adhoc(form_data, clause))
- if filters in form_data:
- for filt in filter(lambda x: x is not None,
form_data[filters]):
- form_data["adhoc_filters"].append(to_adhoc(filt, "SIMPLE",
clause))
+ if filters in form_data:
+ for filt in filter(lambda x: x is not None, form_data[filters]):
+ adhoc_filters.append(simple_filter_to_adhoc(filt))
Review comment:
I can only assume having the for-loops inside the if-statement was an
error - if `form_data` contained the `adhoc_filter` property, the legacy
filters were not converted but still deleted later on in this method.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]