mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-10 09:32:06 +00:00
Merge pull request #54449 from azat/parts-prune-indexHint
Fix filtering parts with indexHint for non analyzer
This commit is contained in:
commit
d555fdffa5
@ -1346,7 +1346,10 @@ static void buildIndexes(
|
||||
}
|
||||
|
||||
/// TODO Support row_policy_filter and additional_filters
|
||||
indexes->part_values = MergeTreeDataSelectExecutor::filterPartsByVirtualColumns(data, parts, filter_actions_dag, context);
|
||||
if (settings.allow_experimental_analyzer)
|
||||
indexes->part_values = MergeTreeDataSelectExecutor::filterPartsByVirtualColumns(data, parts, filter_actions_dag, context);
|
||||
else
|
||||
indexes->part_values = MergeTreeDataSelectExecutor::filterPartsByVirtualColumns(data, parts, query_info.query, context);
|
||||
|
||||
indexes->use_skip_indexes = settings.use_skip_indexes;
|
||||
bool final = query_info.isFinal();
|
||||
|
@ -815,6 +815,9 @@ std::optional<std::unordered_set<String>> MergeTreeDataSelectExecutor::filterPar
|
||||
ASTPtr expression_ast;
|
||||
auto virtual_columns_block = data.getBlockWithVirtualPartColumns(parts, true /* one_part */);
|
||||
|
||||
if (virtual_columns_block.rows() == 0)
|
||||
return {};
|
||||
|
||||
// Generate valid expressions for filtering
|
||||
VirtualColumnUtils::prepareFilterBlockWithQuery(query, context, virtual_columns_block, expression_ast);
|
||||
|
||||
|
@ -54,6 +54,7 @@
|
||||
01710_projection_additional_filters
|
||||
01721_join_implicit_cast_long
|
||||
01739_index_hint
|
||||
02880_indexHint__partition_id
|
||||
01747_join_view_filter_dictionary
|
||||
01748_partition_id_pruning
|
||||
01756_optimize_skip_unused_shards_rewrite_in
|
||||
|
@ -0,0 +1,9 @@
|
||||
-- { echoOn }
|
||||
select * from data prewhere indexHint(_partition_id = '1');
|
||||
1
|
||||
select count() from data prewhere indexHint(_partition_id = '1');
|
||||
1
|
||||
select * from data where indexHint(_partition_id = '1');
|
||||
1
|
||||
select count() from data where indexHint(_partition_id = '1');
|
||||
1
|
@ -0,0 +1,9 @@
|
||||
drop table if exists data;
|
||||
create table data (part Int) engine=MergeTree() order by tuple() partition by part;
|
||||
insert into data values (1)(2);
|
||||
|
||||
-- { echoOn }
|
||||
select * from data prewhere indexHint(_partition_id = '1');
|
||||
select count() from data prewhere indexHint(_partition_id = '1');
|
||||
select * from data where indexHint(_partition_id = '1');
|
||||
select count() from data where indexHint(_partition_id = '1');
|
Loading…
Reference in New Issue
Block a user