Skip to content

Commit

Permalink
expanding regex for automated columns (apache#4990)
Browse files Browse the repository at this point in the history
  • Loading branch information
Gabe Lyons authored and timifasubaa committed May 31, 2018
1 parent c871644 commit d698933
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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', () => {
Expand Down
4 changes: 2 additions & 2 deletions superset/assets/src/explore/constants.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;

0 comments on commit d698933

Please sign in to comment.