diff options
Diffstat (limited to 'src/mongo/db/test_output/pipeline/abt/a_b_t_translate/basic_tests.txt')
-rw-r--r-- | src/mongo/db/test_output/pipeline/abt/a_b_t_translate/basic_tests.txt | 1686 |
1 files changed, 1686 insertions, 0 deletions
diff --git a/src/mongo/db/test_output/pipeline/abt/a_b_t_translate/basic_tests.txt b/src/mongo/db/test_output/pipeline/abt/a_b_t_translate/basic_tests.txt new file mode 100644 index 00000000000..b13052e048a --- /dev/null +++ b/src/mongo/db/test_output/pipeline/abt/a_b_t_translate/basic_tests.txt @@ -0,0 +1,1686 @@ +==== VARIATION: $match with $in, empty list ==== +-- INPUTS: +pipeline: [{$match: {a: {$in: []}}}] +metadata: + number of partitions: 1 + scan definitions: + collection: + options: + distribution and paths: + distribution type: Centralized + distribution paths: + indexes: + non multi-key index paths: + collection exists: 1 + CE type: -1 + +-- OUTPUT: +Root [] +| | projections: +| | scan_0 +| RefBlock: +| Variable [scan_0] +Filter [] +| EvalFilter [] +| | Variable [scan_0] +| PathConstant [] +| Const [false] +Scan [collection] + BindBlock: + [scan_0] + Source [] + + +==== VARIATION: match with $in, singleton list ==== +-- INPUTS: +pipeline: [{$match: {a: {$in: [1]}}}] +metadata: + number of partitions: 1 + scan definitions: + collection: + options: + distribution and paths: + distribution type: Centralized + distribution paths: + indexes: + non multi-key index paths: + collection exists: 1 + CE type: -1 + +-- OUTPUT: +Root [] +| | projections: +| | scan_0 +| RefBlock: +| Variable [scan_0] +Filter [] +| EvalFilter [] +| | Variable [scan_0] +| PathGet [a] +| PathTraverse [1] +| PathCompare [Eq] +| Const [1] +Scan [collection] + BindBlock: + [scan_0] + Source [] + + +==== VARIATION: $match with $in and a list of equalities becomes a comparison to an EqMember list. ==== +-- INPUTS: +pipeline: [{$match: {a: {$in: [1, 2, 3]}}}] +metadata: + number of partitions: 1 + scan definitions: + collection: + options: + distribution and paths: + distribution type: Centralized + distribution paths: + indexes: + non multi-key index paths: + collection exists: 1 + CE type: -1 + +-- OUTPUT: +Root [] +| | projections: +| | scan_0 +| RefBlock: +| Variable [scan_0] +Filter [] +| EvalFilter [] +| | Variable [scan_0] +| PathGet [a] +| PathTraverse [1] +| PathCompare [EqMember] +| Const [[1, 2, 3]] +Scan [collection] + BindBlock: + [scan_0] + Source [] + + +==== VARIATION: match with $in over an array, duplicated equalities removed ==== +-- INPUTS: +pipeline: [{$match: {a: {$in: ['abc', 'def', 'ghi', 'def']}}}] +metadata: + number of partitions: 1 + scan definitions: + collection: + options: + distribution and paths: + distribution type: Centralized + distribution paths: + indexes: + non multi-key index paths: + collection exists: 1 + CE type: -1 + +-- OUTPUT: +Root [] +| | projections: +| | scan_0 +| RefBlock: +| Variable [scan_0] +Filter [] +| EvalFilter [] +| | Variable [scan_0] +| PathGet [a] +| PathTraverse [1] +| PathCompare [EqMember] +| Const [["abc", "def", "ghi"]] +Scan [collection] + BindBlock: + [scan_0] + Source [] + + +==== VARIATION: $match with empty $elemMatch ==== +-- INPUTS: +pipeline: [{$match: {'a': {$elemMatch: {}}}}] +metadata: + number of partitions: 1 + scan definitions: + collection: + options: + distribution and paths: + distribution type: Centralized + distribution paths: + indexes: + non multi-key index paths: + collection exists: 1 + CE type: -1 + +-- OUTPUT: +Root [] +| | projections: +| | scan_0 +| RefBlock: +| Variable [scan_0] +Filter [] +| EvalFilter [] +| | Variable [scan_0] +| PathGet [a] +| PathComposeM [] +| | PathArr [] +| PathTraverse [1] +| PathComposeM [] +| | PathComposeA [] +| | | PathArr [] +| | PathObj [] +| PathConstant [] +| Const [true] +Scan [collection] + BindBlock: + [scan_0] + Source [] + + +==== VARIATION: ensure the PathGet and PathTraverse operators interact correctly when $in is under $elemMatch ==== +-- INPUTS: +pipeline: [{$match: {'a.b': {$elemMatch: {$in: [1, 2, 3]}}}}] +metadata: + number of partitions: 1 + scan definitions: + collection: + options: + distribution and paths: + distribution type: Centralized + distribution paths: + indexes: + non multi-key index paths: + collection exists: 1 + CE type: -1 + +-- OUTPUT: +Root [] +| | projections: +| | scan_0 +| RefBlock: +| Variable [scan_0] +Filter [] +| EvalFilter [] +| | Variable [scan_0] +| PathGet [a] +| PathTraverse [1] +| PathGet [b] +| PathComposeM [] +| | PathArr [] +| PathTraverse [1] +| PathCompare [EqMember] +| Const [[1, 2, 3]] +Scan [collection] + BindBlock: + [scan_0] + Source [] + + +==== VARIATION: sort limit skip ==== +-- INPUTS: +pipeline: [{$limit: 5}, {$skip: 3}, {$sort: {a: 1, b: -1}}] +metadata: + number of partitions: 1 + scan definitions: + collection: + options: + distribution and paths: + distribution type: Centralized + distribution paths: + indexes: + non multi-key index paths: + collection exists: 1 + CE type: -1 + +-- OUTPUT: +Root [] +| | projections: +| | scan_0 +| RefBlock: +| Variable [scan_0] +Collation [] +| | collation: +| | sort_0: Ascending +| | sort_1: Descending +| RefBlock: +| Variable [sort_0] +| Variable [sort_1] +Evaluation [] +| BindBlock: +| [sort_1] +| EvalPath [] +| | Variable [scan_0] +| PathGet [b] +| PathIdentity [] +Evaluation [] +| BindBlock: +| [sort_0] +| EvalPath [] +| | Variable [scan_0] +| PathGet [a] +| PathIdentity [] +LimitSkip [] +| limitSkip: +| limit: (none) +| skip: 3 +LimitSkip [] +| limitSkip: +| limit: 5 +| skip: 0 +Scan [collection] + BindBlock: + [scan_0] + Source [] + + +==== VARIATION: inclusion project ==== +-- INPUTS: +pipeline: [{$project: {a1: 1, a2: 1, a3: 1, a4: 1, a5: 1, a6: 1}}] +metadata: + number of partitions: 1 + scan definitions: + collection: + options: + distribution and paths: + distribution type: Centralized + distribution paths: + indexes: + non multi-key index paths: + collection exists: 1 + CE type: -1 + +-- OUTPUT: +Root [] +| | projections: +| | combinedProjection_0 +| RefBlock: +| Variable [combinedProjection_0] +Evaluation [] +| BindBlock: +| [combinedProjection_0] +| EvalPath [] +| | Variable [scan_0] +| PathKeep [_id, a1, a2, a3, a4, a5, a6] +Scan [collection] + BindBlock: + [scan_0] + Source [] + + +==== VARIATION: project rename through addFields: since '$z' is a single element, it will be considered a renamed path ==== +-- INPUTS: +pipeline: [{$addFields: {a: '$z'}}] +metadata: + number of partitions: 1 + scan definitions: + collection: + options: + distribution and paths: + distribution type: Centralized + distribution paths: + indexes: + non multi-key index paths: + collection exists: 1 + CE type: -1 + +-- OUTPUT: +Root [] +| | projections: +| | combinedProjection_0 +| RefBlock: +| Variable [combinedProjection_0] +Evaluation [] +| BindBlock: +| [combinedProjection_0] +| EvalPath [] +| | Variable [scan_0] +| PathComposeM [] +| | PathDefault [] +| | Const [{}] +| PathField [a] +| PathConstant [] +| Variable [projRenamedPath_0] +Evaluation [] +| BindBlock: +| [projRenamedPath_0] +| EvalPath [] +| | Variable [scan_0] +| PathGet [z] +| PathIdentity [] +Scan [collection] + BindBlock: + [scan_0] + Source [] + + +==== VARIATION: project rename: since '$c' is a single element, it will be considered a renamed path ==== +-- INPUTS: +pipeline: [{$project: {'a.b': '$c'}}] +metadata: + number of partitions: 1 + scan definitions: + collection: + options: + distribution and paths: + distribution type: Centralized + distribution paths: + indexes: + non multi-key index paths: + collection exists: 1 + CE type: -1 + +-- OUTPUT: +Root [] +| | projections: +| | combinedProjection_0 +| RefBlock: +| Variable [combinedProjection_0] +Evaluation [] +| BindBlock: +| [combinedProjection_0] +| EvalPath [] +| | Variable [scan_0] +| PathComposeM [] +| | PathField [a] +| | PathTraverse [inf] +| | PathComposeM [] +| | | PathDefault [] +| | | Const [{}] +| | PathComposeM [] +| | | PathField [b] +| | | PathConstant [] +| | | Variable [projRenamedPath_0] +| | PathKeep [b] +| PathKeep [_id, a] +Evaluation [] +| BindBlock: +| [projRenamedPath_0] +| EvalPath [] +| | Variable [scan_0] +| PathGet [c] +| PathIdentity [] +Scan [collection] + BindBlock: + [scan_0] + Source [] + + +==== VARIATION: project rename dotted paths ==== +-- INPUTS: +pipeline: [{$project: {'a.b.c': '$x.y.z'}}] +metadata: + number of partitions: 1 + scan definitions: + collection: + options: + distribution and paths: + distribution type: Centralized + distribution paths: + indexes: + non multi-key index paths: + collection exists: 1 + CE type: -1 + +-- OUTPUT: +Root [] +| | projections: +| | combinedProjection_0 +| RefBlock: +| Variable [combinedProjection_0] +Evaluation [] +| BindBlock: +| [combinedProjection_0] +| EvalPath [] +| | Variable [scan_0] +| PathComposeM [] +| | PathField [a] +| | PathTraverse [inf] +| | PathComposeM [] +| | | PathField [b] +| | | PathTraverse [inf] +| | | PathComposeM [] +| | | | PathDefault [] +| | | | Const [{}] +| | | PathComposeM [] +| | | | PathField [c] +| | | | PathConstant [] +| | | | Variable [projGetPath_0] +| | | PathKeep [c] +| | PathKeep [b] +| PathKeep [_id, a] +Evaluation [] +| BindBlock: +| [projGetPath_0] +| EvalPath [] +| | Variable [scan_0] +| PathGet [x] +| PathTraverse [inf] +| PathGet [y] +| PathTraverse [inf] +| PathGet [z] +| PathIdentity [] +Scan [collection] + BindBlock: + [scan_0] + Source [] + + +==== VARIATION: inclusion project dotted paths ==== +-- INPUTS: +pipeline: [{$project: {'a.b':1, 'a.c':1, 'b':1}}] +metadata: + number of partitions: 1 + scan definitions: + collection: + options: + distribution and paths: + distribution type: Centralized + distribution paths: + indexes: + non multi-key index paths: + collection exists: 1 + CE type: -1 + +-- OUTPUT: +Root [] +| | projections: +| | combinedProjection_0 +| RefBlock: +| Variable [combinedProjection_0] +Evaluation [] +| BindBlock: +| [combinedProjection_0] +| EvalPath [] +| | Variable [scan_0] +| PathComposeM [] +| | PathField [a] +| | PathTraverse [inf] +| | PathComposeM [] +| | | PathKeep [b, c] +| | PathObj [] +| PathKeep [_id, a, b] +Scan [collection] + BindBlock: + [scan_0] + Source [] + + +==== VARIATION: inclusion project with computed field ==== +-- INPUTS: +pipeline: [{$project: {a: {$add: ['$c.d', 2]}, b: 1}}] +metadata: + number of partitions: 1 + scan definitions: + collection: + options: + distribution and paths: + distribution type: Centralized + distribution paths: + indexes: + non multi-key index paths: + collection exists: 1 + CE type: -1 + +-- OUTPUT: +Root [] +| | projections: +| | combinedProjection_0 +| RefBlock: +| Variable [combinedProjection_0] +Evaluation [] +| BindBlock: +| [combinedProjection_0] +| EvalPath [] +| | Variable [scan_0] +| PathComposeM [] +| | PathDefault [] +| | Const [{}] +| PathComposeM [] +| | PathField [a] +| | PathConstant [] +| | Variable [projGetPath_0] +| PathKeep [_id, a, b] +Evaluation [] +| BindBlock: +| [projGetPath_0] +| BinaryOp [Add] +| | Const [2] +| EvalPath [] +| | Variable [scan_0] +| PathGet [c] +| PathTraverse [inf] +| PathGet [d] +| PathIdentity [] +Scan [collection] + BindBlock: + [scan_0] + Source [] + + +==== VARIATION: exclusion project ==== +-- INPUTS: +pipeline: [{$project: {a: 0, b: 0}}] +metadata: + number of partitions: 1 + scan definitions: + collection: + options: + distribution and paths: + distribution type: Centralized + distribution paths: + indexes: + non multi-key index paths: + collection exists: 1 + CE type: -1 + +-- OUTPUT: +Root [] +| | projections: +| | combinedProjection_0 +| RefBlock: +| Variable [combinedProjection_0] +Evaluation [] +| BindBlock: +| [combinedProjection_0] +| EvalPath [] +| | Variable [scan_0] +| PathDrop [a, b] +Scan [collection] + BindBlock: + [scan_0] + Source [] + + +==== VARIATION: replaceRoot ==== +-- INPUTS: +pipeline: [{$replaceRoot: {newRoot: '$a'}}] +metadata: + number of partitions: 1 + scan definitions: + collection: + options: + distribution and paths: + distribution type: Centralized + distribution paths: + indexes: + non multi-key index paths: + collection exists: 1 + CE type: -1 + +-- OUTPUT: +Root [] +| | projections: +| | newRoot_0 +| RefBlock: +| Variable [newRoot_0] +Evaluation [] +| BindBlock: +| [newRoot_0] +| EvalPath [] +| | Variable [scan_0] +| PathGet [a] +| PathIdentity [] +Scan [collection] + BindBlock: + [scan_0] + Source [] + + +==== VARIATION: $match basic ==== +-- INPUTS: +pipeline: [{$match: {a: 1, b: 2}}] +metadata: + number of partitions: 1 + scan definitions: + collection: + options: + distribution and paths: + distribution type: Centralized + distribution paths: + indexes: + non multi-key index paths: + collection exists: 1 + CE type: -1 + +-- OUTPUT: +Root [] +| | projections: +| | scan_0 +| RefBlock: +| Variable [scan_0] +Filter [] +| EvalFilter [] +| | Variable [scan_0] +| PathGet [a] +| PathTraverse [1] +| PathCompare [Eq] +| Const [1] +Filter [] +| EvalFilter [] +| | Variable [scan_0] +| PathGet [b] +| PathTraverse [1] +| PathCompare [Eq] +| Const [2] +Scan [collection] + BindBlock: + [scan_0] + Source [] + + +==== VARIATION: $match with $expr $eq ==== +-- INPUTS: +pipeline: [{$match: {$expr: {$eq: ['$a', 1]}}}] +metadata: + number of partitions: 1 + scan definitions: + collection: + options: + distribution and paths: + distribution type: Centralized + distribution paths: + indexes: + non multi-key index paths: + collection exists: 1 + CE type: -1 + +-- OUTPUT: +Root [] +| | projections: +| | scan_0 +| RefBlock: +| Variable [scan_0] +Filter [] +| EvalFilter [] +| | Variable [scan_0] +| PathGet [a] +| PathCompare [Eq] +| Const [1] +Scan [collection] + BindBlock: + [scan_0] + Source [] + + +==== VARIATION: $match with $expr $eq with dotted path ==== +-- INPUTS: +pipeline: [{$match: {$expr: {$eq: ['$a.b', 1]}}}] +metadata: + number of partitions: 1 + scan definitions: + collection: + options: + distribution and paths: + distribution type: Centralized + distribution paths: + indexes: + non multi-key index paths: + collection exists: 1 + CE type: -1 + +-- OUTPUT: +Root [] +| | projections: +| | scan_0 +| RefBlock: +| Variable [scan_0] +Filter [] +| EvalFilter [] +| | Variable [scan_0] +| PathConstant [] +| BinaryOp [Eq] +| | Const [1] +| EvalPath [] +| | Variable [scan_0] +| PathGet [a] +| PathTraverse [inf] +| PathGet [b] +| PathIdentity [] +Scan [collection] + BindBlock: + [scan_0] + Source [] + + +==== VARIATION: $match with value $elemMatch: observe type bracketing in the filter. ==== +-- INPUTS: +pipeline: [{$project: {a: {$literal: [1, 2, 3, 4]}}}, {$match: {a: {$elemMatch: {$gte: 2, $lte: 3}}}}] +metadata: + number of partitions: 1 + scan definitions: + collection: + options: + distribution and paths: + distribution type: Centralized + distribution paths: + indexes: + non multi-key index paths: + collection exists: 1 + CE type: -1 + +-- OUTPUT: +Root [] +| | projections: +| | combinedProjection_0 +| RefBlock: +| Variable [combinedProjection_0] +Filter [] +| EvalFilter [] +| | Variable [combinedProjection_0] +| PathGet [a] +| PathComposeM [] +| | PathArr [] +| PathTraverse [1] +| PathComposeM [] +| | PathComposeM [] +| | | PathCompare [Lt] +| | | Const [""] +| | PathCompare [Gte] +| | Const [2] +| PathComposeM [] +| | PathCompare [Gte] +| | Const [nan] +| PathCompare [Lte] +| Const [3] +Evaluation [] +| BindBlock: +| [combinedProjection_0] +| EvalPath [] +| | Variable [scan_0] +| PathComposeM [] +| | PathDefault [] +| | Const [{}] +| PathComposeM [] +| | PathField [a] +| | PathConstant [] +| | Variable [projGetPath_0] +| PathKeep [_id, a] +Evaluation [] +| BindBlock: +| [projGetPath_0] +| Const [[1, 2, 3, 4]] +Scan [collection] + BindBlock: + [scan_0] + Source [] + + +==== VARIATION: $project then $match ==== +-- INPUTS: +pipeline: [{$project: {s: {$add: ['$a', '$b']}, c: 1}}, {$match: {$or: [{c: 2}, {s: {$gte: 10}}]}}] +metadata: + number of partitions: 1 + scan definitions: + collection: + options: + distribution and paths: + distribution type: Centralized + distribution paths: + indexes: + non multi-key index paths: + collection exists: 1 + CE type: -1 + +-- OUTPUT: +Root [] +| | projections: +| | combinedProjection_0 +| RefBlock: +| Variable [combinedProjection_0] +Filter [] +| EvalFilter [] +| | Variable [combinedProjection_0] +| PathComposeA [] +| | PathGet [c] +| | PathTraverse [1] +| | PathCompare [Eq] +| | Const [2] +| PathGet [s] +| PathTraverse [1] +| PathComposeM [] +| | PathCompare [Lt] +| | Const [""] +| PathCompare [Gte] +| Const [10] +Evaluation [] +| BindBlock: +| [combinedProjection_0] +| EvalPath [] +| | Variable [scan_0] +| PathComposeM [] +| | PathDefault [] +| | Const [{}] +| PathComposeM [] +| | PathField [s] +| | PathConstant [] +| | Variable [projGetPath_0] +| PathKeep [_id, c, s] +Evaluation [] +| BindBlock: +| [projGetPath_0] +| BinaryOp [Add] +| | EvalPath [] +| | | Variable [scan_0] +| | PathGet [b] +| | PathIdentity [] +| EvalPath [] +| | Variable [scan_0] +| PathGet [a] +| PathIdentity [] +Scan [collection] + BindBlock: + [scan_0] + Source [] + + +==== VARIATION: $project with deeply nested path ==== +-- INPUTS: +pipeline: [{$project: {'a1.b.c':1, 'a.b.c.d.e':'str'}}] +metadata: + number of partitions: 1 + scan definitions: + collection: + options: + distribution and paths: + distribution type: Centralized + distribution paths: + indexes: + non multi-key index paths: + collection exists: 1 + CE type: -1 + +-- OUTPUT: +Root [] +| | projections: +| | combinedProjection_0 +| RefBlock: +| Variable [combinedProjection_0] +Evaluation [] +| BindBlock: +| [combinedProjection_0] +| EvalPath [] +| | Variable [scan_0] +| PathComposeM [] +| | PathField [a1] +| | PathTraverse [inf] +| | PathComposeM [] +| | | PathField [b] +| | | PathTraverse [inf] +| | | PathComposeM [] +| | | | PathKeep [c] +| | | PathObj [] +| | PathComposeM [] +| | | PathKeep [b] +| | PathObj [] +| PathComposeM [] +| | PathField [a] +| | PathTraverse [inf] +| | PathComposeM [] +| | | PathField [b] +| | | PathTraverse [inf] +| | | PathComposeM [] +| | | | PathField [c] +| | | | PathTraverse [inf] +| | | | PathComposeM [] +| | | | | PathField [d] +| | | | | PathTraverse [inf] +| | | | | PathComposeM [] +| | | | | | PathDefault [] +| | | | | | Const [{}] +| | | | | PathComposeM [] +| | | | | | PathField [e] +| | | | | | PathConstant [] +| | | | | | Variable [projGetPath_0] +| | | | | PathKeep [e] +| | | | PathKeep [d] +| | | PathKeep [c] +| | PathKeep [b] +| PathKeep [_id, a, a1] +Evaluation [] +| BindBlock: +| [projGetPath_0] +| Const ["str"] +Scan [collection] + BindBlock: + [scan_0] + Source [] + + +==== VARIATION: basic $group ==== +-- INPUTS: +pipeline: [{$group: {_id: '$a.b', s: {$sum: {$multiply: ['$b', '$c']}}}}] +metadata: + number of partitions: 1 + scan definitions: + collection: + options: + distribution and paths: + distribution type: Centralized + distribution paths: + indexes: + non multi-key index paths: + collection exists: 1 + CE type: -1 + +-- OUTPUT: +Root [] +| | projections: +| | agg_project_0 +| RefBlock: +| Variable [agg_project_0] +Evaluation [] +| BindBlock: +| [agg_project_0] +| EvalPath [] +| | Const [{}] +| PathComposeM [] +| | PathField [s] +| | PathConstant [] +| | Variable [s_agg_0] +| PathField [_id] +| PathConstant [] +| Variable [groupByProj_0] +GroupBy [] +| | groupings: +| | RefBlock: +| | Variable [groupByProj_0] +| aggregations: +| [s_agg_0] +| FunctionCall [$sum] +| Variable [groupByInputProj_0] +Evaluation [] +| BindBlock: +| [groupByInputProj_0] +| BinaryOp [Mult] +| | EvalPath [] +| | | Variable [scan_0] +| | PathGet [c] +| | PathIdentity [] +| EvalPath [] +| | Variable [scan_0] +| PathGet [b] +| PathIdentity [] +Evaluation [] +| BindBlock: +| [groupByProj_0] +| EvalPath [] +| | Variable [scan_0] +| PathGet [a] +| PathTraverse [inf] +| PathGet [b] +| PathIdentity [] +Scan [collection] + BindBlock: + [scan_0] + Source [] + + +==== VARIATION: $group local global ==== +-- INPUTS: +pipeline: [{$group: {_id: '$a', c: {$sum: '$b'}}}] +metadata: + number of partitions: 1 + scan definitions: + collection: + options: + distribution and paths: + distribution type: Centralized + distribution paths: + indexes: + non multi-key index paths: + collection exists: 1 + CE type: -1 + +-- OUTPUT: +Root [] +| | projections: +| | agg_project_0 +| RefBlock: +| Variable [agg_project_0] +Evaluation [] +| BindBlock: +| [agg_project_0] +| EvalPath [] +| | Const [{}] +| PathComposeM [] +| | PathField [c] +| | PathConstant [] +| | Variable [c_agg_0] +| PathField [_id] +| PathConstant [] +| Variable [groupByProj_0] +GroupBy [] +| | groupings: +| | RefBlock: +| | Variable [groupByProj_0] +| aggregations: +| [c_agg_0] +| FunctionCall [$sum] +| Variable [groupByInputProj_0] +Evaluation [] +| BindBlock: +| [groupByInputProj_0] +| EvalPath [] +| | Variable [scan_0] +| PathGet [b] +| PathIdentity [] +Evaluation [] +| BindBlock: +| [groupByProj_0] +| EvalPath [] +| | Variable [scan_0] +| PathGet [a] +| PathIdentity [] +Scan [collection] + BindBlock: + [scan_0] + Source [] + + +==== VARIATION: basic $unwind ==== +-- INPUTS: +pipeline: [{$unwind: {path: '$a.b.c'}}] +metadata: + number of partitions: 1 + scan definitions: + collection: + options: + distribution and paths: + distribution type: Centralized + distribution paths: + indexes: + non multi-key index paths: + collection exists: 1 + CE type: -1 + +-- OUTPUT: +Root [] +| | projections: +| | embedProj_0 +| RefBlock: +| Variable [embedProj_0] +Evaluation [] +| BindBlock: +| [embedProj_0] +| EvalPath [] +| | Variable [scan_0] +| PathField [a] +| PathTraverse [inf] +| PathField [b] +| PathTraverse [inf] +| PathField [c] +| PathConstant [] +| Variable [unwoundProj_0] +Unwind [] +| BindBlock: +| [unwoundPid_0] +| Source [] +| [unwoundProj_0] +| Source [] +Evaluation [] +| BindBlock: +| [unwoundProj_0] +| EvalPath [] +| | Variable [scan_0] +| PathGet [a] +| PathGet [b] +| PathGet [c] +| PathIdentity [] +Scan [collection] + BindBlock: + [scan_0] + Source [] + + +==== VARIATION: complex $unwind ==== +-- INPUTS: +pipeline: [{$unwind: {path: '$a.b.c', includeArrayIndex: 'p1.pid', preserveNullAndEmptyArrays: true}}] +metadata: + number of partitions: 1 + scan definitions: + collection: + options: + distribution and paths: + distribution type: Centralized + distribution paths: + indexes: + non multi-key index paths: + collection exists: 1 + CE type: -1 + +-- OUTPUT: +Root [] +| | projections: +| | embedPidProj_0 +| RefBlock: +| Variable [embedPidProj_0] +Evaluation [] +| BindBlock: +| [embedPidProj_0] +| EvalPath [] +| | Variable [embedProj_0] +| PathField [p1] +| PathField [pid] +| PathConstant [] +| If [] +| | | Const [null] +| | Variable [unwoundPid_0] +| BinaryOp [Gte] +| | Const [0] +| Variable [unwoundPid_0] +Evaluation [] +| BindBlock: +| [embedProj_0] +| EvalPath [] +| | Variable [scan_0] +| PathField [a] +| PathTraverse [inf] +| PathField [b] +| PathTraverse [inf] +| PathField [c] +| PathLambda [] +| LambdaAbstraction [unwoundLambdaVarName_0] +| If [] +| | | Variable [unwoundLambdaVarName_0] +| | Variable [unwoundProj_0] +| BinaryOp [Gte] +| | Const [0] +| Variable [unwoundPid_0] +Unwind [retainNonArrays] +| BindBlock: +| [unwoundPid_0] +| Source [] +| [unwoundProj_0] +| Source [] +Evaluation [] +| BindBlock: +| [unwoundProj_0] +| EvalPath [] +| | Variable [scan_0] +| PathGet [a] +| PathGet [b] +| PathGet [c] +| PathIdentity [] +Scan [collection] + BindBlock: + [scan_0] + Source [] + + +==== VARIATION: $unwind with $group ==== +-- INPUTS: +pipeline: [{$unwind:{path: '$a.b', preserveNullAndEmptyArrays: true}}, {$group:{_id: '$a.b'}}] +metadata: + number of partitions: 1 + scan definitions: + collection: + options: + distribution and paths: + distribution type: Centralized + distribution paths: + indexes: + non multi-key index paths: + collection exists: 1 + CE type: -1 + +-- OUTPUT: +Root [] +| | projections: +| | agg_project_0 +| RefBlock: +| Variable [agg_project_0] +Evaluation [] +| BindBlock: +| [agg_project_0] +| EvalPath [] +| | Const [{}] +| PathField [_id] +| PathConstant [] +| Variable [groupByProj_0] +GroupBy [] +| | groupings: +| | RefBlock: +| | Variable [groupByProj_0] +| aggregations: +Evaluation [] +| BindBlock: +| [groupByProj_0] +| EvalPath [] +| | Variable [embedProj_0] +| PathGet [a] +| PathTraverse [inf] +| PathGet [b] +| PathIdentity [] +Evaluation [] +| BindBlock: +| [embedProj_0] +| EvalPath [] +| | Variable [scan_0] +| PathField [a] +| PathTraverse [inf] +| PathField [b] +| PathLambda [] +| LambdaAbstraction [unwoundLambdaVarName_0] +| If [] +| | | Variable [unwoundLambdaVarName_0] +| | Variable [unwoundProj_0] +| BinaryOp [Gte] +| | Const [0] +| Variable [unwoundPid_0] +Unwind [retainNonArrays] +| BindBlock: +| [unwoundPid_0] +| Source [] +| [unwoundProj_0] +| Source [] +Evaluation [] +| BindBlock: +| [unwoundProj_0] +| EvalPath [] +| | Variable [scan_0] +| PathGet [a] +| PathGet [b] +| PathIdentity [] +Scan [collection] + BindBlock: + [scan_0] + Source [] + + +==== VARIATION: $match with index ==== +-- INPUTS: +pipeline: [{$match: {'a': 10}}] +metadata: + number of partitions: 1 + scan definitions: + collection: + options: + distribution and paths: + distribution type: Centralized + distribution paths: + indexes: + non multi-key index paths: + collection exists: 1 + CE type: -1 + +-- OUTPUT: +Root [] +| | projections: +| | scan_0 +| RefBlock: +| Variable [scan_0] +Filter [] +| EvalFilter [] +| | Variable [scan_0] +| PathGet [a] +| PathTraverse [1] +| PathCompare [Eq] +| Const [10] +Scan [collection] + BindBlock: + [scan_0] + Source [] + + +==== VARIATION: $match sort index ==== +-- INPUTS: +pipeline: [{$match: {'a': 10}}, {$sort: {'a': 1}}] +metadata: + number of partitions: 1 + scan definitions: + collection: + options: + distribution and paths: + distribution type: Centralized + distribution paths: + indexes: + non multi-key index paths: + collection exists: 1 + CE type: -1 + +-- OUTPUT: +Root [] +| | projections: +| | scan_0 +| RefBlock: +| Variable [scan_0] +Collation [] +| | collation: +| | sort_0: Ascending +| RefBlock: +| Variable [sort_0] +Evaluation [] +| BindBlock: +| [sort_0] +| EvalPath [] +| | Variable [scan_0] +| PathGet [a] +| PathIdentity [] +Filter [] +| EvalFilter [] +| | Variable [scan_0] +| PathGet [a] +| PathTraverse [1] +| PathCompare [Eq] +| Const [10] +Scan [collection] + BindBlock: + [scan_0] + Source [] + + +==== VARIATION: $match with range ==== +-- INPUTS: +pipeline: [{$match: {'a': {$gt: 70, $lt: 90}}}] +metadata: + number of partitions: 1 + scan definitions: + collection: + options: + distribution and paths: + distribution type: Centralized + distribution paths: + indexes: + non multi-key index paths: + collection exists: 1 + CE type: -1 + +-- OUTPUT: +Root [] +| | projections: +| | scan_0 +| RefBlock: +| Variable [scan_0] +Filter [] +| EvalFilter [] +| | Variable [scan_0] +| PathGet [a] +| PathTraverse [1] +| PathComposeM [] +| | PathCompare [Lt] +| | Const [""] +| PathCompare [Gt] +| Const [70] +Filter [] +| EvalFilter [] +| | Variable [scan_0] +| PathGet [a] +| PathTraverse [1] +| PathComposeM [] +| | PathCompare [Gte] +| | Const [nan] +| PathCompare [Lt] +| Const [90] +Scan [collection] + BindBlock: + [scan_0] + Source [] + + +==== VARIATION: index on two keys ==== +-- INPUTS: +pipeline: [{$match: {'a': 2, 'b': 2}}] +metadata: + number of partitions: 1 + scan definitions: + collection: + options: + distribution and paths: + distribution type: Centralized + distribution paths: + indexes: + non multi-key index paths: + collection exists: 1 + CE type: -1 + +-- OUTPUT: +Root [] +| | projections: +| | scan_0 +| RefBlock: +| Variable [scan_0] +Filter [] +| EvalFilter [] +| | Variable [scan_0] +| PathGet [a] +| PathTraverse [1] +| PathCompare [Eq] +| Const [2] +Filter [] +| EvalFilter [] +| | Variable [scan_0] +| PathGet [b] +| PathTraverse [1] +| PathCompare [Eq] +| Const [2] +Scan [collection] + BindBlock: + [scan_0] + Source [] + + +==== VARIATION: $group with complex _id ==== +-- INPUTS: +pipeline: [{$group: {_id: {'isin': '$isin', 'year': '$year'}, 'count': {$sum: 1}, 'open': {$first: '$$ROOT'}}}] +metadata: + number of partitions: 1 + scan definitions: + collection: + options: + distribution and paths: + distribution type: Centralized + distribution paths: + indexes: + non multi-key index paths: + collection exists: 1 + CE type: -1 + +-- OUTPUT: +Root [] +| | projections: +| | agg_project_0 +| RefBlock: +| Variable [agg_project_0] +Evaluation [] +| BindBlock: +| [agg_project_0] +| EvalPath [] +| | Const [{}] +| PathComposeM [] +| | PathField [open] +| | PathConstant [] +| | Variable [open_agg_0] +| PathComposeM [] +| | PathField [count] +| | PathConstant [] +| | Variable [count_agg_0] +| PathField [_id] +| PathComposeM [] +| | PathField [year] +| | PathConstant [] +| | Variable [groupByProj_1] +| PathField [isin] +| PathConstant [] +| Variable [groupByProj_0] +GroupBy [] +| | groupings: +| | RefBlock: +| | Variable [groupByProj_0] +| | Variable [groupByProj_1] +| aggregations: +| [count_agg_0] +| FunctionCall [$sum] +| Const [1] +| [open_agg_0] +| FunctionCall [$first] +| Variable [scan_0] +Evaluation [] +| BindBlock: +| [groupByProj_1] +| EvalPath [] +| | Variable [scan_0] +| PathGet [year] +| PathIdentity [] +Evaluation [] +| BindBlock: +| [groupByProj_0] +| EvalPath [] +| | Variable [scan_0] +| PathGet [isin] +| PathIdentity [] +Scan [collection] + BindBlock: + [scan_0] + Source [] + + +==== VARIATION: $project with computed array ==== +-- INPUTS: +pipeline: [{$project: {a: ['$b', '$c']}}] +metadata: + number of partitions: 1 + scan definitions: + collection: + options: + distribution and paths: + distribution type: Centralized + distribution paths: + indexes: + non multi-key index paths: + collection exists: 1 + CE type: -1 + +-- OUTPUT: +Root [] +| | projections: +| | combinedProjection_0 +| RefBlock: +| Variable [combinedProjection_0] +Evaluation [] +| BindBlock: +| [combinedProjection_0] +| EvalPath [] +| | Variable [scan_0] +| PathComposeM [] +| | PathDefault [] +| | Const [{}] +| PathComposeM [] +| | PathField [a] +| | PathConstant [] +| | Variable [projGetPath_0] +| PathKeep [_id, a] +Evaluation [] +| BindBlock: +| [projGetPath_0] +| FunctionCall [newArray] +| | EvalPath [] +| | | Variable [scan_0] +| | PathGet [c] +| | PathIdentity [] +| EvalPath [] +| | Variable [scan_0] +| PathGet [b] +| PathIdentity [] +Scan [collection] + BindBlock: + [scan_0] + Source [] + + +==== VARIATION: union ==== +-- INPUTS: +pipeline: [{$unionWith: 'collB'}, {$match: {_id: 1}}] +metadata: + number of partitions: 1 + scan definitions: + collA: + options: + distribution and paths: + distribution type: Centralized + distribution paths: + indexes: + non multi-key index paths: + collection exists: 1 + CE type: -1 + collB: + options: + distribution and paths: + distribution type: Centralized + distribution paths: + indexes: + non multi-key index paths: + collection exists: 1 + CE type: -1 + +-- OUTPUT: +Root [] +| | projections: +| | scan_0 +| RefBlock: +| Variable [scan_0] +Filter [] +| EvalFilter [] +| | Variable [scan_0] +| PathGet [_id] +| PathTraverse [1] +| PathCompare [Eq] +| Const [1] +Union [] +| | BindBlock: +| | [scan_0] +| | Source [] +| Evaluation [] +| | BindBlock: +| | [scan_0] +| | EvalPath [] +| | | Variable [scan_1] +| | PathIdentity [] +| Scan [collB] +| BindBlock: +| [scan_1] +| Source [] +Scan [collA] + BindBlock: + [scan_0] + Source [] + + +==== VARIATION: $match with $ne ==== +-- INPUTS: +pipeline: [{$match: {'a': {$ne: 2}}}] +metadata: + number of partitions: 1 + scan definitions: + collection: + options: + distribution and paths: + distribution type: Centralized + distribution paths: + indexes: + non multi-key index paths: + collection exists: 1 + CE type: -1 + +-- OUTPUT: +Root [] +| | projections: +| | scan_0 +| RefBlock: +| Variable [scan_0] +Filter [] +| EvalFilter [] +| | Variable [scan_0] +| PathConstant [] +| UnaryOp [Not] +| EvalFilter [] +| | Variable [scan_0] +| PathGet [a] +| PathTraverse [1] +| PathCompare [Eq] +| Const [2] +Scan [collection] + BindBlock: + [scan_0] + Source [] + + |