UNPKG

@qrvey/formula-lang

Version:

QFormula support for qrvey projects

46 lines 1.14 kB
import { AST_PRIMITIVES, OPERATION_SCOPE } from '../constants'; import { isANumericColumnParam, replaceDotByUnderscore } from '../utils'; /** * `SUM` Returns the aggregated SUM of a column. */ export const SUM = { identifier: 'SUM', operationScope: OPERATION_SCOPE.AGGREGATE, functionScope: [OPERATION_SCOPE.AGGREGATE], parameters: [ { identifier: 'VALUE', optional: false, expectedPrimitive: AST_PRIMITIVES.NUMBER, validator: [isANumericColumnParam], }, ], transpiler: { elasticsearch, snowflake, redshift, postgresql, databricks, }, primitiveResult: AST_PRIMITIVES.NUMBER, }; function elasticsearch(value) { const _value = 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