Fix some cases where secondary index was not applied with analyzer.#78485
Fix some cases where secondary index was not applied with analyzer.#78485KochetovNicolai merged 23 commits intomasterfrom
Conversation
|
|
||
| INSERT INTO t SELECT toString(number), number, toString(number) from numbers(65536); | ||
|
|
||
| explain indexes=1 select tenant,recordTimestamp from t where colAlias like '%abcd%' settings enable_analyzer=1; |
There was a problem hiding this comment.
(1) should we add check w/o analyzer?
(2) also, it's better to output only part of explain related to indices
|
|
||
| --- #69373 | ||
|
|
||
| CREATE TABLE tab_v1 |
There was a problem hiding this comment.
drop table if exists ...
drop table ...
It's useful for running tests locally with default database
| explain indexes=1 select tenant,recordTimestamp from t where colAlias like '%abcd%' settings enable_analyzer=1; | ||
|
|
||
|
|
||
| --- #69373 |
There was a problem hiding this comment.
| --- #69373 | |
| -- #69373 | |
| select 'index is applied to view'; |
| @@ -0,0 +1,45 @@ | |||
| -- Tags: no-random-merge-tree-settings, no-random-settings, no-parallel-replicas | |||
|
|
|||
| --- #65607 | |||
There was a problem hiding this comment.
| --- #65607 | |
| -- #65607 | |
| select 'index is applied while using column alias'; |
| /// Construct key condition from ActionsDAG nodes | ||
| KeyCondition( | ||
| const ActionsDAG * filter_dag, | ||
| const ActionsDAGWithInversionPushDown & filter_dag, |
There was a problem hiding this comment.
Actually, we can construct ActionsDAGWithInversionPushDown inside KeyCondition constructor. context is already passed into KeyCondition as second parameter, just need to pass const ActionsDAG::Node * predicate_ as first parameter instead of const ActionsDAG * filter_dag. This way, we don't need to construct ActionsDAGWithInversionPushDown outside KeyCondition first.
There was a problem hiding this comment.
The whole idea of adding the ActionsDAGWithInversionPushDown structure is to allow creating it outside of KeyCondition and make it reusable. We already did the same kind of work for PK and partition key, and now for secondary indexes too.
It's possible to keep an old ctor, but in this case it would be hard to check all the existing usages.
| ConditionSelectivityEstimator estimator; | ||
| PartitionPruner partition_pruner(storage_snapshot->metadata, filter_dag, local_context); | ||
| ActionsDAGWithInversionPushDown inverted_dag(filter_dag->getOutputs().front(), local_context); | ||
| PartitionPruner partition_pruner(storage_snapshot->metadata, inverted_dag, local_context); |
There was a problem hiding this comment.
Similar to KeyCondition, - ActionsDAGWithInversionPushDown can be constructed inside PartitionPruner
Fix rebase issue: - 20250502 ClickHouse#79180 - 20250416 ClickHouse#78485 - 20250306 ClickHouse#76662 Co-authored-by: liuneng1994 <neng.liu@kyligence.com>
Fix rebase issue: - 20250502 ClickHouse#79180 - 20250416 ClickHouse#78485 - 20250306 ClickHouse#76662 Co-authored-by: liuneng1994 <neng.liu@kyligence.com>
Fix rebase issue: - 20250502 ClickHouse#79180 - 20250416 ClickHouse#78485 - 20250306 ClickHouse#76662 Co-authored-by: liuneng1994 <neng.liu@kyligence.com>
Fix rebase issue: - 20250502 ClickHouse#79180 - 20250416 ClickHouse#78485 - 20250306 ClickHouse#76662 Co-authored-by: liuneng1994 <neng.liu@kyligence.com>
Fix rebase issue: - 20250502 ClickHouse#79180 - 20250416 ClickHouse#78485 - 20250306 ClickHouse#76662 Co-authored-by: liuneng1994 <neng.liu@kyligence.com>
Fix rebase issue: - 20250502 ClickHouse#79180 - 20250416 ClickHouse#78485 - 20250306 ClickHouse#76662 Co-authored-by: liuneng1994 <neng.liu@kyligence.com>
Fix rebase issue: - 20250502 ClickHouse#79180 - 20250416 ClickHouse#78485 - 20250306 ClickHouse#76662 Co-authored-by: liuneng1994 <neng.liu@kyligence.com>
Fix rebase issue: - 20250502 ClickHouse#79180 - 20250416 ClickHouse#78485 - 20250306 ClickHouse#76662 Co-authored-by: liuneng1994 <neng.liu@kyligence.com>
Fix rebase issue: - 20250502 ClickHouse#79180 - 20250416 ClickHouse#78485 - 20250306 ClickHouse#76662 Co-authored-by: liuneng1994 <neng.liu@kyligence.com>
Fix rebase issue: - 20250502 ClickHouse#79180 - 20250416 ClickHouse#78485 - 20250306 ClickHouse#76662 Co-authored-by: liuneng1994 <neng.liu@kyligence.com>
Fix rebase issue: - 20250502 ClickHouse#79180 - 20250416 ClickHouse#78485 - 20250306 ClickHouse#76662 Co-authored-by: liuneng1994 <neng.liu@kyligence.com>
Fix rebase issue: - 20250502 ClickHouse#79180 - 20250416 ClickHouse#78485 - 20250306 ClickHouse#76662 Co-authored-by: liuneng1994 <neng.liu@kyligence.com>
Fix rebase issue: - 20250502 ClickHouse#79180 - 20250416 ClickHouse#78485 - 20250306 ClickHouse#76662 Co-authored-by: liuneng1994 <neng.liu@kyligence.com>
Backport #78485 to 25.4: Fix some cases where secondary index was not applied with analyzer.
Fix rebase issue: - 20250502 ClickHouse#79180 - 20250416 ClickHouse#78485 - 20250306 ClickHouse#76662 Co-authored-by: liuneng1994 <neng.liu@kyligence.com>
Fix rebase issue: - 20250502 ClickHouse#79180 - 20250416 ClickHouse#78485 - 20250306 ClickHouse#76662 Co-authored-by: liuneng1994 <neng.liu@kyligence.com>
Fix rebase issue: - 20250502 ClickHouse#79180 - 20250416 ClickHouse#78485 - 20250306 ClickHouse#76662 Co-authored-by: liuneng1994 <neng.liu@kyligence.com>
Fix rebase issue: - 20250502 ClickHouse#79180 - 20250416 ClickHouse#78485 - 20250306 ClickHouse#76662 Co-authored-by: liuneng1994 <neng.liu@kyligence.com>
Fix rebase issue: - 20250502 ClickHouse#79180 - 20250416 ClickHouse#78485 - 20250306 ClickHouse#76662 Co-authored-by: liuneng1994 <neng.liu@kyligence.com>
Fix rebase issue: - 20250502 ClickHouse#79180 - 20250416 ClickHouse#78485 - 20250306 ClickHouse#76662 Co-authored-by: liuneng1994 <neng.liu@kyligence.com>
Fix rebase issue: - 20250502 ClickHouse#79180 - 20250416 ClickHouse#78485 - 20250306 ClickHouse#76662 Co-authored-by: liuneng1994 <neng.liu@kyligence.com>
Fix rebase issue: - 20250502 ClickHouse#79180 - 20250416 ClickHouse#78485 - 20250306 ClickHouse#76662 Co-authored-by: liuneng1994 <neng.liu@kyligence.com>
Fix rebase issue: - 20250502 ClickHouse#79180 - 20250416 ClickHouse#78485 - 20250306 ClickHouse#76662 Co-authored-by: liuneng1994 <neng.liu@kyligence.com>
Fix rebase issue: - 20250502 ClickHouse#79180 - 20250416 ClickHouse#78485 - 20250306 ClickHouse#76662 Co-authored-by: liuneng1994 <neng.liu@kyligence.com>
Fix rebase issue: - 20250502 ClickHouse#79180 - 20250416 ClickHouse#78485 - 20250306 ClickHouse#76662 Co-authored-by: liuneng1994 <neng.liu@kyligence.com>
Fix rebase issue: - 20250502 ClickHouse#79180 - 20250416 ClickHouse#78485 - 20250306 ClickHouse#76662 Co-authored-by: liuneng1994 <neng.liu@kyligence.com>
Fix rebase issue: - 20250502 ClickHouse#79180 - 20250416 ClickHouse#78485 - 20250306 ClickHouse#76662 Co-authored-by: liuneng1994 <neng.liu@kyligence.com>
Changelog category (leave one):
Changelog entry (a user-readable short description of the changes that goes to CHANGELOG.md):
Fix some cases where secondary index was not applied with analyzer.
Fixes #65607 , fixes #69373
Documentation entry for user-facing changes