private LinearAggregationFactoryDesc HandleCreateTable(
            ExprNode[] childNodes,
            AggregationStateType stateType,
            ExprValidationContext validationContext)
        {
            var message = "For tables columns, the " + stateType.GetName().ToLowerInvariant() +
                          " aggregation function requires the 'window(*)' declaration";

            if (stateType != AggregationStateType.WINDOW)
            {
                throw new ExprValidationException(message);
            }
            if (childNodes.Length == 0 || childNodes.Length > 1 || !(childNodes[0] is ExprWildcard))
            {
                throw new ExprValidationException(message);
            }
            if (validationContext.StreamTypeService.StreamNames.Length == 0)
            {
                throw new ExprValidationException(
                          GetErrorPrefix(stateType) + " requires that the event type is provided");
            }
            var containedType = validationContext.StreamTypeService.EventTypes[0];
            var componentType = containedType.UnderlyingType;
            var accessor      = new AggregationAccessorWindowNoEval(componentType);
            var stateFactory  =
                validationContext.EngineImportService.AggregationFactoryFactory.MakeLinear(
                    validationContext.StatementExtensionSvcContext, this, 0);
            var factory = new ExprAggMultiFunctionLinearAccessNodeFactoryAccess(
                this, accessor, TypeHelper.GetArrayType(componentType), containedType, null, stateFactory, null);

            return(new LinearAggregationFactoryDesc(factory, factory.ContainedEventType, null));
        }
Ejemplo n.º 2
0
        private LinearAggregationFactoryDesc HandleCreateTable(ExprNode[] childNodes, AggregationStateType stateType, ExprValidationContext validationContext)
        {
            var message = "For tables columns, the " + stateType.GetName().ToLower() + " aggregation function requires the 'window(*)' declaration";

            if (stateType != AggregationStateType.WINDOW)
            {
                throw new ExprValidationException(message);
            }
            if (childNodes.Length == 0 || childNodes.Length > 1 || !(childNodes[0] is ExprWildcard))
            {
                throw new ExprValidationException(message);
            }
            if (validationContext.StreamTypeService.StreamNames.Length == 0)
            {
                throw new ExprValidationException(GetErrorPrefix(stateType) + " requires that the event type is provided");
            }
            var containedType = validationContext.StreamTypeService.EventTypes[0];
            var componentType = containedType.UnderlyingType;
            AggregationAccessor     accessor     = new AggregationAccessorWindowNoEval(componentType);
            ExprNode                me           = this;
            AggregationStateFactory stateFactory = new ProxyAggregationStateFactory
            {
                ProcCreateAccess = (methodResolutionService, agentInstanceId, groupId, aggregationId, join, groupKey, passThru) =>
                                   methodResolutionService.MakeAccessAggLinearNonJoin(agentInstanceId, groupId, aggregationId, 0, passThru),
                ProcAggregationExpression = () => me,
            };
            var factory = new ExprAggMultiFunctionLinearAccessNodeFactoryAccess(this, accessor, TypeHelper.GetArrayType(componentType), containedType, null, stateFactory, null);

            return(new LinearAggregationFactoryDesc(factory, factory.ContainedEventType, null));
        }