summaryrefslogtreecommitdiff
path: root/src/mongo/db/query/bind_input_params.cpp
diff options
context:
space:
mode:
authorIvan Fefer <ivan.fefer@mongodb.com>2023-04-12 10:43:30 +0000
committerEvergreen Agent <no-reply@evergreen.mongodb.com>2023-04-13 17:22:29 +0000
commitc93a58facc2214871fcdef35dcac9c704612b2d2 (patch)
treede06ed2a3eebc2f16ee87e7750b2b2587f846d01 /src/mongo/db/query/bind_input_params.cpp
parent80df62ebff5387596cce4c76b90e3c08a07ca7f6 (diff)
downloadmongo-c93a58facc2214871fcdef35dcac9c704612b2d2.tar.gz
SERVER-75752 Use stable collator interface pointer for ArraySet for $in equalities
Diffstat (limited to 'src/mongo/db/query/bind_input_params.cpp')
-rw-r--r--src/mongo/db/query/bind_input_params.cpp31
1 files changed, 10 insertions, 21 deletions
diff --git a/src/mongo/db/query/bind_input_params.cpp b/src/mongo/db/query/bind_input_params.cpp
index b93698b8585..90269987091 100644
--- a/src/mongo/db/query/bind_input_params.cpp
+++ b/src/mongo/db/query/bind_input_params.cpp
@@ -43,15 +43,9 @@ namespace {
class MatchExpressionParameterBindingVisitor final : public MatchExpressionConstVisitor {
public:
- MatchExpressionParameterBindingVisitor(
- const stage_builder::InputParamToSlotMap& inputParamToSlotMap,
- sbe::RuntimeEnvironment* runtimeEnvironment,
- bool bindingCachedPlan)
- : _inputParamToSlotMap(inputParamToSlotMap),
- _runtimeEnvironment(runtimeEnvironment),
- _bindingCachedPlan(bindingCachedPlan) {
- invariant(_runtimeEnvironment);
- }
+ MatchExpressionParameterBindingVisitor(stage_builder::PlanStageData& data,
+ bool bindingCachedPlan)
+ : _data(data), _bindingCachedPlan(bindingCachedPlan) {}
void visit(const BitsAllClearMatchExpression* expr) final {
visitBitTestExpression(expr);
@@ -93,7 +87,7 @@ public:
tassert(6279503, "Unexpected parameter marker for $in with regexes", !expr->hasRegex());
auto&& [arrSetTag, arrSetVal, hasArray, hasObject, hasNull] =
- stage_builder::convertInExpressionEqualities(expr);
+ stage_builder::convertInExpressionEqualities(expr, _data);
bindParam(*slotId, true /*owned*/, arrSetTag, arrSetVal);
// Auto-parameterization should not kick in if the $in's list of equalities includes any
@@ -291,7 +285,7 @@ private:
if (owned) {
guard.emplace(typeTag, value);
}
- auto accessor = _runtimeEnvironment->getAccessor(slotId);
+ auto accessor = _data.env->getAccessor(slotId);
if (owned) {
guard->reset();
}
@@ -304,17 +298,14 @@ private:
}
boost::optional<sbe::value::SlotId> getSlotId(MatchExpression::InputParamId paramId) const {
- auto it = _inputParamToSlotMap.find(paramId);
- if (it != _inputParamToSlotMap.end()) {
+ auto it = _data.inputParamToSlotMap.find(paramId);
+ if (it != _data.inputParamToSlotMap.end()) {
return it->second;
}
return boost::none;
}
- const stage_builder::InputParamToSlotMap& _inputParamToSlotMap;
-
- sbe::RuntimeEnvironment* const _runtimeEnvironment;
-
+ stage_builder::PlanStageData& _data;
// True if the plan for which we are binding parameter values is being recovered from the SBE
// plan cache.
const bool _bindingCachedPlan;
@@ -430,11 +421,9 @@ void bindGenericPlanSlots(const stage_builder::IndexBoundsEvaluationInfo& indexB
} // namespace
void bind(const CanonicalQuery& canonicalQuery,
- const stage_builder::InputParamToSlotMap& inputParamToSlotMap,
- sbe::RuntimeEnvironment* runtimeEnvironment,
+ stage_builder::PlanStageData& data,
const bool bindingCachedPlan) {
- MatchExpressionParameterBindingVisitor visitor{
- inputParamToSlotMap, runtimeEnvironment, bindingCachedPlan};
+ MatchExpressionParameterBindingVisitor visitor{data, bindingCachedPlan};
MatchExpressionParameterBindingWalker walker{&visitor};
tree_walker::walk<true, MatchExpression>(canonicalQuery.root(), &walker);
}