public override ContextControllerStatementCtxCache ValidateStatement(ContextControllerStatementBase statement) { StatementSpecCompiledAnalyzerResult streamAnalysis = StatementSpecCompiledAnalyzer.AnalyzeFilters(statement.StatementSpec); ContextControllerPartitionedUtil.ValidateStatementForContext(FactoryContext.ContextName, statement, streamAnalysis, GetItemEventTypes(_segmentedSpec), FactoryContext.ServicesContext.NamedWindowMgmtService); return(new ContextControllerStatementCtxCacheFilters(streamAnalysis.Filters)); }
public override ContextControllerStatementCtxCache ValidateStatement(ContextControllerStatementBase statement) { var streamAnalysis = StatementSpecCompiledAnalyzer.AnalyzeFilters(statement.StatementSpec); ValidateStatementForContext(statement, streamAnalysis); return(new ContextControllerStatementCtxCacheFilters(streamAnalysis.Filters)); }
public override ContextControllerStatementCtxCache ValidateStatement(ContextControllerStatementBase statement) { var streamAnalysis = StatementSpecCompiledAnalyzer.AnalyzeFilters(statement.StatementSpec); ContextControllerPartitionedUtil.ValidateStatementForContext( _factoryContext.ContextName, statement, streamAnalysis, GetItemEventTypes(_hashedSpec), _factoryContext.ServicesContext.NamedWindowMgmtService); // register non-property expression to be able to recreated indexes foreach (var entry in _nonPropertyExpressions) { _factoryContext.ServicesContext.FilterNonPropertyRegisteryService.RegisterNonPropertyExpression(statement.StatementContext.StatementName, entry.Key, entry.Value); } return(new ContextControllerStatementCtxCacheFilters(streamAnalysis.Filters)); }
public void ValidateStatement( string contextName, StatementSpecCompiled spec, StatementCompileTimeServices compileTimeServices) { var streamAnalysis = StatementSpecCompiledAnalyzer.AnalyzeFilters(spec); var filters = streamAnalysis.Filters; // Category validation var isCreateWindow = spec.Raw.CreateWindowDesc != null; var message = "Category context '" + contextName + "' requires that any of the events types that are listed in the category context also appear in any of the filter expressions of the statement"; // if no create-window: at least one of the filters must match one of the filters specified by the context if (!isCreateWindow) { foreach (var filter in filters) { var stmtFilterType = filter.FilterForEventType; if (stmtFilterType == CategoryEventType) { return; } if (EventTypeUtility.IsTypeOrSubTypeOf(stmtFilterType, CategoryEventType)) { return; } } if (!filters.IsEmpty()) { throw new ExprValidationException(message); } return; } // validate create-window var declaredAsName = spec.Raw.CreateWindowDesc.AsEventTypeName; if (declaredAsName != null) { if (CategoryEventType.Name.Equals(declaredAsName)) { return; } throw new ExprValidationException(message); } }
public static void ValidateStatementKeyAndHash( IEnumerable<Supplier<EventType>> typeProvider, string contextName, StatementSpecCompiled spec, StatementCompileTimeServices compileTimeServices) { StatementSpecCompiledAnalyzerResult streamAnalysis = StatementSpecCompiledAnalyzer.AnalyzeFilters(spec); IList<FilterSpecCompiled> filters = streamAnalysis.Filters; var isCreateWindow = spec.Raw.CreateWindowDesc != null; // if no create-window: at least one of the filters must match one of the filters specified by the context if (!isCreateWindow) { foreach (var filter in filters) { foreach (var item in typeProvider) { EventType itemEventType = item.Invoke(); var stmtFilterType = filter.FilterForEventType; if (ReferenceEquals(stmtFilterType, itemEventType)) { return; } if (EventTypeUtility.IsTypeOrSubTypeOf(stmtFilterType, itemEventType)) { return; } NamedWindowMetaData namedWindow = compileTimeServices.NamedWindowCompileTimeResolver.Resolve(stmtFilterType.Name); string namedWindowContextName = namedWindow?.ContextName; if (namedWindowContextName != null && namedWindowContextName.Equals(contextName)) { return; } } } if (!filters.IsEmpty()) { throw new ExprValidationException( GetTypeValidationMessage(contextName, filters[0].FilterForEventType.Name)); } return; } // validate create-window with column definition: not allowed, requires typed if (spec.Raw.CreateWindowDesc.Columns != null && spec.Raw.CreateWindowDesc.Columns.Count > 0) { throw new ExprValidationException( "Segmented context '" + contextName + "' requires that named windows are associated to an existing event type and that the event type is listed among the partitions defined by the create-context statement"); } // validate create-window declared type var declaredAsName = spec.Raw.CreateWindowDesc.AsEventTypeName; if (declaredAsName != null) { foreach (var item in typeProvider) { EventType itemEventType = item.Invoke(); if (itemEventType.Name.Equals(declaredAsName)) { return; } } throw new ExprValidationException(GetTypeValidationMessage(contextName, declaredAsName)); } }