Esempio n. 1
0
        public async Task <Result> QueryAsync(WorkerInput input)
        {
            var plan = input.Plan;

            var underlyingResults = _underlying.ExecuteAsync(plan.UnderlyingQuery, input.DataLocation);
            var orderedResults    = ResultProcessor.Order(plan.Order, underlyingResults);
            var limitedResults    = ResultProcessor.Limit(plan.Limit, orderedResults);
            // TODO do we need any worker side projection?
            var results = limitedResults;

            return(await _resultsStorer.StoreAsync(results).ConfigureAwait(false));
        }
Esempio n. 2
0
        public async Task <Result> QueryAsync(DistributorInput input)
        {
            var plan = _planner.Plan(input.Query);

            var sources = await _sourceResolver.ResolveAsync(input.Source).ConfigureAwait(false);

            var workerResultSets = _workerExecutor.ExecuteAsync(plan.WorkerPlan, sources);

            // TODO ordering+limit could be more efficient using the result sets directly (it might also be required for performance)
            var workerFetchedResultSets = workerResultSets.Select(x => _resultsFetcher.FetchAsync(x));
            var workerResults           = workerFetchedResultSets.SelectMany(x => x);

            var orderedResults = ResultProcessor.Order(plan.Order, workerResults);
            var limitedResults = ResultProcessor.Limit(plan.Limit, orderedResults);
            var results        = ProjectResults(limitedResults);

            return(await _resultsStorer.StoreAsync(results).ConfigureAwait(false));
        }