diff options
author | Charlie Swanson <charlie.swanson@mongodb.com> | 2016-12-13 10:15:08 -0500 |
---|---|---|
committer | Charlie Swanson <charlie.swanson@mongodb.com> | 2016-12-16 16:24:32 -0500 |
commit | 37e720678f6e468726c6cc775a5dc898d080f0f3 (patch) | |
tree | 4bd6b4932cc0ac436c0d7c949f7e37df613684d2 /src/mongo/db/pipeline/accumulator_std_dev.cpp | |
parent | 0cd2bf29d5798a395a07e67ae79ede9a5cefd411 (diff) | |
download | mongo-37e720678f6e468726c6cc775a5dc898d080f0f3.tar.gz |
SERVER-25535 Remove injectExpressionContext().
These methods were formally used to propagate a new ExpressionContext to
stages, accumulators, or expressions which potentially needed to
comparisons. Originally, this was necessary since Pipeline parsing
happened outside of the collection lock and thus could not determine if
there was a default collation on the collection. This meant that the
collation could change after parsing and any operators that might
compare strings would need to know about it.
We have since moved parsing within the lock, so the collation can be
known at parse time and the ExpressionContext should not change. This
patch requires an ExpressionContext at construction time, and disallows
changing the collation on an ExpressionContext.
Diffstat (limited to 'src/mongo/db/pipeline/accumulator_std_dev.cpp')
-rw-r--r-- | src/mongo/db/pipeline/accumulator_std_dev.cpp | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/src/mongo/db/pipeline/accumulator_std_dev.cpp b/src/mongo/db/pipeline/accumulator_std_dev.cpp index 28565250fe3..f45678dce27 100644 --- a/src/mongo/db/pipeline/accumulator_std_dev.cpp +++ b/src/mongo/db/pipeline/accumulator_std_dev.cpp @@ -95,15 +95,19 @@ Value AccumulatorStdDev::getValue(bool toBeMerged) const { } } -intrusive_ptr<Accumulator> AccumulatorStdDevSamp::create() { - return new AccumulatorStdDevSamp(); +intrusive_ptr<Accumulator> AccumulatorStdDevSamp::create( + const boost::intrusive_ptr<ExpressionContext>& expCtx) { + return new AccumulatorStdDevSamp(expCtx); } -intrusive_ptr<Accumulator> AccumulatorStdDevPop::create() { - return new AccumulatorStdDevPop(); +intrusive_ptr<Accumulator> AccumulatorStdDevPop::create( + const boost::intrusive_ptr<ExpressionContext>& expCtx) { + return new AccumulatorStdDevPop(expCtx); } -AccumulatorStdDev::AccumulatorStdDev(bool isSamp) : _isSamp(isSamp), _count(0), _mean(0), _m2(0) { +AccumulatorStdDev::AccumulatorStdDev(const boost::intrusive_ptr<ExpressionContext>& expCtx, + bool isSamp) + : Accumulator(expCtx), _isSamp(isSamp), _count(0), _mean(0), _m2(0) { // This is a fixed size Accumulator so we never need to update this _memUsageBytes = sizeof(*this); } |