Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
sql: fix distsql planning issue with optimizer (streaming aggregation)
The distsql planner looks at physical properties of various plan nodes to figure out what orderings it needs to preserve when merging data from multiple nodes. These are passed as required orderings in the exec.Factory, but not for all operators - only those for which it would actually matter. There is a code path related to setting up streaming aggregations which was unaccounted for which looks at the ordering of the input node. To fix this, we now pass required orderings to filters and projections. I looked at all the operators and the rest either: - never produce an ordering as far as the optimizer is concerned (VirtualScan, HashJoin, ScalarGroupBy, SetOp, ProjectSet); or - they pass through the input ordering unchanged (Distinct); or - they cannot be distributed (Limit, Ordinality). Release note (bug fix): Fixed an issue which causes invalid results or an "incorrectly ordered stream" error with streaming aggregations (in some cases).
- Loading branch information