@qrvey/formula-lang
Version:
QFormula support for qrvey projects
49 lines • 1.25 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.SUM = void 0;
const constants_1 = require("../constants");
const utils_1 = require("../utils");
/**
* `SUM` Returns the aggregated SUM of a column.
*/
exports.SUM = {
identifier: 'SUM',
operationScope: constants_1.OPERATION_SCOPE.AGGREGATE,
functionScope: [constants_1.OPERATION_SCOPE.AGGREGATE],
parameters: [
{
identifier: 'VALUE',
optional: false,
expectedPrimitive: constants_1.AST_PRIMITIVES.NUMBER,
validator: [utils_1.isANumericColumnParam],
},
],
transpiler: {
elasticsearch,
snowflake,
redshift,
postgresql,
databricks,
},
primitiveResult: constants_1.AST_PRIMITIVES.NUMBER,
};
function elasticsearch(value) {
const _value = (0, utils_1.replaceDotByUnderscore)(value);
return `params.get("SUM_${_value}")`;
}
function SQL(value) {
return `SUM(${value})`;
}
function snowflake(value) {
return SQL(value);
}
function redshift(value) {
return SQL(value);
}
function postgresql(value) {
return SQL(value);
}
function databricks(value) {
return SQL(value);
}
//# sourceMappingURL=aggSum.js.map