bkyryliuk commented on a change in pull request #13496:
URL: https://github.com/apache/superset/pull/13496#discussion_r590654201
##########
File path: superset/connectors/base/models.py
##########
@@ -359,10 +359,7 @@ def handle_single_value(value: Optional[FilterValue]) ->
Optional[FilterValue]:
if is_list_target and not isinstance(values, (tuple, list)):
values = [values] # type: ignore
elif not is_list_target and isinstance(values, (tuple, list)):
- if values:
- values = values[0]
- else:
- values = None
+ values = values[0] if values else None
Review comment:
if values could be dangerous, as [],0, None would return false, it would
be nice to be a bit more specific in the check.
##########
File path: superset/connectors/sqla/models.py
##########
@@ -1061,23 +1060,36 @@ def get_sqla_query( # pylint:
disable=too-many-arguments,too-many-locals,too-ma
target_column_is_numeric=col_obj.is_numeric,
is_list_target=is_list_target,
)
- if op in (
- utils.FilterOperator.IN.value,
- utils.FilterOperator.NOT_IN.value,
- ):
- cond = col_obj.get_sqla_col().in_(eq)
- if isinstance(eq, str) and NULL_STRING in eq:
- cond = or_(
- cond,
- col_obj.get_sqla_col() # pylint:
disable=singleton-comparison
- == None,
+ if is_list_target:
Review comment:
is it possible to add unit tests here?
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]