superset-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From grace...@apache.org
Subject [incubator-superset] branch master updated: expanding regex for automated columns (#4990)
Date Fri, 11 May 2018 22:43:59 GMT
This is an automated email from the ASF dual-hosted git repository.

graceguo 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 7d5195a  expanding regex for automated columns (#4990)
7d5195a is described below

commit 7d5195aae344167cfcea344eb0ca959d8539ff23
Author: Gabe Lyons <gabe.lyons@airbnb.com>
AuthorDate: Fri May 11 15:43:52 2018 -0700

    expanding regex for automated columns (#4990)
---
 .../spec/javascripts/explore/components/MetricsControl_spec.jsx  | 9 +++++++++
 superset/assets/src/explore/constants.js                         | 4 ++--
 2 files changed, 11 insertions(+), 2 deletions(-)

diff --git a/superset/assets/spec/javascripts/explore/components/MetricsControl_spec.jsx b/superset/assets/spec/javascripts/explore/components/MetricsControl_spec.jsx
index e52161a..5d2e1e3 100644
--- a/superset/assets/spec/javascripts/explore/components/MetricsControl_spec.jsx
+++ b/superset/assets/spec/javascripts/explore/components/MetricsControl_spec.jsx
@@ -257,6 +257,15 @@ describe('MetricsControl', () => {
         },
         'sum',
       )).to.be.false;
+
+      expect(!!wrapper.instance().selectFilterOption(
+        {
+          metric_name: 'sum__value',
+          optionName: 'sum__value',
+          expression: 'SUM("table"."value")',
+        },
+        'sum',
+      )).to.be.false;
     });
 
     it('filters out metrics if the input begins with an aggregate', () => {
diff --git a/superset/assets/src/explore/constants.js b/superset/assets/src/explore/constants.js
index 5239530..7b57cba 100644
--- a/superset/assets/src/explore/constants.js
+++ b/superset/assets/src/explore/constants.js
@@ -32,5 +32,5 @@ export const HAVING_OPERATORS = [
 ];
 export const MULTI_OPERATORS = [OPERATORS.in, OPERATORS['not in']];
 
-export const sqlaAutoGeneratedMetricRegex = /^(LONG|DOUBLE|FLOAT)?(SUM|AVG|MAX|MIN|COUNT)\([A-Z_][A-Z0-9_]*\)$/i;
-export const druidAutoGeneratedMetricRegex = /^(LONG|DOUBLE|FLOAT)?(SUM|MAX|MIN|COUNT)\([A-Z_][A-Z0-9_]*\)$/i;
+export const sqlaAutoGeneratedMetricRegex = /^(LONG|DOUBLE|FLOAT)?(SUM|AVG|MAX|MIN|COUNT)\([A-Z0-9_."]*\)$/i;
+export const druidAutoGeneratedMetricRegex = /^(LONG|DOUBLE|FLOAT)?(SUM|MAX|MIN|COUNT)\([A-Z0-9_."]*\)$/i;

-- 
To stop receiving notification emails like this one, please contact
graceguo@apache.org.

Mime
View raw message