We implement cartesian permutations within each Sorted step: whenever an intersection is found, we check if we need to produce cartesian answers in any of the variables attached to the intersection variable. If so, we set up a CartesianIterator, which finishes generating all answer within that intersection, before returning to the intersection-based step execution.
We also add Display traits for VariableValue and all inner Concept types.
Algorithm
This applies for a Step that utilises N-way intersection/join over Sorted iterators.
Whenever an intersection on the intersection variable is found, we advance all participating Sorted iterators.
If any of the participating iterators has more answers that have the same intersection variable value, we create a CartesianIterator
The CartesianIterator extracts all iterators that are going to contribute to the Cartesian Product (ie. any that still have the same intersection variable value after being moved forward)
We compute next CartesianIterator answers long as they exist within this intersection. The cartesian iterator does a simple backtrack + reopen iterators in a fixed order to generate answers within the intersection variable value.
We write CartesianIterator answers into the output batch until there are no more, then we advance the intersection point and search for the next intersection.
Note: because we don't have seek implemented yet, the "reopen iterators at intersection variable value" does a naiive reopen + advance until we find the intersection variable value.
This algorithm is dependent on the storage iterators providing a deterministic ordering within each intersection variable value
Usage and product changes
We implement cartesian permutations within each Sorted step: whenever an intersection is found, we check if we need to produce cartesian answers in any of the variables attached to the intersection variable. If so, we set up a CartesianIterator, which finishes generating all answer within that intersection, before returning to the intersection-based step execution.
We also add
Display
traits forVariableValue
and all inner Concept types.Algorithm
This applies for a Step that utilises N-way intersection/join over Sorted iterators.
Note: because we don't have
seek
implemented yet, the "reopen iterators at intersection variable value" does a naiive reopen + advance until we find the intersection variable value.This algorithm is dependent on the storage iterators providing a deterministic ordering within each intersection variable value