plywood
Version:
A query planner and executor
30 lines (29 loc) • 1.33 kB
JavaScript
import { __extends } from "tslib";
import { Set } from '../datatypes';
import { ChainableUnaryExpression, Expression, } from './baseExpression';
import { Aggregate } from './mixins/aggregate';
var MinExpression = (function (_super) {
__extends(MinExpression, _super);
function MinExpression(parameters) {
var _this = _super.call(this, parameters, dummyObject) || this;
_this._ensureOp('min');
_this._checkOperandTypes('DATASET');
_this._checkExpressionTypes('NUMBER', 'TIME');
_this.type = Set.unwrapSetType(_this.expression.type);
return _this;
}
MinExpression.fromJS = function (parameters) {
return new MinExpression(ChainableUnaryExpression.jsToValue(parameters));
};
MinExpression.prototype._calcChainableUnaryHelper = function (operandValue, _expressionValue) {
return operandValue ? operandValue.min(this.expression) : null;
};
MinExpression.prototype._getSQLChainableUnaryHelper = function (dialect, operandSQL, expressionSQL) {
return "MIN(".concat(dialect.aggregateFilterIfNeeded(operandSQL, expressionSQL), ")");
};
MinExpression.op = 'Min';
return MinExpression;
}(ChainableUnaryExpression));
export { MinExpression };
Expression.applyMixins(MinExpression, [Aggregate]);
Expression.register(MinExpression);