Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Early constant folding. #7497

Merged
merged 1 commit into from Nov 1, 2019
Merged

Conversation

amosbird
Copy link
Collaborator

I hereby agree to the terms of the CLA available at: https://yandex.ru/legal/cla/?lang=en

For changelog. Remove if this is non-significant change.

Category (leave one):

  • Performance Improvement

Short description (up to few sentences):
Run another pass of syntax/expression analysis to get potential optimizations after constant predicates are folded. In preparation of Instant Count()

@amosbird
Copy link
Collaborator Author

Actually we don't need that alias at all, as any references to the original predicate alias (if any) are already dereferenced.

ANALYZE SELECT a
FROM numbers(10)
WHERE (1 = 1) AND (2 = 2) AS a

┌─explain────────────────────────────────────────────────┐
│ SELECT (1 = 1) AND (2 = 2) AS a
FROM numbers(10)
WHERE 1 │
└────────────────────────────────────────────────────────┘

1 rows in set. Elapsed: 0.003 sec.

dbms/src/Interpreters/InterpreterSelectQuery.cpp Outdated Show resolved Hide resolved
dbms/src/Interpreters/InterpreterSelectQuery.cpp Outdated Show resolved Hide resolved
@4ertus2 4ertus2 self-requested a review October 29, 2019 14:51
@@ -11,15 +11,15 @@ SELECT \n a, \n b\nFROM \n(\n SELECT \n 1 AS a, \n 1 AS b
SELECT \n a, \n b\nFROM \n(\n SELECT 1 AS a\n)\nANY FULL OUTER JOIN \n(\n SELECT \n 1 AS a, \n 1 AS b\n) USING (a)\nWHERE b = 0
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd like if you will also add a new test for this PR.

Copy link
Member

@alexey-milovidov alexey-milovidov left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Difficult to read - needs careful explanation in comments.

@amosbird amosbird force-pushed the countopt branch 4 times, most recently from 7d3047e to 0bee1a6 Compare October 31, 2019 13:13
Copy link
Member

@alexey-milovidov alexey-milovidov left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok, but we also need a performance test.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
pr-improvement Pull request with some product improvements
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants