Exemplo n.º 1
0
 public static void AddNonAggregatedProps(
     ExprNode exprNode,
     ExprNodePropOrStreamSet set,
     EventType[] types,
     ContextPropertyRegistry contextPropertyRegistry)
 {
     ExprNodeIdentifierAndStreamRefVisitor visitor = new ExprNodeIdentifierAndStreamRefVisitor(false);
     exprNode.Accept(visitor);
     AddNonAggregatedProps(set, visitor.Refs, types, contextPropertyRegistry);
 }
Exemplo n.º 2
0
        public void AddAll(ExprNodePropOrStreamSet other)
        {
            if (other._properties != null) {
                AllocateProperties();
                _properties.AddAll(other._properties);
            }

            if (other._expressions != null) {
                AllocateExpressions();
                _expressions.AddAll(other._expressions);
            }
        }
Exemplo n.º 3
0
        public static ExprNodePropOrStreamSet GetAggregatedProperties(IList<ExprAggregateNode> aggregateNodes)
        {
            // Get a list of properties being aggregated in the clause.
            ExprNodePropOrStreamSet propertiesAggregated = new ExprNodePropOrStreamSet();
            ExprNodeIdentifierAndStreamRefVisitor visitor = new ExprNodeIdentifierAndStreamRefVisitor(true);
            foreach (ExprNode selectAggExprNode in aggregateNodes) {
                visitor.Reset();
                selectAggExprNode.Accept(visitor);
                IList<ExprNodePropOrStreamDesc> properties = visitor.Refs;
                propertiesAggregated.AddAll(properties);
            }

            return propertiesAggregated;
        }
Exemplo n.º 4
0
        public static ExprNodePropOrStreamSet GetNonAggregatedProps(
            EventType[] types,
            IList<ExprNode> exprNodes,
            ContextPropertyRegistry contextPropertyRegistry)
        {
            // Determine all event properties in the clause
            ExprNodePropOrStreamSet nonAggProps = new ExprNodePropOrStreamSet();
            ExprNodeIdentifierAndStreamRefVisitor visitor = new ExprNodeIdentifierAndStreamRefVisitor(false);
            foreach (ExprNode node in exprNodes) {
                visitor.Reset();
                node.Accept(visitor);
                AddNonAggregatedProps(nonAggProps, visitor.Refs, types, contextPropertyRegistry);
            }

            return nonAggProps;
        }
Exemplo n.º 5
0
        public static ExprNodePropOrStreamSet GetGroupByPropertiesValidateHasOne(ExprNode[] groupByNodes)
        {
            // Get the set of properties refered to by all group-by expression nodes.
            ExprNodePropOrStreamSet propertiesGroupBy = new ExprNodePropOrStreamSet();
            ExprNodeIdentifierAndStreamRefVisitor visitor = new ExprNodeIdentifierAndStreamRefVisitor(true);

            foreach (ExprNode groupByNode in groupByNodes) {
                visitor.Reset();
                groupByNode.Accept(visitor);
                IList<ExprNodePropOrStreamDesc> propertiesNode = visitor.Refs;
                propertiesGroupBy.AddAll(propertiesNode);

                // For each group-by expression node, require at least one property.
                if (propertiesNode.IsEmpty()) {
                    throw new ExprValidationException("Group-by expressions must refer to property names");
                }
            }

            return propertiesGroupBy;
        }
Exemplo n.º 6
0
 private static void AddNonAggregatedProps(
     ExprNodePropOrStreamSet nonAggProps,
     IList<ExprNodePropOrStreamDesc> refs,
     EventType[] types,
     ContextPropertyRegistry contextPropertyRegistry)
 {
     foreach (ExprNodePropOrStreamDesc pair in refs) {
         if (pair is ExprNodePropOrStreamPropDesc) {
             ExprNodePropOrStreamPropDesc propDesc = (ExprNodePropOrStreamPropDesc) pair;
             EventType originType = types.Length > pair.StreamNum ? types[pair.StreamNum] : null;
             if (originType == null ||
                 contextPropertyRegistry == null ||
                 !contextPropertyRegistry.IsPartitionProperty(originType, propDesc.PropertyName)) {
                 nonAggProps.Add(pair);
             }
         }
         else {
             nonAggProps.Add(pair);
         }
     }
 }
Exemplo n.º 7
0
        public string NotContainsAll(ExprNodePropOrStreamSet other)
        {
            if (other._properties != null) {
                foreach (ExprNodePropOrStreamPropDesc otherProp in other._properties) {
                    bool found = FindItem(otherProp);
                    if (!found) {
                        return otherProp.Textual;
                    }
                }
            }

            if (other._expressions != null) {
                foreach (ExprNodePropOrStreamExprDesc otherExpr in other._expressions) {
                    bool found = FindItem(otherExpr);
                    if (!found) {
                        return otherExpr.Textual;
                    }
                }
            }

            return null;
        }