There are circumstances where resolve should return an empty result. However, the size of the returned array can be incorrect. There are two main circumstances:
First, if the supplied input is empty, resolve will always return a ×ばつ0
- Expected result: An empty array of the same size
Second, if the supplied input is not empty but the path yields no results, resolve will always return either a:
- ×ばつ0 if there is at least one
DotSet and DotGlob where the N is the length of the DotSet most closest to but preceding the first DotGlob
- ×ばつ1 otherwise
- Expected result: An empty array where the only zero dimensions should be those corresponding to segments with no dot matches
Both circumstances can violate the contract where repeated application of resolve should not effect result if all or all but the first use the default BundlingAlgorithm="shrink".
data.A = struct(X=1, Y=2);
mp = mpath.Pointer("/A/*/*");
r1 = mp.resolve(data);
r2 = r1.resolve(data);
size(r1) % [0 1]
size(r2) % [0 0]
In this example, the size of r1 is expected to be ×ばつ0, and the size of r2 is expected to match the size of r1.
Additional examples, each expected ×ばつ0:
mpath.resolve(data, "/A/*/*") % ×ばつ1
mpath.resolve(data, "/A/{X,Y}/*") % ×ばつ0
mpath.resolve(data, "/A/*/{X,Y}") % ×ばつ1
mpath.resolve(data, "/A/{X,Y}/{X,Y}") % ×ばつ1
This issue report may involve two related bugs
- Size returned by
resolve should be zero along dimensions corresponding to segments failing to produce matches
- Size returned by
resolve should retain the original size if empty
In the current implementation, reshapeResolvedResult specially treats all-null data-derived matcher results via emptyAllNullDataMatcherResult. That helper does not run the normal dimension assignment logic and currently only special-cases the first DotGlob and a preceding DotSet, so it cannot express general empty shape semantics.
There are circumstances where `resolve` should return an empty result. However, the size of the returned array can be incorrect. There are two main circumstances:
First, if the supplied input is empty, `resolve` will always return a ×ばつ0
- Expected result: An empty array of the same size
Second, if the supplied input is not empty but the path yields no results, `resolve` will always return either a:
- ×ばつ0 if there is at least one `DotSet` and `DotGlob` where the N is the length of the `DotSet` most closest to but preceding the first `DotGlob`
- ×ばつ1 otherwise
- Expected result: An empty array where the only zero dimensions should be those corresponding to segments with no dot matches
Both circumstances can violate the contract where repeated application of `resolve` should not effect result if all or all but the first use the default `BundlingAlgorithm="shrink"`.
```matlab
data.A = struct(X=1, Y=2);
mp = mpath.Pointer("/A/*/*");
r1 = mp.resolve(data);
r2 = r1.resolve(data);
size(r1) % [0 1]
size(r2) % [0 0]
```
In this example, the size of `r1` is expected to be ×ばつ0, and the size of `r2` is expected to match the size of `r1`.
Additional examples, each expected ×ばつ0:
```matlab
mpath.resolve(data, "/A/*/*") % ×ばつ1
mpath.resolve(data, "/A/{X,Y}/*") % ×ばつ0
mpath.resolve(data, "/A/*/{X,Y}") % ×ばつ1
mpath.resolve(data, "/A/{X,Y}/{X,Y}") % ×ばつ1
```
This issue report may involve two related bugs
- Size returned by `resolve` should be zero along dimensions corresponding to segments failing to produce matches
- Size returned by `resolve` should retain the original size if empty
---
In the current implementation, `reshapeResolvedResult` specially treats all-null data-derived matcher results via `emptyAllNullDataMatcherResult`. That helper does not run the normal dimension assignment logic and currently only special-cases the first `DotGlob` and a preceding `DotSet`, so it cannot express general empty shape semantics.