private AggregationLinearFactoryDesc HandleCreateTable( ExprNode[] childNodes, AggregationAccessorLinearType?stateType, ExprValidationContext validationContext) { var message = "For tables columns, the " + stateType?.GetNameInvariant() + " aggregation function requires the 'window(*)' declaration"; if (stateType != AggregationAccessorLinearType.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; AggregationAccessorForge accessor = new AggregationAccessorWindowNoEvalForge(componentType); AggregationStateFactoryForge stateFactory = new AggregationStateLinearForge(this, 0, null); var factory = new AggregationForgeFactoryAccessLinear( this, accessor, TypeHelper.GetArrayType(componentType), null, stateFactory, null, containedType); var additionalForgeables = SerdeEventTypeUtility.Plan( containedType, validationContext.StatementRawInfo, validationContext.SerdeEventTypeRegistry, validationContext.SerdeResolver); validationContext.AdditionalForgeables.AddAll(additionalForgeables); return(new AggregationLinearFactoryDesc(factory, containedType, null, 0)); }
private AggregationLinearFactoryDesc HandleIntoTable( ExprNode[] childNodes, AggregationAccessorLinearType?stateType, ExprValidationContext validationContext) { var message = "For into-table use 'window(*)' or 'window(stream.*)' instead"; if (stateType != AggregationAccessorLinearType.WINDOW) { throw new ExprValidationException(message); } if (childNodes.Length == 0 || childNodes.Length > 1) { throw new ExprValidationException(message); } if (validationContext.StreamTypeService.StreamNames.Length == 0) { throw new ExprValidationException(GetErrorPrefix(stateType) + " requires that at least one stream is provided"); } int streamNum; if (childNodes[0] is ExprWildcard) { if (validationContext.StreamTypeService.StreamNames.Length != 1) { throw new ExprValidationException(GetErrorPrefix(stateType) + " with wildcard requires a single stream"); } streamNum = 0; } else if (childNodes[0] is ExprStreamUnderlyingNode) { var und = (ExprStreamUnderlyingNode)childNodes[0]; streamNum = und.StreamId; } else { throw new ExprValidationException(message); } var containedType = validationContext.StreamTypeService.EventTypes[streamNum]; var componentType = containedType.UnderlyingType; AggregationAccessorForge accessor = new AggregationAccessorWindowNoEvalForge(componentType); var agent = AggregationAgentForgeFactory.Make( streamNum, optionalFilter, validationContext.ImportService, validationContext.StreamTypeService.IsOnDemandStreams, validationContext.StatementName); var factory = new AggregationForgeFactoryAccessLinear( this, accessor, TypeHelper.GetArrayType(componentType), null, null, agent, containedType); return(new AggregationLinearFactoryDesc(factory, containedType, null, 0)); }