Official repository of Trino, the distributed SQL query engine for big data, formerly known as PrestoSQL (https://trino.io)
10.49k
stars
3.02k
forks
source link
Filter out grouping sets basing on grouping() constraints before execution #23389
Open
thermo911 opened 2 months ago
Problem
Trino performs an aggregation for each grouping set even if particular grouping sets can be removed basing on predicates on
grouping(...)
.Example
Query
is effectively a
(global aggregation is removed).
Currently, Trino produces following plan for such query. Aggregation is performed for each grouping set from
GroupIdNode
.Expected behavior
In example above Trino figures out what grouping sets are actually used and removes other ones from the query plan.