Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
sql: fix the dedup of aggregates during physical planning
During the physical planning of the aggregates, we are performing a de-duplication of aggregate functions in order to not have redundant computations, and we handle the required "projection" via a `PlanToStreamColMap` (this is a separate projection from the one in the post-processing spec). As a result, a stage of aggregator processors might produce less columns than we expected it to because some duplicate functions were removed. Previously, this would result in an incorrectly computed output schema of the aggregators. The issue represented itself because we started relying on the recently added `ResultTypes` field of a processor spec in the vectorized engine, and I'm not sure whether it could result in an error in stable releases (the field is also present on the physical plan). The fix is rather simple - use the projection of the post-processing spec, so I think it'll be worth backporting this even if we don't have a repro of an issue on stable branches. Release note: None
- Loading branch information