public override string ToString() { var translator = new BigQueryTranslateVisitor(); var orderByBuilder = new List <string>(); FullWindowFunction <TSource, TResult, TPartitionKey> self = this; while (self.parent != null) { orderByBuilder.Add(translator.VisitAndClearBuffer(self.orderKeySelector) + (self.isDescending ? " DESC" : "")); self = self.parent; } orderByBuilder.Add(translator.VisitAndClearBuffer(self.orderKeySelector) + (self.isDescending ? " DESC" : "")); orderByBuilder.Reverse(); if (self.partitionKeySelector != null) { var expr1 = translator.VisitAndClearBuffer(self.partitionKeySelector); var expr2 = string.Join(", ", orderByBuilder); var s = string.Format("{0}({1}) OVER (PARTITION BY {2} ORDER BY {3})", self.methodName, self.argument, expr1, expr2); return(s); } else { var expr2 = string.Join(", ", orderByBuilder); var s = string.Format("{0}({1}) OVER (ORDER BY {2})", self.methodName, self.argument, expr2); return(s); } }
internal FullWindowFunction(string methodName, string argument, Expression <Func <TSource, TPartitionKey> > partitionKeySelector, /* Expression<Func<TSource, TOrderKey>> */ Expression orderKeySelector, bool isDescending) { this.methodName = methodName; this.argument = argument; this.partitionKeySelector = partitionKeySelector; this.orderKeySelector = orderKeySelector; this.isDescending = isDescending; this.parent = null; }
internal FullWindowFunction(FullWindowFunction <TSource, TResult, TPartitionKey> parent, Expression orderKeySelector, bool isDescending) { this.parent = parent; this.orderKeySelector = orderKeySelector; this.isDescending = isDescending; }