UNPKG

@qrvey/formula-lang

Version:

QFormula support for qrvey projects

46 lines 1.17 kB
import { AST_PRIMITIVES, OPERATION_SCOPE } from '../constants'; import { isAColumnParam, replaceDotByUnderscore } from '../utils'; /** * `DISTCOUNT` Returns the aggregated SUM of a column. */ export const DISTCOUNT = { identifier: 'DISTCOUNT', operationScope: OPERATION_SCOPE.AGGREGATE, functionScope: [OPERATION_SCOPE.AGGREGATE], parameters: [ { identifier: 'VALUE', optional: false, expectedPrimitive: AST_PRIMITIVES.NUMBER, validator: [isAColumnParam], }, ], transpiler: { elasticsearch, snowflake, redshift, postgresql, databricks, }, primitiveResult: AST_PRIMITIVES.NUMBER, }; function elasticsearch(value) { const _value = replaceDotByUnderscore(value); return `params.get("DISTINCTCOUNT_${_value}")`; } function SQL(value) { return `COUNT(DISTINCT ${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=aggDistcount.js.map