Projection Index Step 1: Support _part_offset in normal projections#78429
Projection Index Step 1: Support _part_offset in normal projections#78429KochetovNicolai merged 25 commits intoClickHouse:masterfrom
Conversation
a15e784 to
c4592e6
Compare
TBH, there is actually requests/cases when people want to read projection data directly. |
ca83047 to
1b23e03
Compare
1b23e03 to
b0fab7f
Compare
|
In the example query: what happens if there's a merge between executing the inner |
It currently uses different snapshots, which can lead to the expected issues. This will be addressed in the next phase of the projection index, where we will avoid relying on subqueries to index rows during queries. |
There was a problem hiding this comment.
Copilot reviewed 11 out of 29 changed files in this pull request and generated no comments.
Files not reviewed (18)
- ci/jobs/scripts/check_style/aspell-ignore/en/aspell-dict.txt: Language not supported
- src/Interpreters/MutationsInterpreter.cpp: Language not supported
- src/Processors/QueryPlan/Optimizations/optimizeUseNormalProjection.cpp: Language not supported
- src/Storages/MergeTree/MergeTask.cpp: Language not supported
- src/Storages/MergeTree/MergeTask.h: Language not supported
- src/Storages/MergeTree/MergeTreeData.cpp: Language not supported
- src/Storages/MergeTree/MergeTreeData.h: Language not supported
- src/Storages/MergeTree/MergeTreeDataMergerMutator.cpp: Language not supported
- src/Storages/MergeTree/MergeTreeDataWriter.cpp: Language not supported
- src/Storages/MergeTree/MergeTreeReadTask.h: Language not supported
- src/Storages/MergeTree/MergeTreeSequentialSource.cpp: Language not supported
- src/Storages/MergeTree/MergeTreeSequentialSource.h: Language not supported
- src/Storages/MergeTree/MergeTreeVirtualColumns.cpp: Language not supported
- src/Storages/MergeTree/MergeTreeVirtualColumns.h: Language not supported
- src/Storages/MergeTree/MergedPartOffsets.h: Language not supported
- src/Storages/MergeTree/StorageFromMergeTreeProjection.cpp: Language not supported
- src/Storages/MergeTree/StorageFromMergeTreeProjection.h: Language not supported
- src/Storages/ProjectionsDescription.cpp: Language not supported
3bf8bd9 to
26a0192
Compare
2a56cf1 to
416b01f
Compare
a010da8 to
782b09b
Compare
|
Fuzzer: not related. |
1f0f8fa
|
I'm seeing some strange behavior with a projection containing it's not guaranteed due to timing of merges, but I saw a result like this: Notably, I cannot reproduce the problem using Is this expected given the current in-progress state of projection indexes? |
|
@EmeraldShift The issue stems from MergeTree tables that lack a sorting key. While optimizations are intended for this case, they haven't been fully implemented yet. I’ll address it later this week. |
|
Oh, interesting. I hadn't considered using |
|
@EmeraldShift Fixed in #81188. |
Changelog category (leave one):
Changelog entry (a user-readable short description of the changes that goes to CHANGELOG.md):
Allow to specify
_part_offsetin normal projection. This is the first step to build projection index. It can be used with #58224 and can help improve #63207This PR also adds some part-level constant virtual columns to projection metadata such as
_part,_partition_id, etc.This PR also adds
mergeTreeProjectiontable function to read from projection parts directly. It is used for introspection.This PR also uses a better way to construct projection metadata without relying on
TemporaryTableHolder. This closes #74853. (Issue is too minor to warrant a dedicated bugfix PR on its own, but worth addressing while we're modifying related code)Documentation entry for user-facing changes