/// <summary> /// Ctor. /// </summary> /// <param name="filterSpec">specifies what events we are interested in.</param> /// <param name="viewSpecs">specifies what view to use to derive data</param> /// <param name="optionalStreamName">stream name, or null if none supplied</param> /// <param name="streamSpecOptions">additional options such as unidirectional stream in a join</param> public FilterStreamSpecCompiled( FilterSpecCompiled filterSpec, ViewSpec[] viewSpecs, string optionalStreamName, StreamSpecOptions streamSpecOptions) : base(optionalStreamName, viewSpecs, streamSpecOptions) { FilterSpecCompiled = filterSpec; }
public ViewFactoryForgeArgs( int streamNum, bool isSubquery, int subqueryNumber, StreamSpecOptions options, string optionalCreateNamedWindowName, StatementRawInfo statementRawInfo, StatementCompileTimeServices compileTimeServices) { StatementRawInfo = statementRawInfo; StreamNum = streamNum; Options = options; IsSubquery = isSubquery; SubqueryNumber = subqueryNumber; OptionalCreateNamedWindowName = optionalCreateNamedWindowName; CompileTimeServices = compileTimeServices; }
public ViewFactoryChain CreateFactories(int streamNum, EventType parentEventType, ViewSpec[] viewSpecDefinitions, StreamSpecOptions options, StatementContext context, bool isSubquery, int subqueryNumber) { // Clone the view spec list to prevent parameter modification IList <ViewSpec> viewSpecList = new List <ViewSpec>(viewSpecDefinitions); // Inspect views and add merge views if required ViewServiceHelper.AddMergeViews(viewSpecList); // Instantiate factories, not making them aware of each other yet var viewFactories = ViewServiceHelper.InstantiateFactories(streamNum, viewSpecList, context, isSubquery, subqueryNumber); ViewFactory parentViewFactory = null; IList <ViewFactory> attachedViewFactories = new List <ViewFactory>(); for (var i = 0; i < viewFactories.Count; i++) { var factoryToAttach = viewFactories[i]; try { factoryToAttach.Attach(parentEventType, context, parentViewFactory, attachedViewFactories); attachedViewFactories.Add(viewFactories[i]); parentEventType = factoryToAttach.EventType; } catch (ViewParameterException ex) { var text = "Error attaching view to parent view"; if (i == 0) { text = "Error attaching view to event stream"; } throw new ViewProcessingException(text + ": " + ex.Message, ex); } } // obtain count of data windows var dataWindowCount = 0; var firstNonDataWindowIndex = -1; for (var i = 0; i < viewFactories.Count; i++) { var factory = viewFactories[i]; if (factory is DataWindowViewFactory) { dataWindowCount++; continue; } if ((factory is GroupByViewFactoryMarker) || (factory is MergeViewFactory)) { continue; } if (firstNonDataWindowIndex == -1) { firstNonDataWindowIndex = i; } } var isAllowMultipleExpiry = context.ConfigSnapshot.EngineDefaults.ViewResources.IsAllowMultipleExpiryPolicies; var isRetainIntersection = options.IsRetainIntersection; var isRetainUnion = options.IsRetainUnion; // Set the default to retain-intersection unless allow-multiple-expiry is turned on if ((!isAllowMultipleExpiry) && (!isRetainUnion)) { isRetainIntersection = true; } // handle multiple data windows with retain union. // wrap view factories into the union view factory and handle a group-by, if present if ((isRetainUnion || isRetainIntersection) && dataWindowCount > 1) { viewFactories = GetRetainViewFactories(parentEventType, viewFactories, isRetainUnion, context); } return(new ViewFactoryChain(parentEventType, viewFactories)); }