-
Notifications
You must be signed in to change notification settings - Fork 1
Description
Hi @glyn,
I've been trying to get a simulation of JSONPath nondeterminism to produce results matching yours and I'm getting hung up on a possible conflict between two examples.
Specifically, given the explosive example, section section 2.5.2.3 says "{"k": 6}
must appear before 4
..". Suggesting that all elements from [{'j': 4}, {'k': 6}]
must be visited before descending into {'j': 4}
and {'k': 6}
. I also note that this rule precludes the use of a depth-first, pre-order traversal of the node tree, as that would have 4
appearing before {"k": 6}
.
A tree view of the explosive example, for reference:
{'a': [5, 3, [{'j': 4}, {'k': 6}]], 'o': {'j': 1, 'k': 2}}
├── [5, 3, [{'j': 4}, {'k': 6}]]
│ ├── 5
│ ├── 3
│ └── [{'j': 4}, {'k': 6}]
│ ├── {'j': 4}
│ │ └── 4
│ └── {'k': 6}
│ └── 6
└── {'j': 1, 'k': 2}
├── 1
└── 2
If I apply the same approach to your "interesting example", that is, always visiting array elements before their children, I only get one ordering (before applying the wildcard selector), which does not match your results or my previous attempts at simulating nondeterminism.
[[[1]], [2]], [[1]], [2], [1], 1, 2
A tree view of the interesting example, for reference:
[[[1]], [2]]
├── [[1]]
│ └── [1]
│ └── 1
└── [2]
└── 2
This has been driving me nuts since your CTS pull request last week. I am able to change the simulation to match one example or the other, but never both.