protected List <string> GetGroupingColumns(INodeSchema schema) { var groupByCols = GroupBy .Select(col => { var colName = col.GetColumnName(); schema.ContainsColumn(colName, out colName); return(colName); }) .ToList(); return(groupByCols); }
public override void AddRequiredColumns(IDictionary <string, DataSource> dataSources, IDictionary <string, Type> parameterTypes, IList <string> requiredColumns) { // Columns required by previous nodes must be derived from this node, so no need to pass them through. // Just calculate the columns that are required to calculate the groups & aggregates var scalarRequiredColumns = new List <string>(); if (GroupBy != null) { scalarRequiredColumns.AddRange(GroupBy.Select(g => g.GetColumnName())); } scalarRequiredColumns.AddRange(Aggregates.Where(agg => agg.Value.SqlExpression != null).SelectMany(agg => agg.Value.SqlExpression.GetColumns()).Distinct()); Source.AddRequiredColumns(dataSources, parameterTypes, scalarRequiredColumns); }
public override string ToString() { var parts = new List <string>(); if (SkipCount > 0) { parts.Add("Skip " + SkipCount); } if (TakeCount > 0) { parts.Add("Take " + TakeCount); } parts.Add(base.ToString()); parts.AddRange(OrderBy.Select(x => x.ToString())); parts.AddRange(GroupBy.Select(x => $"Group by {x}")); return(string.Join("; ", parts)); }