From aa5c2ee22866133de1b98f3b6ee4fc77d3a18b84 Mon Sep 17 00:00:00 2001 From: Maxime Beauchemin Date: Fri, 17 Aug 2018 15:53:04 -0700 Subject: [PATCH] [bugfix] TypeError: adhocMetric.comparator.join is not a function (#5661) Somehow we have a "IN" filter where the filter is a string, not an array. While this may need to get fixed upstream as well, this prevents the explore view from completely crashing. Side note: this function looked somewhat brittle, I'm assuming it's used to keep the free form SQL tab in sync and not used to generate the actual SQL being executed. --- superset/assets/src/explore/AdhocFilter.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/superset/assets/src/explore/AdhocFilter.js b/superset/assets/src/explore/AdhocFilter.js index dc3599c2017d3..72913727133d3 100644 --- a/superset/assets/src/explore/AdhocFilter.js +++ b/superset/assets/src/explore/AdhocFilter.js @@ -30,7 +30,7 @@ function translateToSql(adhocMetric, { useSimple } = {}) { const isMulti = MULTI_OPERATORS.indexOf(adhocMetric.operator) >= 0; const subject = adhocMetric.subject; const operator = OPERATORS_TO_SQL[adhocMetric.operator]; - const comparator = isMulti ? adhocMetric.comparator.join("','") : adhocMetric.comparator; + const comparator = Array.isArray(adhocMetric.comparator) ? adhocMetric.comparator.join("','") : adhocMetric.comparator; return `${subject} ${operator} ${isMulti ? '(\'' : ''}${comparator}${isMulti ? '\')' : ''}`; } else if (adhocMetric.expressionType === EXPRESSION_TYPES.SQL) { return adhocMetric.sqlExpression;