Esempio n. 1
0
        public void ValidatePositionals(ExprValidationContext validationContext)
        {
            ExprAggregateNodeParamDesc paramDesc = ExprAggregateNodeUtil.GetValidatePositionalParams(ChildNodes, true);
            if (validationContext.StatementRawInfo.StatementType == StatementType.CREATE_TABLE &&
                (paramDesc.OptLocalGroupBy != null || paramDesc.OptionalFilter != null)) {
                throw new ExprValidationException(
                    "The 'group_by' and 'filter' parameter is not allowed in create-table statements");
            }

            optionalAggregateLocalGroupByDesc = paramDesc.OptLocalGroupBy;
            optionalFilter = paramDesc.OptionalFilter;
            if (optionalAggregateLocalGroupByDesc != null) {
                ExprNodeUtilityValidate.ValidateNoSpecialsGroupByExpressions(
                    optionalAggregateLocalGroupByDesc.PartitionExpressions);
            }

            if (optionalFilter != null) {
                ExprNodeUtilityValidate.ValidateNoSpecialsGroupByExpressions(new[] {optionalFilter});
            }

            if (optionalFilter != null && IsFilterExpressionAsLastParameter) {
                if (paramDesc.PositionalParams.Length > 1) {
                    throw new ExprValidationException("Only a single filter expression can be provided");
                }

                positionalParams = ExprNodeUtilityMake.AddExpression(paramDesc.PositionalParams, optionalFilter);
            }
            else {
                positionalParams = paramDesc.PositionalParams;
            }
        }