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

Analyzer subquery support FINAL #64133

Open
wants to merge 6 commits into
base: master
Choose a base branch
from

Conversation

kitaisreal
Copy link
Collaborator

@kitaisreal kitaisreal commented May 20, 2024

Changelog category (leave one):

  • New Feature

Changelog entry (a user-readable short description of the changes that goes to CHANGELOG.md):

Analyzer support FINAL for subqueries. Example: SELECT id, value FROM (SELECT id, value FROM test_table WHERE id = 0) FINAL.

@kitaisreal kitaisreal added the can be tested Allows running workflows for external contributors label May 20, 2024
@robot-clickhouse robot-clickhouse added the pr-feature Pull request with new product feature label May 20, 2024
@robot-clickhouse
Copy link
Member

robot-clickhouse commented May 20, 2024

This is an automated comment for commit c684a8f with description of existing statuses. It's updated for the latest CI running

❌ Click here to open a full report in a separate page

Check nameDescriptionStatus
CI runningA meta-check that indicates the running CI. Normally, it's in success or pending state. The failed status indicates some problems with the PR❌ failure
Mergeable CheckChecks if all other necessary checks are successful❌ failure
Stateless testsRuns stateless functional tests for ClickHouse binaries built in various configurations -- release, debug, with sanitizers, etc❌ failure
Successful checks
Check nameDescriptionStatus
A SyncIf it fails, ask a maintainer for help✅ success
ClickHouse build checkBuilds ClickHouse in various configurations for use in further steps. You have to fix the builds that fail. Build logs often has enough information to fix the error, but you might have to reproduce the failure locally. The cmake options can be found in the build log, grepping for cmake. Use these options and follow the general build process✅ success
Docs checkBuilds and tests the documentation✅ success
Fast testNormally this is the first check that is ran for a PR. It builds ClickHouse and runs most of stateless functional tests, omitting some. If it fails, further checks are not started until it is fixed. Look at the report to see which tests fail, then reproduce the failure locally as described here✅ success
Flaky testsChecks if new added or modified tests are flaky by running them repeatedly, in parallel, with more randomization. Functional tests are run 100 times with address sanitizer, and additional randomization of thread scheduling. Integration tests are run up to 10 times. If at least once a new test has failed, or was too long, this check will be red. We don't allow flaky tests, read the doc✅ success
Integration testsThe integration tests report. In parenthesis the package type is given, and in square brackets are the optional part/total tests✅ success
PR CheckThere's no description for the check yet, please add it to tests/ci/ci_config.py:CHECK_DESCRIPTIONS✅ success
Stateful testsRuns stateful functional tests for ClickHouse binaries built in various configurations -- release, debug, with sanitizers, etc✅ success
Style checkRuns a set of checks to keep the code style clean. If some of tests failed, see the related log from the report✅ success
Unit testsRuns the unit tests for different release types✅ success

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.

LGTM

@alexey-milovidov alexey-milovidov self-assigned this May 21, 2024
@alexey-milovidov
Copy link
Member

Check Fast Test.

@alexey-milovidov
Copy link
Member

It should be applied only for tables that support FINAL.

@kitaisreal kitaisreal force-pushed the analyzer-subquery-support-final branch from 45b5bd8 to f094ea9 Compare May 28, 2024 14:52
@kitaisreal kitaisreal force-pushed the analyzer-subquery-support-final branch from d3eea87 to 1ff471f Compare May 30, 2024 09:09
Copy link
Member

@novikd novikd left a comment

Choose a reason for hiding this comment

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

I suppose it's better to implement this feature on resolved query tree. I can store table modifiers in the current scope and apply them when you resolve Join Tree. Such an approach would make more sense.

}
}

QueryTreeNodes extractAllTableReferences(const QueryTreeNodePtr & tree, bool extract_table_function_nodes, bool extract_identifier_nodes)
Copy link
Member

Choose a reason for hiding this comment

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

I think extractAllTableReferences should be used only for resolved query trees. It's better to write a separate function to traverse unresolved trees.

{
auto table_expression_modifiers = table_node ? table_node->getTableExpressionModifiers() : table_function_node->getTableExpressionModifiers();
if (!table_expression_modifiers->isFromParentSubquery())
Copy link
Member

Choose a reason for hiding this comment

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

It will work incorrectly in the case:

SELECT
FROM (SELECT * FROM x FINAL) SAMPLE 0.1

@novikd novikd self-assigned this May 31, 2024
@novikd novikd added the analyzer Issues and pull-requests related to new analyzer label May 31, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
analyzer Issues and pull-requests related to new analyzer can be tested Allows running workflows for external contributors pr-feature Pull request with new product feature
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants