-
Type:
Bug
-
Resolution: Unresolved
-
Priority:
Major - P3
-
None
-
Affects Version/s: None
-
Component/s: None
-
Query Optimization
-
None
-
None
-
None
-
None
-
None
-
None
-
None
The dependency graph's canPathBeArray() analysis incorrectly reports that certain paths involved in $lookup (with localField/foreignField syntax) cannot be arrays when using Indexed Nested Loop Join (INLJ) with sorted ascending or descending indexes. This causes the $_internalValidateArrayness validation stage to fail at runtime when it encounters array data on those paths.
Steps to Reproduce
Run the excluded test with the dependency graph validation suite:
resmoke.py run --force-excluded-tests --suites=aggregation_dependency_graph_validation_passthrough lookup_equijoin_semantics_inlj.js
The two runTests() calls that use JoinAlgorithm.INLJ_Asc and JoinAlgorithm.INLJ_Dec fail. The test data includes documents with array values in the local/foreign fields (e.g. a: [null, 1], a: [], a: [1, NaN]), which triggers the validation failure.
Expected Behavior
The dependency graph should correctly report that localField and foreignField paths in $lookup can contain arrays, so the $_internalValidateArrayness stage does not fire a false positive.
Actual Behavior
The $_internalValidateArrayness stage detects that a path reported as "cannot be array" by the dependency graph actually contains an array at runtime, and fails the aggregation.
Notes
- The INLJ_Hashed tests pass because hashed indexes do not support array data, so those test cases only use scalar values and never trigger the validation.
- The miscellaneous INLJ tests at the bottom of the file also pass because they use runTest_SingleForeignRecord directly with data that doesn't expose the bug.
- depends on
-
SERVER-127304 PathArrayness incorrectly marks parent field as non-array when index uses positional path notation
-
- Needs Scheduling
-
- is depended on by
-
SERVER-125083 Introduce a new jstest suite for testing the dependency graph
-
- In Code Review
-