summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorNicholas Zolnierz <nicholas.zolnierz@mongodb.com>2019-09-13 19:42:25 +0000
committerevergreen <evergreen@mongodb.com>2019-09-13 19:42:25 +0000
commitabfc416116f6d5df1aea9bfe9e1d74c5b465c3a9 (patch)
treed42c1b6467377a3da107070d899910945bf6e620 /src
parent9d07c9c18090bcbeaf40eaebf584de5d1b17a74f (diff)
downloadmongo-abfc416116f6d5df1aea9bfe9e1d74c5b465c3a9.tar.gz
Revert "SERVER-42903 Enable execution of translated M/R pipeline"
This reverts commit f0c5f3000d83f806272c010002f8c64513a09330.
Diffstat (limited to 'src')
-rw-r--r--src/mongo/db/commands/map_reduce_agg.cpp26
1 files changed, 8 insertions, 18 deletions
diff --git a/src/mongo/db/commands/map_reduce_agg.cpp b/src/mongo/db/commands/map_reduce_agg.cpp
index 774237627fa..a1866c9372c 100644
--- a/src/mongo/db/commands/map_reduce_agg.cpp
+++ b/src/mongo/db/commands/map_reduce_agg.cpp
@@ -241,38 +241,28 @@ bool runAggregationMapReduce(OperationContext* opCtx,
};
auto parsedMr = MapReduce::parse(IDLParserErrorContext("MapReduce"), cmd);
- auto expCtx = makeExpressionContext(opCtx, parsedMr);
- auto runnablePipeline = [&]() {
- auto pipeline = translateFromMR(parsedMr, expCtx);
- return expCtx->mongoProcessInterface->attachCursorSourceToPipelineForLocalRead(
- expCtx, pipeline.release());
- }();
+ bool inMemory = parsedMr.getOutOptions().getOutputType() == OutputType::InMemory;
- if (parsedMr.getOutOptions().getOutputType() == OutputType::InMemory) {
- map_reduce_output_format::appendInlineResponse(
- exhaustPipelineIntoBSONArray(runnablePipeline),
- boost::get_optional_value_or(parsedMr.getVerbose(), false),
- false,
- &result);
- } else {
- // For non-inline output, the pipeline should not return any results however getNext() still
- // needs to be called once to ensure documents are written to the output collection.
- invariant(!runnablePipeline->getNext());
+ auto pipe = translateFromMR(parsedMr, makeExpressionContext(opCtx, parsedMr));
+ if (inMemory)
+ map_reduce_output_format::appendInlineResponse(exhaustPipelineIntoBSONArray(pipe),
+ parsedMr.getVerbose().get_value_or(false),
+ false,
+ &result);
+ else
map_reduce_output_format::appendOutResponse(
parsedMr.getOutOptions().getDatabaseName(),
parsedMr.getOutOptions().getCollectionName(),
boost::get_optional_value_or(parsedMr.getVerbose(), false),
false,
&result);
- }
return true;
}
std::unique_ptr<Pipeline, PipelineDeleter> translateFromMR(
MapReduce parsedMr, boost::intrusive_ptr<ExpressionContext> expCtx) {
-
// TODO: It would be good to figure out what kind of errors this would produce in the Status.
// It would be better not to produce something incomprehensible out of an internal translation.
return uassertStatusOK(Pipeline::create(