Skip to content

Analyzer: support aliases and distributed JOINs in StorageMerge#50894

Merged
novikd merged 24 commits intomasterfrom
storage-merge-aliases-analyzer
Feb 8, 2024
Merged

Analyzer: support aliases and distributed JOINs in StorageMerge#50894
novikd merged 24 commits intomasterfrom
storage-merge-aliases-analyzer

Conversation

@novikd
Copy link
Copy Markdown
Member

@novikd novikd commented Jun 12, 2023

Changelog category (leave one):

  • Not for changelog (changelog entry is not required)

@robot-ch-test-poll2 robot-ch-test-poll2 added the pr-not-for-changelog This PR should not be mentioned in the changelog label Jun 12, 2023
@robot-ch-test-poll2
Copy link
Copy Markdown
Contributor

robot-ch-test-poll2 commented Jun 12, 2023

This is an automated comment for commit 813020a 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
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
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
Check nameDescriptionStatus
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❌ failure
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
Stateful testsRuns stateful functional tests for ClickHouse binaries built in various configurations -- release, debug, with sanitizers, etc❌ failure
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
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❌ failure

@novikd novikd changed the title Analyzer: support aliases in StorageMerge Analyzer: support aliases and distributed JOINs in StorageMerge Jun 21, 2023
@novikd novikd marked this pull request as ready for review June 22, 2023 16:43
@azat
Copy link
Copy Markdown
Member

azat commented Jul 28, 2023

@novikd actually the problem with filtering by _table did not fixed in this PR (5611b2f)

Here is the modified test (tests/queries/0_stateless/02840_merge__table_or_filter.sql.j2) that will show the problem.
Maybe you will be interested.

drop table if exists m;
drop view if exists v1;
drop view if exists v2;
drop table if exists d1;
drop table if exists d2;

create table d1 (key Int, value Int) engine=MergeTree() order by value;
create table d2 (key Int, value Int) engine=MergeTree() order by value;

system stop merges d1;
system stop merges d2;

insert into d1 values (1, 10);
insert into d1 values (2, 20);

insert into d2 values (1, 10);
insert into d2 values (2, 20);

create view v1 as select * from d1;
create view v2 as select * from d2;

create table m as v1 engine=Merge(currentDatabase(), '^(v1|v2)$');

-- avoid reorder
set max_threads=1;
-- { echoOn }
{% for settings in [
    'allow_experimental_analyzer=0, convert_query_to_cnf=0',
    'allow_experimental_analyzer=0, convert_query_to_cnf=1',
    'allow_experimental_analyzer=1, convert_query_to_cnf=0',
    'allow_experimental_analyzer=1, convert_query_to_cnf=1'
] %}
select _table, key from m where (value = 10 and _table = 'v1') or (value = 20 and _table = 'v1') settings max_rows_to_read = 2, {{ settings }};
select _table, key from m where (value = 10 and _table = 'v1') or (value = 20 and _table = 'v2') settings max_rows_to_read = 2, {{ settings }};
select _table, key from m where (value = 10 and _table = 'v1') or (value = 20 and _table = 'v3') settings max_rows_to_read = 1, {{ settings }};
select _table, key from m where (value = 10 and _table = 'v3') or (value = 20 and _table = 'v3') settings max_rows_to_read = 1, {{ settings }};
{% endfor %}

The problem actually is still the same, the block for analyzing contains _table, while the expression is m._table.
Funny enough that merge() function does work (00578_merge_table_and_table_virtual_column), because it does not have table name.

@novikd novikd added the analyzer Issues and pull-requests related to new analyzer label Jan 8, 2024
@novikd novikd merged commit b8f74b5 into master Feb 8, 2024
@novikd novikd deleted the storage-merge-aliases-analyzer branch February 8, 2024 10:22
novikd added a commit that referenced this pull request Feb 9, 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 pr-not-for-changelog This PR should not be mentioned in the changelog

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants