private static int[] GetIndexesForTags( ISet<string> allTagNamesOrdered, ISet<string> arrayTags) { if (arrayTags == null || arrayTags.IsEmpty()) { return new int[0]; } var indexes = new int[arrayTags.Count]; var count = 0; foreach (var arrayTag in arrayTags) { var found = FilterSpecCompilerTagUtil.FindTagNumber(arrayTag, allTagNamesOrdered); indexes[count] = found; count++; } return indexes; }
public static StreamSpecCompiledDesc CompilePatternWTags( PatternStreamSpecRaw streamSpecRaw, ISet<string> eventTypeReferences, bool isInsertInto, MatchEventSpec tags, ISet<string> priorAllTags, bool isJoin, bool isContextDeclaration, bool isOnTrigger, int streamNum, StatementRawInfo statementRawInfo, StatementCompileTimeServices services) { // validate if ((streamSpecRaw.IsSuppressSameEventMatches || streamSpecRaw.IsDiscardPartialsOnMatch) && (isJoin || isContextDeclaration || isOnTrigger)) { throw new ExprValidationException( "Discard-partials and suppress-matches is not supported in a joins, context declaration and on-action"); } if (tags == null) { tags = new MatchEventSpec(); } var nodeStack = new Stack<EvalForgeNode>(); // determine ordered tags ISet<string> allTagNamesOrdered = FilterSpecCompilerTagUtil.AssignEventAsTagNumber(priorAllTags, streamSpecRaw.EvalForgeNode); // construct root : assigns factory node ids var top = streamSpecRaw.EvalForgeNode; var root = new EvalRootForgeNode(services.IsAttachPatternText, top, statementRawInfo.Annotations); var additionalForgeables = new List<StmtClassForgeableFactory>(); RecursiveCompile( top, tags, nodeStack, allTagNamesOrdered, streamNum, additionalForgeables, statementRawInfo, services); var hook = (PatternCompileHook) ImportUtil.GetAnnotationHook( statementRawInfo.Annotations, HookType.INTERNAL_PATTERNCOMPILE, typeof(PatternCompileHook), services.ImportServiceCompileTime); hook?.Pattern(root); PatternStreamSpecCompiled compiled = new PatternStreamSpecCompiled( root, tags.TaggedEventTypes, tags.ArrayEventTypes, allTagNamesOrdered, streamSpecRaw.ViewSpecs, streamSpecRaw.OptionalStreamName, streamSpecRaw.Options, streamSpecRaw.IsSuppressSameEventMatches, streamSpecRaw.IsDiscardPartialsOnMatch); return new StreamSpecCompiledDesc(compiled, additionalForgeables); }