mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-25 17:12:03 +00:00
Merge pull request #61052 from ClickHouse/fix-usan-parallel-replicas-prewhere
Fix: parallel replicas with PREWHERE (ubsan)
This commit is contained in:
commit
97248d0d5b
@ -2111,8 +2111,7 @@ void InterpreterSelectQuery::applyFiltersToPrewhereInAnalysis(ExpressionAnalysis
|
||||
if (does_storage_support_prewhere && shouldMoveToPrewhere())
|
||||
{
|
||||
/// Execute row level filter in prewhere as a part of "move to prewhere" optimization.
|
||||
analysis.prewhere_info
|
||||
= std::make_shared<PrewhereInfo>(std::move(analysis.filter_info->actions), std::move(analysis.filter_info->column_name));
|
||||
analysis.prewhere_info = std::make_shared<PrewhereInfo>(analysis.filter_info->actions, analysis.filter_info->column_name);
|
||||
analysis.prewhere_info->prewhere_actions->projectInput(false);
|
||||
analysis.prewhere_info->remove_prewhere_column = analysis.filter_info->do_remove_column;
|
||||
analysis.prewhere_info->need_filter = true;
|
||||
@ -2122,8 +2121,8 @@ void InterpreterSelectQuery::applyFiltersToPrewhereInAnalysis(ExpressionAnalysis
|
||||
else
|
||||
{
|
||||
/// Add row level security actions to prewhere.
|
||||
analysis.prewhere_info->row_level_filter = std::move(analysis.filter_info->actions);
|
||||
analysis.prewhere_info->row_level_column_name = std::move(analysis.filter_info->column_name);
|
||||
analysis.prewhere_info->row_level_filter = analysis.filter_info->actions;
|
||||
analysis.prewhere_info->row_level_column_name = analysis.filter_info->column_name;
|
||||
analysis.prewhere_info->row_level_filter->projectInput(false);
|
||||
analysis.filter_info = nullptr;
|
||||
}
|
||||
|
@ -0,0 +1,31 @@
|
||||
DROP POLICY IF EXISTS url_na_log_policy0 ON url_na_log;
|
||||
DROP TABLE IF EXISTS url_na_log;
|
||||
|
||||
CREATE TABLE url_na_log
|
||||
(
|
||||
`SiteId` UInt32,
|
||||
`DateVisit` Date
|
||||
)
|
||||
ENGINE = MergeTree
|
||||
PRIMARY KEY SiteId
|
||||
ORDER BY (SiteId, DateVisit)
|
||||
SETTINGS index_granularity = 1000, min_bytes_for_wide_part = 0;
|
||||
|
||||
CREATE ROW POLICY url_na_log_policy0 ON url_na_log FOR SELECT USING (DateVisit < '2022-08-11') OR (DateVisit > '2022-08-19') TO default;
|
||||
|
||||
INSERT INTO url_na_log
|
||||
SETTINGS max_insert_block_size = 200000
|
||||
SELECT
|
||||
209,
|
||||
CAST('2022-08-09', 'Date') + toIntervalDay(intDiv(number, 10000))
|
||||
FROM numbers(130000)
|
||||
SETTINGS max_insert_block_size = 200000;
|
||||
|
||||
EXPLAIN ESTIMATE
|
||||
SELECT count()
|
||||
FROM url_na_log
|
||||
PREWHERE (DateVisit >= toFixedString('2022-08-10', 10)) AND (DateVisit <= '2022-08-20')
|
||||
SETTINGS max_block_size = 1048576, max_threads = 1, allow_experimental_parallel_reading_from_replicas = 1, parallel_replicas_for_non_replicated_merge_tree = 1, cluster_for_parallel_replicas = 'test_cluster_one_shard_three_replicas_localhost', max_parallel_replicas = 3, parallel_replicas_min_number_of_rows_per_replica=10000;
|
||||
|
||||
DROP POLICY url_na_log_policy0 ON url_na_log;
|
||||
DROP TABLE url_na_log;
|
Loading…
Reference in New Issue
Block a user