Skip to content

Refactor parameterized view & add support for new analyzer#54211

Merged
novikd merged 22 commits intomasterfrom
Support_parameterized_view_with_analyzer
Feb 16, 2024
Merged

Refactor parameterized view & add support for new analyzer#54211
novikd merged 22 commits intomasterfrom
Support_parameterized_view_with_analyzer

Conversation

@SmitaRKulkarni
Copy link
Copy Markdown
Member

@SmitaRKulkarni SmitaRKulkarni commented Sep 2, 2023

Changelog category (leave one):

  • Improvement

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

Added support for parameterized view with analyzer to not analyze create parameterized view.
Refactor existing parameterized view logic to not analyze create parameterized view.

@SmitaRKulkarni SmitaRKulkarni marked this pull request as draft September 2, 2023 19:59
@robot-ch-test-poll robot-ch-test-poll added the pr-improvement Pull request with some product improvements label Sep 2, 2023
@robot-ch-test-poll
Copy link
Copy Markdown
Contributor

robot-ch-test-poll commented Sep 2, 2023

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

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

Successful checks
Check nameDescriptionStatus
A SyncThere's no description for the check yet, please add it to tests/ci/ci_config.py:CHECK_DESCRIPTIONS✅ success
AST fuzzerRuns randomly generated queries to catch program errors. The build type is optionally given in parenthesis. If it fails, ask a maintainer for help✅ success
ClickBenchRuns [ClickBench](https://github.com/ClickHouse/ClickBench/) with instant-attach table✅ 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
Compatibility checkChecks that clickhouse binary runs on distributions with old libc versions. If it fails, ask a maintainer for help✅ success
Docker keeper imageThe check to build and optionally push the mentioned image to docker hub✅ success
Docker server imageThe check to build and optionally push the mentioned image to docker hub✅ 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. Integrational 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
Install packagesChecks that the built packages are installable in a clear environment✅ success
Integration testsThe integration tests report. In parenthesis the package type is given, and in square brackets are the optional part/total tests✅ success
Mergeable CheckChecks if all other necessary checks are successful✅ success
Performance ComparisonMeasure changes in query performance. The performance test report is described in detail here. In square brackets are the optional part/total tests✅ success
SQLTestThere's no description for the check yet, please add it to tests/ci/ci_config.py:CHECK_DESCRIPTIONS✅ success
SQLancerFuzzing tests that detect logical bugs with SQLancer tool✅ success
SqllogicRun clickhouse on the sqllogic test set against sqlite and checks that all statements are passed✅ 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
Upgrade checkRuns stress tests on server version from last release and then tries to upgrade it to the version from the PR. It checks if the new server can successfully startup without any errors, crashes or sanitizer asserts✅ success
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⏳ pending
Stateless testsRuns stateless functional tests for ClickHouse binaries built in various configurations -- release, debug, with sanitizers, etc❌ failure
Stress testRuns stateless functional tests concurrently from several clients to detect concurrency-related errors❌ failure

@SmitaRKulkarni SmitaRKulkarni changed the title Support parameterized view with analyzer Refactor parameterized view & add support for new analyzer Nov 21, 2023
@SmitaRKulkarni SmitaRKulkarni marked this pull request as ready for review January 17, 2024 09:11
Comment on lines +115 to +117
if (!is_parameterized_view_)
{
if (!query.isParameterizedView())
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

This looks a bit strange, shouldn't we expect that is_parametrized_view <=> query.isParametrizedView()?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

isParametrizedView() is only for CREATE queries, not SELECT. But I get your point, the names are confusing. Will update

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Added comment, Hope this clarifies

if (table_function_node->getOriginalAST()->as<ASTFunction>()->is_compound_name)
{
std::vector<std::string> parts;
splitInto<'.'>(parts, table_function_node->getOriginalAST()->as<ASTFunction>()->name);
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

what if table name or database name contains dots?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

This is how we separated the names here as well (https://github.com/ClickHouse/ClickHouse/blob/master/src/Interpreters/Context.cpp#L1718) , so we dont support if table name had '.'.
Is it supported for normal table creation with '.' ?

}

void TableFunctionNode::resolve(StoragePtr storage_value, ContextPtr context)
{
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

But now table_function is not assigned, so method isResolved will return false, even though resolve is called. Seems this will lead to incorrect behaviour? Why cannot we use resolve from void resolve(TableFunctionPtr table_function_value, StoragePtr storage_value, ContextPtr context, std::vector<size_t> unresolved_arguments_indexes_);?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

For parameteriezed view, there is no TableFunctionPtr. I will update isResolved to only consider Storage. Please let me know if you have any suggestions

@novikd novikd self-assigned this Feb 14, 2024
@novikd novikd added the analyzer Issues and pull-requests related to new analyzer label Feb 14, 2024
@novikd
Copy link
Copy Markdown
Member

novikd commented Feb 15, 2024

@SmitaRKulkarni @kssenii The implementation of parametrized views in the new analyzer was wrong. I've rewritten it almost completely. Now it's okay. Please, review it and let's merge if tests pass.

@novikd novikd merged commit a3c34a7 into master Feb 16, 2024
@novikd novikd deleted the Support_parameterized_view_with_analyzer branch February 16, 2024 15:13
@tavplubix tavplubix added the pr-must-backport Pull request should be backported intentionally. Use this label with great care! label Jul 17, 2024
robot-clickhouse added a commit that referenced this pull request Jul 23, 2024
@robot-clickhouse robot-clickhouse added the pr-backports-created Backport PRs are successfully created, it won't be processed by CI script anymore label Jul 23, 2024
kssenii added a commit that referenced this pull request Jul 24, 2024
Backport #54211 to 23.8: Refactor parameterized view & add support for new analyzer
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 pr-backports-created Backport PRs are successfully created, it won't be processed by CI script anymore pr-improvement Pull request with some product improvements pr-must-backport Pull request should be backported intentionally. Use this label with great care!

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants