/// <summary>
        /// Parses Group by parse tree, the information is stored in the expression info class.
        /// The reason this method is separated from constructor is because it cannot guess whether the
        /// clause is a normal group by or a single group group by, thus the group by must always be parsed
        /// as the first clause after the Match clause.
        /// </summary>
        public static void ParseGroupBy(Graph graph, VariableMap variableMap, IGroupByExecutionHelper executionHelper, GroupByNode groupByNode, QueryExpressionInfo exprInfo)
        {
            if (executionHelper == null || groupByNode == null || variableMap == null || graph == null || exprInfo == null)
            {
                throw new ArgumentNullException($"Group by results processor, passing null arguments to the constructor.");
            }

            var groupbyVisitor = new GroupByVisitor(graph.labels, variableMap, exprInfo);

            groupbyVisitor.Visit(groupByNode);
            executionHelper.IsSetGroupBy = true;
        }
Esempio n. 2
0
        /// <summary>
        /// Creates a group by object for multigroup group by (defined group by clause).
        /// </summary>
        /// <param name="graph"> A property graph. </param>
        /// <param name="variableMap"> A variable map. </param>
        /// <param name="executionHelper"> A group by execution helper. </param>
        /// <param name="groupByNode"> A parsed tree of group by expression. </param>
        /// <param name="exprInfo"> A query expression information. </param>
        public GroupByObject(Graph graph, VariableMap variableMap, IGroupByExecutionHelper executionHelper, GroupByNode groupByNode, QueryExpressionInfo exprInfo)
        {
            if (executionHelper == null || groupByNode == null || variableMap == null || graph == null || exprInfo == null)
            {
                throw new ArgumentNullException($"{this.GetType()}, passing null arguments to the constructor.");
            }

            this.helper = executionHelper;

            var groupbyVisitor = new GroupByVisitor(graph.labels, variableMap, exprInfo);

            groupbyVisitor.Visit(groupByNode);
            this.hashes = groupbyVisitor.GetResult().ToArray();

            this.aggregates          = exprInfo.Aggregates;
            this.helper.IsSetGroupBy = true;
        }