Skip to content
Snippets Groups Projects
Unverified Commit b9a04774 authored by Tom Robinson's avatar Tom Robinson
Browse files

misc

parent cab00648
No related branches found
No related tags found
No related merge requests found
import _ from "underscore";
import { mbqlEq } from "../query/util";
import { titleize } from "metabase/lib/formatting";
import { titleize } from "../formatting";
export const VALID_OPERATORS = new Set([
'+',
......
......@@ -69,13 +69,14 @@ class ExpressionsParser extends Parser {
const op = $.CONSUME(AdditiveOperator);
const rhsVal = $.SUBRULE2($.multiplicationExpression, [outsideAggregation]);
// collapse multiple consecutive operators into a single MBQL statement
if (Array.isArray(value) && value[0] === op.image) {
value.push(rhsVal);
} else {
value = [op.image, value, rhsVal]
}
});
return value
return value;
});
$.RULE("multiplicationExpression", (outsideAggregation) => {
......@@ -84,13 +85,14 @@ class ExpressionsParser extends Parser {
const op = $.CONSUME(MultiplicativeOperator);
const rhsVal = $.SUBRULE2($.atomicExpression, [outsideAggregation]);
// collapse multiple consecutive operators into a single MBQL statement
if (Array.isArray(value) && value[0] === op.image) {
value.push(rhsVal);
} else {
value = [op.image, value, rhsVal]
}
});
return value
return value;
});
$.RULE("aggregationOrMetricExpression", (outsideAggregation) => {
......
/*eslint-env node */
"use strict";
require("babel-register");
require("babel-polyfill");
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment