-
Notifications
You must be signed in to change notification settings - Fork 103
Description
TL;DR
When using complete {rel(br);}; the result set of an iteration is different than the input set of the next iteration.
Problem Description
The following query is an attempt to find circular relation references in an area.:
[out:csv(::count)];
rel (area:3606195356);
out count;
complete {
rel(br);
};
out count;
Note: The out count lines are used to demonstrate the problem.
The final result of contains 21227 relations, more that the initial 20859 relations contained in the area:
@count
20859
21227
A supposedly-equivalent "loop unrolling" query is:
[out:csv(::count)];
rel (area:3606195356);
out count;
rel(br);
out count;
rel(br);
out count;
rel(br);
out count;
rel(br);
out count;
rel(br);
out count;
rel(br);
out count;
The final result of that query includes just 6 relations:
@count
20859
389
9
8
6
6
Additional Analysis
The output set of a complete iteration is different that the input set for the next iteration, as can be seen in this query:
[out:csv(::count)];
rel (area:3606195356);
out count;
complete {
out count;
rel(br);
out count;
};
out count;
Given the output of the "loop unrolling" query, the expected output should show that the output set size of each command is equal to the input set of the next command:
@count
20859
20859
389
389
9
9
6
6
6
6
However, the actual output is:
@count
20859
20859
389
21227
389
21227
- The input set for the first iteration has 21227 elements. Same as the output set of the previous statement.
- The output set of the first iteration has 389 elements. Yet, the input set for the second iteration has 21227 elements
- The output set of the second iteration has 389 elements. Yet, the output set for the
completestatement has 21227 elements