Skip to content

SQL: Add rule to prune unused aggregations.#5049

Merged
fjy merged 1 commit intoapache:masterfrom
gianm:sql-better-pruning
Nov 14, 2017
Merged

SQL: Add rule to prune unused aggregations.#5049
fjy merged 1 commit intoapache:masterfrom
gianm:sql-better-pruning

Conversation

@gianm
Copy link
Copy Markdown
Contributor

@gianm gianm commented Nov 6, 2017

Sometimes, unused aggregators can end up sticking around in a plan. For example, two of the three aggregators in this query are unused and can be eliminated:

SELECT
  CASE 'foo'
  WHEN 'bar' THEN SUM(cnt)
  WHEN 'foo' THEN SUM(m1)
  WHEN 'baz' THEN SUM(m2)
  END
FROM foo

This patch does that. And yes, I did see a query like this in the wild.

@fjy fjy merged commit 7722401 into apache:master Nov 14, 2017
@jon-wei jon-wei added this to the 0.12.0 milestone Jan 5, 2018
@gianm gianm deleted the sql-better-pruning branch September 23, 2022 19:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants