private bool CompareGroupBy(GroupByTransformationNode transformation1, GroupByTransformationNode transformation2)
        {
            if (transformation1 == transformation2)
            {
                return(true);
            }
            if (transformation1 == null || transformation2 == null)
            {
                return(false);
            }

            if (!_queryNodeComparer.Compare(transformation1.Source, transformation2.Source))
            {
                return(false);
            }

            if (!CompareAggregate(transformation1.ChildTransformations as AggregateTransformationNode, transformation2.ChildTransformations as AggregateTransformationNode))
            {
                return(false);
            }

            if (!EnumerableComparer.Compare(transformation1.GroupingProperties, transformation2.GroupingProperties, CompareGroupByPropertyNode))
            {
                return(false);
            }

            return(true);
        }
        private bool CompareAggregate(AggregateTransformationNode node1, AggregateTransformationNode node2)
        {
            if (node1 == node2)
            {
                return(true);
            }
            if (node1 == null || node2 == null)
            {
                return(false);
            }

            return(EnumerableComparer.Compare(node1.Expressions, node2.Expressions, CompareAggregate));
        }
        private bool CompareApply(ApplyClause clause1, ApplyClause clause2)
        {
            if (clause1 == clause2)
            {
                return(true);
            }
            if (clause1 == null || clause2 == null)
            {
                return(false);
            }

            return(EnumerableComparer.Compare(clause1.Transformations, clause2.Transformations, CompareTransformation));
        }
        private bool CompareSelectAndExpand(SelectExpandClause clause1, SelectExpandClause clause2, ODataPath path)
        {
            if (clause1 == clause2)
            {
                return(true);
            }
            if (clause1 == null || clause2 == null)
            {
                return(false);
            }

            return(clause1.AllSelected == clause2.AllSelected &&
                   EnumerableComparer.Compare(clause1.SelectedItems, clause2.SelectedItems, path, CompareSelectItem));
        }
        private bool CompareGroupByPropertyNode(GroupByPropertyNode node1, GroupByPropertyNode node2)
        {
            if (node1 == node2)
            {
                return(true);
            }
            if (node1 == null || node2 == null)
            {
                return(false);
            }

            return(_queryNodeComparer.Compare(node1.Expression, node2.Expression) &&
                   EnumerableComparer.Compare(node1.ChildTransformations, node2.ChildTransformations, CompareGroupByPropertyNode));
        }