Skip to content

Commit

Permalink
[bugfix] TypeError: adhocMetric.comparator.join is not a function (#5661
Browse files Browse the repository at this point in the history
)

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.
  • Loading branch information
mistercrunch authored Aug 17, 2018
1 parent 5a4b70d commit 0a1aa6d
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion superset/assets/src/explore/AdhocFilter.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit 0a1aa6d

Please sign in to comment.