superset-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From maximebeauche...@apache.org
Subject [incubator-superset] branch master updated: [bugfix] TypeError: adhocMetric.comparator.join is not a function (#5661)
Date Fri, 17 Aug 2018 22:53:07 GMT
This is an automated email from the ASF dual-hosted git repository.

maximebeauchemin pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-superset.git


The following commit(s) were added to refs/heads/master by this push:
     new 0a1aa6d  [bugfix] TypeError: adhocMetric.comparator.join is not a function (#5661)
0a1aa6d is described below

commit 0a1aa6dd50ea531aa218bd9acb9ecc250ebf6697
Author: Maxime Beauchemin <maximebeauchemin@gmail.com>
AuthorDate: Fri Aug 17 15:53:04 2018 -0700

    [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 dc3599c..7291372 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;


Mime
View raw message