Commit c48b87a
[bugfix] Preceding/following axes miss nodes when predicates add context tracking
Closes #4109.
When a context-dependent predicate like [exists(.)] is applied to the
input expression of a FLWOR for clause or simple map operator, the self
axis evaluation inside the predicate adds context tracking entries to
each NodeProxy. These context entries then leak into the cached result
nodes of subsequent selectPreceding/selectFollowing calls via
copyContext(), causing a false-positive match in the context ID
deduplication check. This makes the axis skip valid result nodes after
the first match per group.
The fix adds a NO_CONTEXT_ID guard to the context deduplication check
in both selectFollowing and selectPreceding of NewArrayNodeSet. When
contextId is NO_CONTEXT_ID, the step is not inside a predicate context
tracking scope, so the deduplication check should not be applied.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>1 parent acde823 commit c48b87a
2 files changed
Lines changed: 40 additions & 0 deletions
File tree
- exist-core/src
- main/java/org/exist/dom/persistent
- test/xquery
Lines changed: 2 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
792 | 792 | | |
793 | 793 | | |
794 | 794 | | |
| 795 | + | |
795 | 796 | | |
796 | 797 | | |
797 | 798 | | |
| |||
846 | 847 | | |
847 | 848 | | |
848 | 849 | | |
| 850 | + | |
849 | 851 | | |
850 | 852 | | |
851 | 853 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
102 | 102 | | |
103 | 103 | | |
104 | 104 | | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
105 | 124 | | |
106 | 125 | | |
107 | 126 | | |
| |||
161 | 180 | | |
162 | 181 | | |
163 | 182 | | |
| 183 | + | |
| 184 | + | |
| 185 | + | |
| 186 | + | |
| 187 | + | |
| 188 | + | |
| 189 | + | |
| 190 | + | |
| 191 | + | |
| 192 | + | |
| 193 | + | |
| 194 | + | |
| 195 | + | |
| 196 | + | |
| 197 | + | |
| 198 | + | |
| 199 | + | |
| 200 | + | |
| 201 | + | |
164 | 202 | | |
165 | 203 | | |
166 | 204 | | |
| |||
0 commit comments