summaryrefslogtreecommitdiff
path: root/src/mongo/db/exec/sbe/stages/union.h
diff options
context:
space:
mode:
authorDavid Storch <david.storch@mongodb.com>2021-06-23 15:29:26 -0400
committerEvergreen Agent <no-reply@evergreen.mongodb.com>2021-06-24 20:33:12 +0000
commit493e0058075cb8ac67d1eda1cea94417ab11d30c (patch)
tree20ca4f05926a3c1e37fac68cee3564be4b55d51c /src/mongo/db/exec/sbe/stages/union.h
parent4ebd3bc28ccef7b7e1ad91ce9d3f4338b61a7d0e (diff)
downloadmongo-493e0058075cb8ac67d1eda1cea94417ab11d30c.tar.gz
SERVER-48447 Add comments to all SBE PlanStages describing their contract
Diffstat (limited to 'src/mongo/db/exec/sbe/stages/union.h')
-rw-r--r--src/mongo/db/exec/sbe/stages/union.h14
1 files changed, 14 insertions, 0 deletions
diff --git a/src/mongo/db/exec/sbe/stages/union.h b/src/mongo/db/exec/sbe/stages/union.h
index f648b66e81d..be4aeb6954a 100644
--- a/src/mongo/db/exec/sbe/stages/union.h
+++ b/src/mongo/db/exec/sbe/stages/union.h
@@ -34,6 +34,20 @@
#include "mongo/db/exec/sbe/stages/stages.h"
namespace mongo::sbe {
+/**
+ * Combines values from multiple streams into one stream. The union has n 'inputStages', each of
+ * which provides m slots, specified as a vector of slot vectors 'inputVals'. (This vector has n * m
+ * total slots.) The union stage itself also returns m slots, specified as 'outputVals'. Each of the
+ * n branches is executed in turn until reaching EOF, and the values from its m slots are remapped
+ * to the m output slots.
+ *
+ * This is a binding reflector, meaning that only the 'outputVals' slots are visible to stages
+ * higher in the tree.
+ *
+ * Debug string repsentation:
+ *
+ * union [<output slots>] [[<input slots 1>] childStage_1, ..., [<input slots n>] childStage_n]
+ */
class UnionStage final : public PlanStage {
public:
UnionStage(std::vector<std::unique_ptr<PlanStage>> inputStages,