protected virtual Expression VisitPartitionedAggregate(PartitionedAggregateExpression agg)
		{
			var flag = false;

			List<Expression> orderBy = null;
			if (agg.OrderBy != null)
			{
				orderBy = agg.OrderBy.Select(e => this.Visit(e)).ToList();
				if (!orderBy.SequenceEqual(agg.OrderBy))
					flag = true;
			}

			List<Expression> partitionBy = null;
			if (agg.PartitionBy != null)
			{
				partitionBy = agg.PartitionBy.Select(e => this.Visit(e)).ToList();
				if (!partitionBy.SequenceEqual(agg.PartitionBy))
					flag = true;
			}

			var ofValue = this.Visit(agg.OfValue);
			if (ofValue != agg.OfValue)
				flag = true;

			if (!flag)
				return agg;

			return CompleteExpression.PartitionedAggregate(
				agg.Type, agg.Method, orderBy: orderBy, partitionBy: partitionBy, ofValue: ofValue);
		}
		protected virtual Expression VisitPartitionedAggregate(PartitionedAggregateExpression agg)
		{
			var needsComma = false;

			this.Write(".");
			this.Write(agg.Method);
			this.Write("(");

			if (agg.OfValue != null)
			{
				this.WriteLine(Indentation.Inner);
				this.Write("ofValue: ");
				this.Visit(agg.OfValue);
				needsComma = true;
			}

			if (agg.PartitionBy != null)
			{
				if (needsComma)
				{
					this.Write(",");
					this.WriteLine(Indentation.Same);
				}
				else
					this.WriteLine(Indentation.Inner);

				this.Write("partitionBy: ");
				this.Visit(agg.PartitionBy);
				needsComma = true;
			}

			if (agg.OrderBy != null)
			{
				if (needsComma)
				{
					this.Write(",");
					this.WriteLine(Indentation.Same);
				}
				else
					this.WriteLine(Indentation.Inner);

				this.Write("orderBy: ");
				this.Visit(agg.OrderBy);
				needsComma = true;
			}

			if (needsComma)
				this.WriteLine(Indentation.Outer);

			this.Write(")");
			return agg;
		}
		protected override Expression VisitPartitionedAggregate(PartitionedAggregateExpression agg)
		{
			sb.Append(agg.Method.ToLower());

			sb.Append("(");
			if (agg.Method == "Count")
				sb.Append("*");
			else
				this.Visit(agg.OfValue);
			sb.Append(") over (");

			if (agg.PartitionBy != null)
			{
				sb.Append("partition by ");
				this.Visit(agg.PartitionBy);
				sb.Append(" ");
			}
			if (agg.OrderBy != null)
			{
				sb.Append("order by ");
				this.Visit(agg.OrderBy);
				sb.Append(" ");
			}
			sb.Append(")");

			return agg;
		}