@qrvey/formula-lang
Version:
QFormula support for qrvey projects
49 lines • 1.26 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.MAXVAL = void 0;
const constants_1 = require("../constants");
const utils_1 = require("../utils");
/**
* `MAXVAL` Returns the aggregated SUM of a column.
*/
exports.MAXVAL = {
identifier: 'MAXVAL',
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("MAX_${_value}")`;
}
function SQL(value) {
return `MAX(${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=aggMax.js.map