public AstUnaryWindowExpression Update(AstUnaryWindowOperator @operator, AstExpression arg, AstWindow window)
        {
            if (@operator == _operator && arg == _arg && window == _window)
            {
                return(this);
            }

            return(new AstUnaryWindowExpression(@operator, arg, window));
        }
 public static string Render(this AstUnaryWindowOperator @operator)
 {
     return(@operator switch
     {
         AstUnaryWindowOperator.AddToSet => "$addToSet",
         AstUnaryWindowOperator.Average => "$avg",
         AstUnaryWindowOperator.First => "$first",
         AstUnaryWindowOperator.Last => "$last",
         AstUnaryWindowOperator.Locf => "$locf",
         AstUnaryWindowOperator.Max => "$max",
         AstUnaryWindowOperator.Min => "$min",
         AstUnaryWindowOperator.Push => "$push",
         AstUnaryWindowOperator.StandardDeviationPopulation => "$stdDevPop",
         AstUnaryWindowOperator.StandardDeviationSample => "$stdDevSamp",
         AstUnaryWindowOperator.Sum => "$sum",
         _ => throw new InvalidOperationException($"Unexpected unary window operator: {@operator}.")
     });
 public AstUnaryWindowExpression(AstUnaryWindowOperator @operator, AstExpression arg, AstWindow window)
 {
     _operator = @operator;
     _arg      = Ensure.IsNotNull(arg, nameof(arg));
     _window   = window;
 }