private void AddAggregateRow(Result result, object[] row, int len, int count) { for (int i = 0; i < len; i++) { ExpressionType t = eColumn[i].Type; if (t == ExpressionType.Average) { row[i] = Column.Avg(row[i], eColumn[i].ColumnType, count); } else if (t == ExpressionType.Count) { // this fixes the problem with count(*) on a empty table if (row[i] == null) { row[i] = 0; } } if (t == ExpressionType.RowNumber) { // this is copy of previous block, not sure if this block is necessary if (row[i] == null) { row[i] = 0; } } } result.Add(row); }