Fix partition id pruning for analyzer.#54185
Merged
robot-ch-test-poll4 merged 3 commits intomasterfrom Sep 6, 2023
Merged
Conversation
Contributor
|
This is an automated comment for commit 63c681d with description of existing statuses. It's updated for the latest CI running
|
novikd
approved these changes
Sep 6, 2023
| /// Returns a list of nodes representing atomic predicates. | ||
| static NodeRawConstPtrs extractConjunctionAtoms(const Node * predicate); | ||
|
|
||
| /// Get a list of nodes. For every node, check if it can be compused using allowed subset of inputs. |
Member
There was a problem hiding this comment.
Suggested change
| /// Get a list of nodes. For every node, check if it can be compused using allowed subset of inputs. | |
| /// Get a list of nodes. For every node, check if it can be computed using the allowed subset of inputs. |
| #include <DataTypes/DataTypeTuple.h> | ||
| #include <DataTypes/DataTypesNumber.h> | ||
| #include <DataTypes/DataTypeArray.h> | ||
| #include <Functions/IFunction.h> |
| /// Only elements of the outer conjunction are considered, depending only on the columns present in the block. | ||
| /// If `expression_ast` is passed, use it to filter block. | ||
| void filterBlockWithQuery(const ASTPtr & query, Block & block, ContextPtr context, ASTPtr expression_ast = {}); | ||
| void filterBlockWithQuery(ActionsDAGPtr dag, Block & block, ContextPtr context); |
Member
There was a problem hiding this comment.
Probably it's better to add a comment, that this overload should be used in the new infrastructure.
| { | ||
| const ActionsDAG::Node * node; | ||
| size_t next_child_to_visit = 0; | ||
| bool can_compute_all_childern = true; |
Member
There was a problem hiding this comment.
Suggested change
| bool can_compute_all_childern = true; | |
| bool can_compute_all_children = true; |
azat
reviewed
Sep 8, 2023
| buildIndexes(indexes, query_info.filter_actions_dag, data, parts, context, query_info, metadata_snapshot); | ||
|
|
||
| if (indexes->part_values && indexes->part_values->empty()) | ||
| return std::make_shared<MergeTreeDataSelectAnalysisResult>(MergeTreeDataSelectAnalysisResult{.result = std::move(result)}); |
Member
Member
azat
reviewed
Oct 11, 2023
| return {}; | ||
|
|
||
| auto atoms = filter_dag->extractConjunctionAtoms(filter_dag->getOutputs().at(0)); | ||
| atoms = ActionsDAG::filterNodesByAllowedInputs(std::move(atoms), allowed_inputs); |
Member
There was a problem hiding this comment.
@KochetovNicolai this will not work if the query will have something except for columns from partition by, right?
CREATE TABLE default.forms
(
`form_id` FixedString(24),
`text_field` String
)
ENGINE = MergeTree
PRIMARY KEY form_id
ORDER BY form_id
SETTINGS index_granularity = 8192
insert into forms values ('5840ead423829c1eab29fa97','this is a test');p620.local :) explain indexes=1 select * from forms where _part like '%foo%' and text_field like '%foo%' settings allow_experimental_analyzer=1
EXPLAIN indexes = 1
SELECT *
FROM forms
WHERE (_part LIKE '%foo%') AND (text_field LIKE '%foo%')
SETTINGS allow_experimental_analyzer = 1
Query id: e23f014a-546e-4eab-9fe4-5c09e8ba2c13
┌─explain───────────────────────────────────┐
│ Expression ((Project names + Projection)) │
│ Filter │
│ ReadFromMergeTree (default.forms) │
│ Indexes: │
│ PrimaryKey │
│ Condition: true │
│ Parts: 1/1 │
│ Granules: 1/1 │
└───────────────────────────────────────────┘p620.local :) explain indexes=1 select * from forms where _part like '%foo%' settings allow_experimental_analyzer=1
EXPLAIN indexes = 1
SELECT *
FROM forms
WHERE _part LIKE '%foo%'
SETTINGS allow_experimental_analyzer = 1
Query id: 053ce7a4-fbdb-4f26-86f1-8e3adf8d0c26
┌─explain────────────────────────────────────────────────────────┐
│ Expression ((Project names + Projection)) │
│ Filter ((WHERE + Change column names to column identifiers)) │
│ ReadFromMergeTree (default.forms) │
└────────────────────────────────────────────────────────────────┘
3 rows in set. Elapsed: 0.002 sec.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Changelog category (leave one):
01748_partition_id_pruning