public async Task <ExecuteResult> ExecuteAsync(IInternalExecutionContext context) { var rows = (await this.dataSourceFactory(context).ConfigureAwait(false)).GetRows(context, this.query); var rowBuilder = new RowBuilder(new FieldMapping(this.fieldNames)); rows = this.asyncValueFactory != null ? rows.Select(async row => rowBuilder.CreateRow <object>(row.UniqueId, await this.asyncValueFactory(context, row))) : rows.Select(row => rowBuilder.CreateRow(row.UniqueId, this.valueFactory(context, row))); #if DEBUG rows = await rows.MaterializeAsync(); #endif return(new ExecuteResult(0, rows)); }
public async Task <ExecuteResult> ExecuteAsync(IInternalExecutionContext context) { var rowBuilder = new RowBuilder(new FieldMapping(this.fields)); var result = await this.plan.ExecuteAsync(context).ConfigureAwait(false); var id = 0; var grouped = result.QueryResults[0].Rows .GroupBy(row => this.groupFields.Select(f => row[f]).ToArray(), ArrayOfObjectComparer.Default) .Select(async group => rowBuilder.CreateRow(id++, await this.rowFactory(context, group).ConfigureAwait(false))) .Where(this.having.GetRowFilter()) .OrderBy(this.orders); #if DEBUG grouped = await context.MaterializeAsync(grouped).ConfigureAwait(false); #endif return(new ExecuteResult(0, grouped)); }