UNPKG

plywood

Version:
30 lines (29 loc) 1.53 kB
import { __extends } from "tslib"; import { ChainableUnaryExpression, Expression, } from './baseExpression'; import { Aggregate } from './mixins/aggregate'; import { RefExpression } from './refExpression'; var CountDistinctExpression = (function (_super) { __extends(CountDistinctExpression, _super); function CountDistinctExpression(parameters) { var _this = _super.call(this, parameters, dummyObject) || this; _this._ensureOp('countDistinct'); _this._checkOperandTypes('DATASET'); _this.type = 'NUMBER'; return _this; } CountDistinctExpression.fromJS = function (parameters) { return new CountDistinctExpression(ChainableUnaryExpression.jsToValue(parameters)); }; CountDistinctExpression.prototype._calcChainableUnaryHelper = function (operandValue, _expressionValue) { return operandValue ? operandValue.countDistinct(this.expression) : null; }; CountDistinctExpression.prototype._getSQLChainableUnaryHelper = function (dialect, operandSQL, expressionSQL) { var expression = this.expression; return dialect.countDistinctExpression(dialect.aggregateFilterIfNeeded(operandSQL, expressionSQL), expression instanceof RefExpression ? expression.name : undefined); }; CountDistinctExpression.op = 'CountDistinct'; return CountDistinctExpression; }(ChainableUnaryExpression)); export { CountDistinctExpression }; Expression.applyMixins(CountDistinctExpression, [Aggregate]); Expression.register(CountDistinctExpression);