Skip to content

Commit

Permalink
fixing LIKE constant name (apache#5110)
Browse files Browse the repository at this point in the history
(cherry picked from commit f3778c3)
  • Loading branch information
Gabe Lyons authored and michellethomas committed Jun 6, 2018
1 parent 5c67334 commit ff1de7a
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -113,13 +113,13 @@ describe('AdhocFilterEditPopoverSimpleTabContent', () => {
it('will filter operators for table datasources', () => {
const { wrapper } = setup({ datasource: { type: 'table' } });
expect(wrapper.instance().isOperatorRelevant('regex')).to.be.false;
expect(wrapper.instance().isOperatorRelevant('like')).to.be.true;
expect(wrapper.instance().isOperatorRelevant('LIKE')).to.be.true;
});

it('will filter operators for druid datasources', () => {
const { wrapper } = setup({ datasource: { type: 'druid' } });
expect(wrapper.instance().isOperatorRelevant('regex')).to.be.true;
expect(wrapper.instance().isOperatorRelevant('like')).to.be.false;
expect(wrapper.instance().isOperatorRelevant('LIKE')).to.be.false;
});

it('expands when its multi comparator input field expands', () => {
Expand Down
2 changes: 1 addition & 1 deletion superset/assets/src/explore/AdhocFilter.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ const OPERATORS_TO_SQL = {
'<=': '<=',
in: 'in',
'not in': 'not in',
like: 'like',
LIKE: 'like',
};

function translateToSql(adhocMetric, { useSimple } = {}) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,8 @@ function translateOperator(operator) {
return 'equals';
} else if (operator === OPERATORS['!=']) {
return 'not equal to';
} else if (operator === OPERATORS.LIKE) {
return 'like';
}
return operator;
}
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 @@ -16,11 +16,11 @@ export const OPERATORS = {
'<=': '<=',
in: 'in',
'not in': 'not in',
like: 'like',
LIKE: 'LIKE',
regex: 'regex',
};

export const TABLE_ONLY_OPERATORS = [OPERATORS.like];
export const TABLE_ONLY_OPERATORS = [OPERATORS.LIKE];
export const DRUID_ONLY_OPERATORS = [OPERATORS.regex];
export const HAVING_OPERATORS = [
OPERATORS['=='],
Expand Down

0 comments on commit ff1de7a

Please sign in to comment.